Recently switched distros from Debian 6 to Ubuntu 12.04. I use multiple USB webcams with OpenCV's python bindings and need to use compression to avoid USB bandwidth issues. In Debian, OpenCV would select the MJPG video mode by default and everything was wonderful. In Ubuntu the default is YUYV and I've found no way to change it.
So far I've tried:
- Recompiling the ffmpeg library
- Preloading v4l2
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libv4l/v4l2convert.so
- Using SetCaptureProperty
cv.SetCaptureProperty(capture['cam'],cv.CV_CAP_PROP_FOURCC, cv.CV_FOURCC('M', 'J', 'P', 'G'))
)- Which gives me the warning: HIGHGUI ERROR: V4L: Property <unknown property="" string="">(6) not supported by device
- Setting the video mode with v4l2-ctl before running OpenCV.
- v4l2-ctl --set-fmt-video=width=640,height=480,pixelformat=MJPG
- This works as confirmed by v4l2-ctl -V but is reset whenever OpenCV runs.
Unfortunately none of those made any difference. And if you're wondering, MJPG works when specified as an outfmt in mplayer, so it's definitely an OpenCV issue.