Opened 19 months ago

Last modified 19 months ago

#10037 new defect

EXT-X-STREAM-INF is missing CODECS attribute when using h264_v4l2m2m encoder

Reported by: nls Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: hls v4l2m2m
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:

Trying to encode for HLS live stream using ffmpeg on a Raspberry Pi 4. Everything is working but the EXT-X-STREAM-INF is missing the CODECS attribute that's present for other h264 encoders like libx264 or the old OMX encoder. We don't use audio in these streams. This makes the stream break in Chrome, because it assumes an audio track when the CODECS attrib is missing.

A possible cause is the v4l2 driver's inability to take the -profile parameter, so it must be omitted from the command line. This might affect the logic for adding the attribute (a wild guess).

How to reproduce:

ffmpeg-new -f v4l2 -thread_queue_size 1024 -input_format yuyv422 -r 30 -video_size 1280x720 -i /dev/video0 -filter:v scale=1024:576 -f hls -hls_playlist_type event -hls_segment_filename http://localhost:3000/upload/segment_04_%06d.ts -master_pl_name master_04.m3u8 -hls_time 6 -c:v h264_v4l2m2m -level:v 4.2 -b:v 2000k -pix_fmt yuv420p -threads 4 -maxrate 1500k -force_key_frames expr:gte(t,n_forced*6) -keyint_min 30 -ss 1 -movflags faststart -headers content-type: application/octet-stream?  -method POST http://localhost:3000/upload/stream_04.m3u8

ffmpeg output:

ffmpeg version 5.1.1-static  Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[video4linux2,v4l2 @ 0x4229a60] Dequeued v4l2 buffer contains corrupted data (0 bytes).
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 0.000000, bitrate: 442368 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 442368 kb/s, 30 fps, 30 tbr, 1000k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_v4l2m2m))
Press [q] to stop, [?] for help
[video4linux2,v4l2 @ 0x4229a60] Dequeued v4l2 buffer contains corrupted data (0 bytes).
    Last message repeated 30 times
[h264_v4l2m2m @ 0x422dff0] Using device /dev/video11
[h264_v4l2m2m @ 0x422dff0] driver 'bcm2835-codec' on card 'bcm2835-codec-encode' in mplane mode
[h264_v4l2m2m @ 0x422dff0] requesting formats: output=YU12 capture=H264
[h264_v4l2m2m @ 0x422dff0] Failed to set gop size: Invalid argument
Output #0, hls, to 'http://localhost:3000/upload/stream_04.m3u8':
    encoder         : Lavf59.27.100
  Stream #0:0: Video: h264, yuv420p(tv, progressive), 1024x576, q=2-31, 1500 kb/s, 15 fps, 90k tbn
      encoder         : Lavc59.37.100 h264_v4l2m2m
[hls @ 0x422b220] Opening 'http://localhost:3000/upload/segment_04_000000.ts' for writing
[hls @ 0x422b220] Opening 'http://localhost:3000/upload/master_04.m3u8' for writing
[hls @ 0x422b220] Opening 'http://localhost:3000/upload/segment_04_000001.ts' for writing
frame=  149 fps= 29 q=-0.0 Lsize=N/A time=00:00:10.00 bitrate=N/A speed=0.891x
video:910kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.

Correct master manifest:


Incorrect master manifest:



OS: Debian 11.5 (Raspberry OS)
Kernel: 5.15.61-v7l+
ffpmeg 5.1.1 static from

The 20220910 build from exhibits the same issue (can't use that because of another bug).

Change History (6)

comment:1 by Carl Eugen Hoyos, 19 months ago

Component: ffmpegundetermined
Keywords: hls v4l2m2m added; ffmpeg HLS removed

Is the issue reproducible with current FFmpeg git head?

comment:2 by Carl Eugen Hoyos, 19 months ago

Version: 5.1.2unspecified

in reply to:  2 comment:3 by nls, 19 months ago

Sorry, I can't check for you, as this would need a recompile and I don't really know how. If you see a chance that since 10 Sep it might have been fixed, I might try to find a way to produce a new build. Is it possible to ask the maintainer of

Last edited 19 months ago by nls (previous) (diff)

in reply to:  1 comment:4 by nls, 19 months ago

Is the issue reproducible with current FFmpeg git head?

I was able to reproduce the error by compiling the following source blob. - 2022-11-14 19:24



CODECS attribute is missing.

comment:5 by nls, 19 months ago

Version: unspecifiedgit-master

comment:6 by nls, 19 months ago

I tested some more. It seems the issue is more complicated. It's not exclusive to the h264_v4l2m2m encoder so the title might need to be changed. The following command produces the same buggy master.m3u8 as the one in OP:

ffmpeg -i result.mp4 -f hls -hls_playlist_type event -hls_segment_filename segment_04_%06d.ts -master_pl_name master_04b.m3u8 -hls_time 6 -c:v copy stream_04b.m3u8

No matter what ffmpeg version, the CODECS attrib is omitted. I tried git master, an OMX-enabled version from a year ago, and the 5.1.1 release. My guess is that some inputs seem to provide the necessary info for adding the attribute, and some don't. So it's a lot more complicated to handle, probably. h264_omx and libx264 encoders, on the other hand, do produce a correct master.m38u, CODECS included.

Note: See TracTickets for help on using tickets.