I want to split input video, scale each stream using different parameters and add subtitles to each output, using the same parameters. I can do it repeating subtitles filter in each chain, can I avoid this duplication?

ffmpeg \
    -i input.mp4
    -filter_complex "[v:0]split=2[v480][v720];
[v720]scale=1280x720,subtitles=sub.srt:force_style='Fontsize=18,MarginV=15'[o720]" \
    -map [o480] -c:v libx264 -b:v 2000k -bufsize:v 3000k -map 0:a -c:a aac -b:a 128k -ac 2 480.mp4 \
    -map [o720] -c:v libx264 -b:v 4000k -bufsize:v 5000k -map 0:a -c:a aac -b:a 128k -ac 2 720.mp4

I this example I want to avoid repeating subtitles=sub.srt:force_style='Fontsize=18,MarginV=15', is it possible?


Apply the subtitles filter before the split. Note that subtitles will be, proportionally, the same size in each output stream.

-filter_complex "[0:v]subtitles=sub.srt:force_style='Fontsize=18,MarginV=15',split=2[v480][v720]; [v480]scale=858x480[o480];[v720]scale=1280x720[o720]"

  • Sure, but if I want video quality to be lower, I don't want the subtitles quality to degrade, that's why I make subtitles burning after scaling – fantom May 1 '20 at 17:55
  • Then you'll need to apply subtitles twice – Gyan May 1 '20 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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