0

Source video: h264 mp4, 45 seconds, 30 fps, keyint 30, min keyint 16

I am trying to create an m3u8 playlist where the first chunk is smaller (2 seconds) and the rest are 10 seconds.

when using this command:

ffmpeg.exe -i test4_c.mp4 -codec copy -bsf:v h264_mp4toannexb -start_number 0 -hls_init_time 2 -hls_time 10 -f hls -hls_list_size 0 test4_hls.m3u8

result is 4 10 second ts chunks

when using this command:

ffmpeg.exe -i test4_c.mp4 -codec copy -bsf:v h264_mp4toannexb -start_number 0 -hls_init_time 2 -hls_time 10 -f hls -hls_list_size 100 test4_hls.m3u8

result is 23 2 second ts chunks

what's the issue here?

I have already read this: https://stackoverflow.com/questions/43489097/ffmpeg-hls-init-time-hls-time-not-working-together and it doesn't work

1 Answer 1

0

a colleague figured it out (for a 20 second input video):

ffmpeg -i input.mp4 -map 0 -c copy -f ssegment -segment_list playlist.m3u8 -segment_times 2,12,22 -break_non_keyframes 1 out%03d.ts

if used in a program then segment_times needs to be somehow generated with regards to media length - for instance it won't be 2,12,22 if your media is 60 seconds long and you want 20 second chunks (after the first 2 second one), it will be 2,22,42,62

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.