Hi,
So close to having everything working now, but one last hurdle I'd like to iron out. I've built ffmpeg on the pi, enabled a few formats making sure to include libv4l2. All builds OK and this output looks good:
ffmpeg -list_formats all -f v4l2 -i /dev/video0
ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.6 (Debian 4.6.3-14+rpi1)
configuration: --arch=armel --target-os=linux --enable-gpl --enable-libv4l2 --enable-shared --enable-x11grab --enable-libopenjpeg --enable-librtmp --enable-libpulse --enable-version3 --enable-runtime-cpudetect
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[video4linux2,v4l2 @ 0x1bf71d0] Raw : yuv420p : 4:2:0, planar, YUV : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Raw : yuyv422 : 4:2:2, packed, YUYV : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Raw : rgb24 : RGB24 (LE) : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Compressed: mjpeg : JPEG : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Compressed: h264 : H264 : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Compressed: mjpeg : MJPEG : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Raw : Unsupported : 4:2:2, packed, YVYU : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Raw : Unsupported : 4:2:2, packed, VYUY : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Raw : uyvy422 : 4:2:2, packed, UYVY : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Raw : nv12 : 4:2:0, planar, NV12 : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Raw : bgr24 : RGB24 (BE) : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Raw : yuv420p : 4:2:0, planar, YVU : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Raw : Unsupported : 4:2:0, planar, NV21 : {16-2592, 2}x{16-1944, 2}
[video4linux2,v4l2 @ 0x1bf71d0] Raw : bgr0 : RGB32 (BE) : {16-2592, 2}x{16-1944, 2}
/dev/video0: Immediate exit requested
On my ubuntu PC I don't seem to even need to call grabber.setFormat but on the Pi I get
[java] org.bytedeco.javacv.FrameGrabber$Exception: avformat_open_input() error -1052488119: Could not open input "/dev/video0". (Has setFormat() been called?)
[java] at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:432)
[java] at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:380)
if I haven't. So, I try grabber.setFormat("video4linux2"); (and I've tried a few variations on it too), but I get:
[java] org.bytedeco.javacv.FrameGrabber$Exception: av_find_input_format() error: Could not find input format "video4linux2".
[java] at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:404)
[java] at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:380)
I can't figure out if this is something to do with the ffmpeg setup I've got compiled, or somewhere else? Code works fine if I just swap back to OpenCVFrameGrabber. I wonder if I'm either missing a build step somewhere or compiled ffmpeg wrong, or some kind of format mismatch?
Any ideas?
Thanks!