FFMPEG burn subtitles while Cutting video

1

1

I was looking for issue where if we cut video using -ss flag, video conversion doesn't start. The answer I found suggests to use -ss flag before -i flag to seek video before conversion.

ffmpeg  -ss 01:06:29 -i "input.mp4" -t 00:00:35 -vf "subtitles=sub.srt:force_style='FontSize=32,PrimaryColour=&Hfcc545',scale=462:-1" "output.mp4"

But when I use this approach, subtitles don't get burned to output.

Zorro Here

Posted 2016-08-29T11:49:48.353

Reputation: 25

Answers

1

The subtitles filter only starts when the timecode of the first subtitle is encountered. If you use -ss before -i and the remaining duration is less than the timecode of the first subtitle, then it won't be activated.

Either modify the subtitle so that the first subtitle is one that is set to show after the cutpoint and reduce all timecode references by that amount

--or--

Use -ss after -i, like you were doing before. Note that the conversion does start. What's happening is that FFmpeg decodes all packets and discards them until seek point is reached. The encoding statistics don't start rolling till encoding commences. That only happens when the seek point is reached, which will take some time, depending on how deep your seek point is.

Gyan

Posted 2016-08-29T11:49:48.353

Reputation: 21 016

Ya I was trying to save conversion time. Now I converted subtitle file first using output seeking(-ss after -i) then did video encoding using input seeking(-ss before -i), takes two passes but saves the time. Thanks. – Zorro Here – 2016-08-29T12:50:58.683

Why two passes? You can burn and encode in one go. – Gyan – 2016-08-29T13:20:11.157

1Yes sorry for confusion, it burns and encodes in single pass just I have to cut subtitles first using ffmpeg -ss 01:06:30.80 -i "sub.srt" -t 00:00:35 "out.srt". If you mean I can cut subtitles, burn and encode in single pass please post how I can do that. – Zorro Here – 2016-08-29T13:49:12.810