[FFmpeg-user] How to cut a clip from video with subtitles?

Ferdi Scholten ferdi at sttc-nlp.nl
Sat Feb 15 15:17:42 EET 2025


On 15-02-2025 13:25, mbork at mbork.pl wrote:
> Hi all,
>
> I have a video with subtitles (as an srt file).  I want to clip
> a fragment from it, scaling it down to a worse resolution, _and_ put the
> subtitles in the resulting clip.
>
> This is how I do it now:
>
> time ffmpeg -y -i some_film.mp4 -ss 121052ms -to 140392ms -c:v libx264 -c:a copy -vf subtitles=some_film.srt -vf scale=240:-1 clip.mp4
>
> However, this "burns the subtitles into the video", and I'd prefer to
> have them as a separate track.  I tried this:
>
> time ffmpeg -y -i some_film.mp4 -i some_film.srt -ss 121052ms -to 140392ms -c:v libx264 -vf scale=240:-1 -c:a copy -c:s mov_text clip.mp4
>
> but it didn't work - the clip was selected correctly, the resolution was
> correct, but I couldn't see the subtitles.
>
> What am I doing wrong?
>
> Thanks in advance,
>
FFmpeg does not write subtitle files as far as i know.

But as an .SRT file is just plain text, you can just edit the content 
with a simple text editor to match your clip, all you have to do is 
remove the lines that are not in your clip and adjust the numbers and 
timestamps of the lines that are left. Depending on the length it might 
be possible to script this, but for a short clip it could be done by 
hand quicker than scripting it.

Alternatively you can convert your srt input, mp4 only supports one type 
of subtitle stream, so you will have to convert your srt input to 
mov_text, remove the subtitle filter and add -c:s mov_text

Or switch to another container like mkv, that does support srt subtitle 
streams, remove the subtitle filter and add -c:s copy



More information about the ffmpeg-user mailing list