Opened 5 months ago

Last modified 5 months ago

#7166 new defect

HLS format with fmp4 creates empty init.mp4 file when there is a single m4s output segment

Reported by: catbug Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: hls
Cc: james@moxion.io Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
When using the hls format and fmp4 segment type, ffmpeg creates broken output segments if the input file has a short duration.

Specifically whenever there is a single m4s output segment. This seems to happen anytime the input file duration is less than hls_time, or if the input file only has a single keyframe.

With the repro command below, four files are produced.

  1. init.mp4
  2. segment0.m4s
  3. segment.m3u8 (contents appear correct)
  4. ffmpeg log (from -report flag)

The init.mp4 file is empty with 0 bytes. I inspected the segment0.m4s with mp4dump, and it contains the data that should be in init.mp4, (styp, ftyp & moov).

I expected init.mp4 to contain the styp, ftyp and moov atoms, and segment0.m4s should contain a moof and mdat.

How to reproduce:

% ffmpeg -i h264_5s.mp4 -f hls -hls_segment_type fmp4 -hls_time 10 -report segment.m3u8
ffmpeg version

Reproduced with latest build from today (2018-04-26), and 4.0 release.

I'll upload the report log and sample mp4

Attachments (3)

h264_5s.mp4 (1.0 MB) - added by catbug 5 months ago.
short video to reproduce bug (about 5 seconds, h264)
ffmpeg-20180426-143435.log (48.9 KB) - added by catbug 5 months ago.
ffmpeg report log
mp4dump-segment0.txt (4.4 KB) - added by catbug 5 months ago.
mp4dump of segment0.m4s. seems to match expected contents of init.mp4

Download all attachments as: .zip

Change History (6)

Changed 5 months ago by catbug

short video to reproduce bug (about 5 seconds, h264)

Changed 5 months ago by catbug

ffmpeg report log

Changed 5 months ago by catbug

mp4dump of segment0.m4s. seems to match expected contents of init.mp4

comment:1 Changed 5 months ago by cehoyos

  • Keywords hls added

This is not reproducible with testsrc2=d=2 as input?

comment:2 Changed 5 months ago by catbug

cehoyos, I am able to reproduce with testsrc2. Thanks for your suggestion, I wasn't aware of that feature.

So, here's a cmd to repro the bug with testsrc2 (2 second video)

ffmpeg -f lavfi -i testsrc2=d=2 -f hls -hls_segment_type fmp4 -hls_time 10 -report segment.m3u8

Sanity check, output works fine with a 20 second test

ffmpeg -f lavfi -i testsrc2=d=20 -f hls -hls_segment_type fmp4 -hls_time 10 -report segment.m3u8

comment:3 Changed 5 months ago by jimmymic

  • Cc james@moxion.io added

Possibly related commit id: 8318f60845bbbc4d33a39eee45e4daff0e5dacfb
Which was a fix for ticket #6888

Note: See TracTickets for help on using tickets.