[FFmpeg-user] Subtitle track command consolidation
Ferdi Scholten
ferdi at sttc-nlp.nl
Sun Feb 16 23:34:25 EET 2025
On 16-02-2025 21:11, Robert Schwalbe wrote:
> Greetings!
>
> Have mercy ...
>
> I have one input file that contains a single video track and two audio
> tracks. I discard the unwanted audio
> track with the following command:
>
> ffmpeg -i input.mp4 -map 0:v -map 0:a:1 -c copy tmp.mp4
>
> From an input file containing one subtitle track, I add the subtitle
> with the following command:
>
> ffmpeg -i tmp.mp4 -i input.srt -c copy -c:s mov_text
> -metadata:s:s:0 language=eng output.mp4
>
> Is there a way to consolidate these two commands into a single
> command? In particular, adding in the
> subtitle. I am using "ffmpeg version 4.4.5".
>
> If you are so inclined, I would be more than amenable to criticisms as
> to how I am going about my business. I
> constantly strive for best practices but after a lot of trial and
> error I just settled upon the above.
>
> Seems I can do better.
>
> With sincere appreciation and gratitude for this list. Thank you.
First, upgrade your ancient FFmpeg to the current 7.1 version
Then as you already are familiar with the usage of map, use that to
incorporate everything into a single command like this:
ffmpeg -i input.mp4 -i input.srt -map 0:v -map 0:a:1 -c:a copy -map
1:s:0 -c:s mov_text -metadata:s:s:0 language=eng output.mp4
Haven't tested this but should work.
More information about the ffmpeg-user
mailing list