Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#9193 closed defect (fixed)

Invalid initialization segment with HLS FMP4 encoder

Reported by: Jason Owned by:
Priority: important Component: avformat
Version: git-master Keywords: hls regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Jason)

VERSION: ffmpeg version 4.4 + head branch| Windows & Linux

The HLS encoder (used with fmp4 segmenting) began generating invalid initialization segments consisting of 5 boxes (ftyp, moov, sidx, moof, & mdat) with the latest release -- and an invalid first data segment consisting of a single styp box with no data. Subsequent segments after the first are OK.

It appears if the initialization segment has taken over the data from the first segment.

Version 4.3 and the dash encoder generate an initialization segment with a single ftyp and moov box, as expected.

Here is sample command and file that exhibits the behavior:

./ffmpeg.exe -i "https://carbon-media.accelerator.net/00000000001/4ajEIDZneABc1Uin8Pw163" -y -report -an -codec:v libx264 -b:v 1000k -s 960x540 -hls_time 4 -hls_segment_type fmp4 -hls_playlist_type event -f hls "output.m3u8"

The complete log output / report is attached.

Attachments (2)

ffmpeg-20210419-100318.log (732.3 KB ) - added by Jason 3 years ago.
Command Output Files.png (108.6 KB ) - added by Jason 3 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 by Jason, 3 years ago

Description: modified (diff)

comment:2 by Jason, 3 years ago

Summary: Invalid initialization segment with HLS FMP4 SegementationInvalid initialization segment with HLS FMP4 encoder

comment:3 by Jason, 3 years ago

Description: modified (diff)

comment:4 by Carl Eugen Hoyos, 3 years ago

Keywords: hls added
Priority: importantnormal

Please test current FFmpeg git head and provide the command line you tested together with the complete, uncut console output and an input file to make this a valid ticket.

by Jason, 3 years ago

Attachment: ffmpeg-20210419-100318.log added

comment:5 by Jason, 3 years ago

Description: modified (diff)

comment:6 by Jason, 3 years ago

Hi Carl. I've attached the full uncut log (run against a build cut from yesterdays HEAD) and included a source in the command line used to recreate the behavior.

by Jason, 3 years ago

Attachment: Command Output Files.png added

comment:7 by steffend, 3 years ago

Reverting b5ca8f2c66954614d81579082025f580efc0cffc (coming from #8636) fixes this issue for me. Possibly fixes the other issue (#9205) too.

You can try this with a simple

git revert b5ca8f2c66954614d81579082025f580efc0cffc

on the latest master branch.

I've come across this when trying to play an HLS-fmp4 stream generated with the latest FFmpeg using ffplay:

ffplay version 4.4 Copyright (c) 2003-2021 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.29)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[hls @ 0x7fc42d05f600] Skip ('#EXT-X-VERSION:7')
[hls @ 0x7fc42d05f600] Opening '7858485ed5a3afab23523f6de39a215e-1.mp4' for reading
[hls @ 0x7fc42d05f600] Opening '7858485ed5a3afab23523f6de39a215e0.mp4' for reading
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc42d80c200] invalid size 0 in stsd
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc42d80c200] error reading header
main.m3u8: Invalid data found when processing input
Last edited 3 years ago by Carl Eugen Hoyos (previous) (diff)

comment:8 by Carl Eugen Hoyos, 3 years ago

Component: undeterminedavformat
Keywords: regression added
Priority: normalimportant

comment:9 by Carl Eugen Hoyos, 3 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.