CasualDemon
CasualDemon

Reputation: 6160

FFmpeg subtitle filter set start time

I am trying to burn-in subtitles for a shorter section of a video, but using the subtitles filter always starts from the beginning of the subtitle stream, not at the specified start time, even when copying from the same video.

So for example if I start an encode 10 minutes in to a film, the video will properly be set from there, but the subtitles will start from the beginning (10 minute offset in this case).

ffmpeg -y -ss 600.0 -to 660.0 -i movie.mkv -filter_complex "[0:0]subtitles='movie.mkv':si=1[v]" -map "[v]" -c:v libx265 -crf 22 output.mkv

This is not a problem when using picture based subtitles and the overlay filter, such as:

-filter_complex "[0:0][0:2]overlay[v]"

It seems to only affect text based subtitles. I don't know if this is just not possible and will require another solution, or if I am approaching it wrong. Any help is appreciated!

Upvotes: 1

Views: 1576

Answers (1)

CasualDemon
CasualDemon

Reputation: 6160

The issue was that I was using "fast seek" time, aka setting it before the input, which does not seem to be compatible with the subtitle filter. Which means the -ss and -to need to be moved after the input -i movie.mkv

ffmpeg -y  -i movie.mkv -ss 600.0 -to 660.0 -filter_complex "[0:0]subtitles='movie.mkv':si=1[v]" -map "[v]" -c:v libx265 -crf 22 output.mkv

Upvotes: 2

Related Questions