[FFmpeg-trac] #8847(undetermined:new): Negative segment durations in m3u8 file with small hls_time

FFmpeg trac at avcodec.org
Thu Aug 13 14:42:39 EEST 2020


#8847: Negative segment durations in m3u8 file with small hls_time
-------------------------------------+-------------------------------------
             Reporter:  vschweitzer  |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 '''Summary of the bug:'''

 When using the HLS muxer, some segment durations
 in the output m3u8 file are negative when specifying
 a very short hls_time (<0.12s for this example).

 '''How to reproduce:'''

 Using the attached h264 file:
 {{{
 ./ffmpeg -report -i test.264 -pix_fmt yuv420p -vcodec libx264 -b:v 10000k
 -hls_segment_type fmp4 -hls_time 0.1 -hls_flags
 split_by_time+second_level_segment_index -strftime 1 -hls_segment_filename
 stream-%%18d.m4s -hls_playlist_type event index.m3u8
 }}}

 The uncut command line output can be found in the
 attached log file. A sample of the output m3u8 file
 looks like this:

 {{{
 [...]
 #EXTINF:0.200000,
 stream-000000000000000107.m4s
 #EXTINF:0.160000,
 stream-000000000000000108.m4s
 #EXTINF:-0.080000,
 stream-000000000000000109.m4s
 #EXTINF:0.200000,
 stream-000000000000000110.m4s
 #EXTINF:0.160000,
 stream-000000000000000111.m4s
 #EXTINF:-0.040000,
 stream-000000000000000112.m4s
 [...]
 }}}

 Although the varying file lengths are somewhat expected,
 the negative durations seem invalid.

 '''Additional info:'''

 When disabling B-Frames using "-bf 0", no negative durations occur.
 {{{
 ./ffmpeg -report -i test.264 -pix_fmt yuv420p -vcodec libx264 -b:v 10000k
 -hls_segment_type fmp4 -hls_time 0.1 -hls_flags
 split_by_time+second_level_segment_index -strftime 1 -hls_segment_filename
 stream-%%18d.m4s -hls_playlist_type event -bf 0 index.m3u8
 }}}

 Explicitly setting a framerate for the output changes
 the lengths of segments, but does not get rid of negative
 segments.

 This issue was tested on Ubuntu 18.04 and Windows 10,
 using git HEAD and the latest zeranoe build (20200812-bb59bdb)
 respectively.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8847>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list