[FFmpeg-user] Negative segment durations in m3u8 file

Valentin Schweitzer vs at nativewaves.com
Tue Aug 11 16:32:42 EEST 2020


when using the HLS muxer, some segment durations in the
output m3u8 file are negative when specifying a very
short hls_time.

Using the attached 264 file and FFmpeg head,
this behavior can be recreated like this:

./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 command line output can be found in the attached log file.
This command produces output along the lines of


An uncut example m3u8 file is attached.
The varying output lengths are expected, due to
splitting along I-Frames, although negative
durations seems like an error.

As I am not sure if this is a case of user
error, I'd like to ask for any advice
to fix this issue and, if possible, find
out why it occurs before opening a trac

The command above is a shortened version
of the original command with which this
bug was discovered. A change of framerate
using -r 30 changes the output values,
but still leaves some negative timestamps.

This behaviour was tested on Ubuntu with
FFmpeg HEAD and on Windows with the latest
Zeranoe pre-built.

I would be thankful for any advice.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.264
Type: application/octet-stream
Size: 609131 bytes
Desc: test.264
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20200811/7e1d2b3a/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ffmpeg-20200811-152051.log
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20200811/7e1d2b3a/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: index.m3u8
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20200811/7e1d2b3a/attachment-0001.ksh>

More information about the ffmpeg-user mailing list