How to specify non-default audio stream to MPlayer?

I have an AVI with two audio streams inside. How to play it with MPlayer using the 2nd non-default audio stream?


Solution 1:

To find the audio track ID of the video that you want to play, use this:

mplayer -vo null -ao null -frames 0 -v <filename> | grep aid

To play the file using the audio track required, use the track ID that is found with the previous command and use it in the following one:

mplayer -aid <track_ID> <filename>

Source for this information - FAQ at MPlayerhq.hu

Example:

nits@nits-workstation:$ mplayer -vo null -ao null -frames 0 -v Blood\ \ 18\ Dual\ -\ Moon\ Over\ Ekaterinburg.mkv | grep aid
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
[mkv] Track ID 2: audio (A_AAC), -aid 0, -alang und
[mkv] Track ID 3: audio (A_AAC), -aid 1, -alang und
FAAD: compressed input bitrate missing, assuming 128kbit/s!

##To play with Audio Track ID 3## 
nits@nits-workstation:$ mplayer -aid 1 Blood\ \ 18\ Dual\ -\ Moon\ Over\ Ekaterinburg.mkv 

##To play with Audio Track ID 2## 
nits@nits-workstation:$ mplayer -aid 0 Blood\ \ 18\ Dual\ -\ Moon\ Over\ Ekaterinburg.mkv