Konubinix' opinionated web of thoughts

Ffmpeg Convert a Video Using a Specific Audio and Subtitle Track

fleeting

ffmpeg, ffmpeg -map option

ffmpgeg -i thefile

#+RESULT

 Stream #0:0: Video: h264 (High), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 640x480 [SAR 1:1 DAR 4:3], 29.97 fps, 29.97 tbr, 1k tbn (default)
 Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
   Metadata:
     title           : Stereo
 Stream #0:2(fra): Audio: aac (LC), 48000 Hz, stereo, fltp
   Metadata:
     title           : Stereo
 Stream #0:3(eng): Subtitle: dvd_subtitle, 720x480

Say I want to use the second audio track and the first subtitle track

ffmpeg -i thefile -map 0:a:1 -map 0:s:0 -map 0:v:0 outfile

I need to specify the map for the video also, or it will be dropped by the command

Also, I don’t understand the first 0:, but the command should be understood as

-map 0:a:1
take the second track (the first is 0, the second is 1),
-map 0:s:0
take the first subtitle track
-map 0:v:0
take the first video track

Notes linking here