Ffmpeg Convert a Video Using a Specific Audio and Subtitle Track
Fleetingffmpgeg -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
The first number is the input file index, in this case all tracks come from a single file, hence the value 0 everywhere.
The command should be understood as
- -map 0:a:1
- take the second track of the first file (the first is 0, the second is 1),
- -map 0:s:0
- take the first subtitle track of the first file
- -map 0:v:0
- take the first video track of the first file