Opened 4 years ago
Last modified 4 years ago
#8847 new defect
Negative segment durations in m3u8 file with small hls_time
Reported by: | vschweitzer | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
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.
Attachments (4)
Change History (5)
by , 4 years ago
by , 4 years ago
Attachment: | command_line_output.log added |
---|
The full, uncut command line output, generated using -report.
by , 4 years ago
Attachment: | command_line_output_no_b_frames.log added |
---|
The full, uncut command line output with B-frames disabled. Generated using -report.
by , 4 years ago
Attachment: | 0001-avformat-hlsenc-check-the-segment-duration-valid.patch added |
---|
comment:1 by , 4 years ago
try this patch please.
i will send it to maillist on monday if no problem.
Input video file. This is the "foreman" video sequence.