[FFmpeg-user] Can FFmpeg Record Video On Linux Using V4L2 in V4L2_CAP_VIDEO_CAPTURE_MPLANE Mode?

Andriy Gelman andriy.gelman at gmail.com
Thu Apr 29 05:46:44 EEST 2021


On Wed, 28. Apr 14:36, Bossert Andrew via ffmpeg-user wrote:
> Hi Moritz,
> 
> Thanks for your response. I'm going to try to get the email format right here but if I don't feel free to yell at me and let me know how it is supposed to be.
> 
> >> On Wed, Apr 28, 2021 at 13:17:25 +0000, FFmpeg user discussions wrote:
> >> $ ffmpeg -f v4l2 -list_formats all -i /dev/video1  # Look at device 
> >> information
> >>
> >> $ ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 
> >> output.mkv  # save the video
> 
> > You'll have to use the same device for both commands, but I assume that's a typo or a copy/paste mistake.
> 
> That was a copy paste error it should have been /dev/video0 for both, sorry about that. Just fyi I have 4 video devices video0-video3 that are all the same so I do not believe it should matter. 
> 
> >> I get the following output with both commands
> >>
> >> [video4linux2,v4l2 @ 0xcbbd4f0] Not a video capture device.
> >> /dev/video1: No such device
> 
> > You should show us the complete, uncut console output of the command using the correct device.
> 
> Here is the full output of trying to capture video.
> 
> $ ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0
> ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
>   built with gcc 9.2.0 (GCC)
>   configuration: --disable-stripping --enable-pic --enable-shared --enable-pthreads --cross-prefix=aarch64-klondike-linux- --ld='aarch64-klondike-linux-gcc --sysroot=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot' --cc='aarch64-klondike-linux-gcc --sysroot=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot' --cxx='aarch64-klondike-linux-g++ --sysroot=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot' --arch=aarch64 --target-os=linux --enable-cross-compile --extra-cflags=' -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0=/usr/src/debug/ffmpeg/4.2.1-r0 -fdebug-prefix-map=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-m
>  x8-klondike-linux/ffmpeg/4.2.1-r0=/usr/src/debug/ffmpeg/4.2.1-r0 -fdebug-prefix-map=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot= -fdebug-prefix-map=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot-native= --sysroot=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed' --sysroot=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot --libdir=/usr/lib --shlibdir=/usr/lib --datadir=/usr/share/ffmpeg --disable-mipsdsp --disable-mipsdspr2 --cpu=generic --pkg-config=pkg-config --disable-static --enable-alsa --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avresample --enable-bzlib --enable-gpl --disable-lib
>  gsm --disable-indev=jack --disable-libvorbis --enable-lzma --disable-libmfx --disable-libmp3lame --disable-openssl --enable-postproc --disable-sdl2 --disable-libspeex --enable-swresample --enable-swscale --enable-libtheora --disable-vaapi --disable-vdpau --disable-libvpx --enable-libx264 --disable-libxcb --disable-outdev=xv --enable-zlib
>   libavutil      56. 31.100 / 56. 31.100
>   libavcodec     58. 54.100 / 58. 54.100
>   libavformat    58. 29.100 / 58. 29.100
>   libavdevice    58.  8.100 / 58.  8.100
>   libavfilter     7. 57.100 /  7. 57.100
>   libavresample   4.  0.  0 /  4.  0.  0
>   libswscale      5.  5.100 /  5.  5.100
>   libswresample   3.  5.100 /  3.  5.100
>   libpostproc    55.  5.100 / 55.  5.100
> [video4linux2,v4l2 @ 0x2f506540] Not a video capture device.
> /dev/video0: No such device
> 
> > Can you also use a tool such as v4l-info, and post its output here?
> 
> I don't have v4l-info but I am hoping this is similar to what you wanted.
> 
> $ v4l2-ctl --info
> Driver Info:
>         Driver name      : mxc-isi
>         Card type        : mxc-isi
>         Bus info         : platform:58100000.isi.0
>         Driver version   : 4.14.98
>         Capabilities     : 0x84201000
>                 Video Capture Multiplanar
>                 Streaming
>                 Extended Pix Format
>                 Device Capabilities
>         Device Caps      : 0x04201000
>                 Video Capture Multiplanar
>                 Streaming
>                 Extended Pix Format
> Media Driver Info:
>         Driver name      : mxc-md
>         Model            : FSL Capture Media Deivce
>         Serial           :
>         Bus info         :
>         Media version    : 4.14.98
>         Hardware revision: 0x00000000 (0)
>         Driver version   : 4.14.98
> Interface Info:
>         ID               : 0x03000014
>         Type             : V4L Video
> Entity Info:
>         ID               : 0x00000012 (18)
>         Name             : mxc_isi.0.capture
>         Function         : V4L2 I/O
>         Pad 0x01000013   : Sink
>           Link 0x02000066: from remote pad 0x100000e of entity 'mxc_isi.0': Data, Enabled
> 
> >> I see here (https://github.com/FFmpeg/FFmpeg/blob/master/libavdevice/v4l2.c#L172) that v4l2 devices need to support V4L2_CAP_VIDEO_CAPTURE to open. My device does not support V4L2_CAP_VIDEO_CAPTURE but it does support V4L2_CAP_VIDEO_CAPTURE_MPLANE. Does FFmpeg have support for V4L2_CAP_VIDEO_CAPTURE_MPLANE?
> 
> > I'm not really too knowledgable about these "newer" devices, but I believe they are supported by the v4l2_m2m codec(s). Someone else may need to explain why your device isn't recognized, after you have provided the requested output.
> 
> > Here is a check for MPLANE:
> > https://github.com/FFmpeg/FFmpeg/blob/8bc7f69cefbcbb265b41717608dc8436dc864a55/libavcodec/v4l2_m2m.c#L51
> 
> I tried using v4l2_m2m as an input format but that was probably wrong. 
> 
> $ ffmpeg -f v4l2_m2m -framerate 25 -video_size 640x480 -i /dev/video0
> ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
>   built with gcc 9.2.0 (GCC)
>   configuration: --disable-stripping --enable-pic --enable-shared --enable-pthreads --cross-prefix=aarch64-klondike-linux- --ld='aarch64-klondike-linux-gcc --sysroot=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot' --cc='aarch64-klondike-linux-gcc --sysroot=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot' --cxx='aarch64-klondike-linux-g++ --sysroot=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot' --arch=aarch64 --target-os=linux --enable-cross-compile --extra-cflags=' -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0=/usr/src/debug/ffmpeg/4.2.1-r0 -fdebug-prefix-map=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-m
>  x8-klondike-linux/ffmpeg/4.2.1-r0=/usr/src/debug/ffmpeg/4.2.1-r0 -fdebug-prefix-map=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot= -fdebug-prefix-map=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot-native= --sysroot=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed' --sysroot=/home/andrew/Projects/quicksilver-main/build-quicksilver/tmp/work/aarch64-mx8-klondike-linux/ffmpeg/4.2.1-r0/recipe-sysroot --libdir=/usr/lib --shlibdir=/usr/lib --datadir=/usr/share/ffmpeg --disable-mipsdsp --disable-mipsdspr2 --cpu=generic --pkg-config=pkg-config --disable-static --enable-alsa --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avresample --enable-bzlib --enable-gpl --disable-lib
>  gsm --disable-indev=jack --disable-libvorbis --enable-lzma --disable-libmfx --disable-libmp3lame --disable-openssl --enable-postproc --disable-sdl2 --disable-libspeex --enable-swresample --enable-swscale --enable-libtheora --disable-vaapi --disable-vdpau --disable-libvpx --enable-libx264 --disable-libxcb --disable-outdev=xv --enable-zlib
>   libavutil      56. 31.100 / 56. 31.100
>   libavcodec     58. 54.100 / 58. 54.100
>   libavformat    58. 29.100 / 58. 29.100
>   libavdevice    58.  8.100 / 58.  8.100
>   libavfilter     7. 57.100 /  7. 57.100
>   libavresample   4.  0.  0 /  4.  0.  0
>   libswscale      5.  5.100 /  5.  5.100
>   libswresample   3.  5.100 /  3.  5.100
>   libpostproc    55.  5.100 / 55.  5.100
> Unknown input format: 'v4l2_m2m'
> 
> Thanks for the link I will try to learn more about v4l2_m2m.
> 

Looks that the mplane format is currently not supported when capturing from a
v4l2 device at the moment.

If you have time, please create a ticket on https://trac.ffmpeg.org/report 

v4l2_m2m is something different. It's an interface to do hardware
encoding/decoding on a supporting device. Here is a documentation patch (not
merged yet):
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200117034211.12142-1-andriy.gelman@gmail.com/

-- 
Andriy


More information about the ffmpeg-user mailing list