Duk
Duk

Reputation: 25

ffmpeg how do I choose the correct Audio track?

I'm converting a few .mkv files and need to choose the right Audio track, but dont know how.

This is the command I use:

ffmpeg -i "movie.mkv" -vcodec h264 -acodec aac -strict -2 output.mp4

It is recommended by the webservice where I want to upload the video.

Let's say the Audiotracks look like this:

mkvmerge -i "movie.mkv"

Track ID 0: video (MPEG-4p10/AVC/h.264)
Track ID 1: audio (AC-3)
Track ID 2: audio (TrueHD)
Track ID 3: subtitles (HDMV PGS)

How do I select "Track 1" or "Track 2" for Output? And which track will be selected, if I leave the Code like that? (and why?)

Thanks for help!

Upvotes: 1

Views: 9204

Answers (1)

Gyan
Gyan

Reputation: 93221

ffmpeg has the -map option for manually selecting streams.

For the file shown, use

ffmpeg -i "movie.mkv" -map 0:v:0 -map 0:a:1 -vcodec h264 -acodec aac -strict -2 output.mp4

-strict -2 isn't required for your command with ffmpeg builds from 2016 or later.

Upvotes: 3

Related Questions