[FFmpeg-user] h264_v4l2m2m Failed to set gop size: Invalid argument

Ram Shaffir ram at ram.sh
Fri Dec 11 12:05:52 EET 2020


Hello Andriy, thank you for taking the time and try to help me!

> Does it work in ffplay?


Yes it does play in ffplay:
ffplay version N-86265-gb946bd8 Copyright (c) 2003-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 63.100 / 55. 63.100
  libavcodec     57. 96.101 / 57. 96.101
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 90.100 /  6. 90.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '64b.mp4':sq=    0B f=0/0
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:08.84, start: 63109.080000, bitrate: 6535 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 6534 kb/s, 25 fps, 25 tbr, 12800 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
63118.33 M-V: -0.034 fd=   5 aq=    0KB vq=    0KB sq=    0B f=0/0

/////////////////////// END OF OUTPUT ///////////////////////

> For debugging you may want to simplify the problem. Try to encode another
> video with h264_v4lm2m.
> Does a software encoder work with v4l2 input?


The following call was the simplest one I could get any video output, and the video output also doesn't play in "dump" player but it does play in ffplay and vlc (it produced the same result with and without -f v4l2):
/home/pi/FFmpeg/ffmpeg -f v4l2 -input_format yuyv422 -i /dev/video0 -vcodec h264_v4l2m2m -pix_fmt nv12 /home/pi/Videos/64b.mp4
ffmpeg version ca55240 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/home/pi/ffmpeg_build --pkg-config-flags='pkg-config --static' --extra-cflags=-I/home/pi/ffmpeg_build/include --extra-ldflags=-L/home/pi/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/pi/bin --enable-gpl --enable-gnutls --disable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --disable-libx265 --enable-nonfree --arch=aarch64 --disable-libxml2 --enable-libwebp --enable-libdrm
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 63684.175099, bitrate: 1988671 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 1988671 kb/s, 59.94 fps, 59.94 tbr, 1000k tbn, 1000k tbc
File '/home/pi/Videos/64b.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_v4l2m2m))
Press [q] to stop, [?] for help
[h264_v4l2m2m @ 0x5573d864e0] Using device /dev/video11
[h264_v4l2m2m @ 0x5573d864e0] driver 'bcm2835-codec' on card 'bcm2835-codec-encode' in mplane mode
[h264_v4l2m2m @ 0x5573d864e0] requesting formats: output=NV12 capture=H264
[h264_v4l2m2m @ 0x5573d864e0] Failed to set gop size: Invalid argument
Output #0, mp4, to '/home/pi/Videos/64b.mp4':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: h264 (h264_v4l2m2m) (avc1 / 0x31637661), nv12, 1920x1080, q=-1--1, 200 kb/s, 59.94 fps, 14026 tbn, 59.94 tbc
    Metadata:
      encoder         : Lavc58.91.100 h264_v4l2m2m
frame=  453 fps= 42 q=-0.0 Lsize=     497kB time=00:00:07.54 bitrate= 539.6kbits/s dup=367 drop=0 speed=0.693x    
video:494kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.528277%
Exiting normally, received signal 2.

/////////////////////// END OF OUTPUT ///////////////////////
 
> This means that the parameter is not supported on the hardware encoder.
> Nothing to be concerned about.


That’s very good to know! If so, what is the root of the problem?

Once again, many thanks, I appreciate it much!


More information about the ffmpeg-user mailing list