[FFmpeg-user] Segment muxer generates odd duration on first segment

Gabriel Balaich roderrooder at gmail.com
Thu May 13 00:59:09 EEST 2021


*When using the segment muxer the first segment has a different duration
than the others even when forcing keyframes:*
ffmpeg `
-f lavfi -i color=color=red:size=640x360:rate=30 `
-c:v libx264 -force_key_frames 'expr:gte(t,n_forced*2)' -pix_fmt yuv420p -t
30 -f segment -segment_time 6 `
-segment_list "C:\Users\gabri\Videos\Test\test.m3u8" `
"C:\Users\gabri\Videos\Test\test%01d.ts"

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:7
#EXTINF:6.066667,
test0.ts
#EXTINF:6.000000,
test1.ts
#EXTINF:6.000000,
test2.ts
#EXTINF:6.000000,
test3.ts
#EXTINF:6.000000,
test4.ts
#EXT-X-ENDLIST


*I also noticed that the "TARGETDURATION" listed in segment muxer generated
playlist is incorrect. The HLS muxer, however, does not display either of
these issues:*
ffmpeg `
-f lavfi -i color=color=red:size=640x360:rate=30 `
-c:v libx264 -force_key_frames 'expr:gte(t,n_forced*2)' -pix_fmt yuv420p -t
30 -f hls -hls_list_size 0 -hls_time 6 `
-hls_segment_filename "C:\Users\gabri\Videos\Test\test%01d.ts" `
"C:\Users\gabri\Videos\Test\test.m3u8"

#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:6.000000,
test0.ts
#EXTINF:6.000000,
test1.ts
#EXTINF:6.000000,
test2.ts
#EXTINF:6.000000,
test3.ts
#EXTINF:6.000000,
test4.ts
#EXT-X-ENDLIST


I tried numerous options to eliminate these inconsistencies but came up
short, I prefer using the segment muxer because of the -segment_wrap option.

Any reason why it would be this way?


More information about the ffmpeg-user mailing list