mplayer — multiple sound cards: select audio device 

Mplayer is the ultimate media player. Bold statement, huh? Well mplayer is loaded with features, options, switches and other functionalities. If default settings satisfy your needs then that is great. However, if you have to use some of the non-default functionalities then mplayer's shell syntax can take a little getting used. This post contains examples of how to select an audio architecture that mplayer uses (e.g. ALSA, OSS, etc.) as well as how to select a specific audio device if you have multiple sound cards.

Typically, to play some mp3 audio files with mplayer the following command can be used.

mplayer *.mp3

However, what if you wanted to be a bit more specific, f.e. as to which audio architecture is to be used, e.g. OSS or ALSA. Well, the following commands achieve exactly this, respectively.

mplayer -ao oss *.mp3
mplayer -ao alsa *.mp3

Going further, if you had multiple audio devices you could specify which device to use. For example, to explicitly specify the default device either of the following commands can be used.

mplayer -ao oss:/dev/dsp *.mp3
mplayer -ao alsa:device=hw=0.0 *.mp3

Or, to specify a non-default (secondary) device either of the following commands can be used.

mplayer -ao oss:/dev/dsp1 *.mp3
mplayer -ao alsa:device=hw=1.0 *.mp3

The syntax in the above examples is quite obvious, however at first it can take some effort to get it right.

Enjoy! :D

Did you find the above information useful and interesting? If so, please support this site by using the blog directory links at the bottom of this page. Thanks for your support!

If you have any Linux related problems or questions then please feel free to post them on our Linux Forums:

VPS Hosting Referral Code DZZCC3

Add me to Technorati Favorites Vote for me on Blog Catalog

9 Responses to “mplayer — multiple sound cards: select audio device”

  1. Anonymous Says:

    that was exactly what I was looking for, thank you very much!

  2. xevna Says:

    great, since i have 2 sound cards in my "music" server it's a great solution

  3. kalle Says:

    Thank you so much. Been looking for this for forever, searched thru the mplayer man page etc. but just couldn't find it (using secondary device). Major kudos. :)

  4. karibe Says:

    Exactly what i needed, i have 3 cards; the third one is a usb connected to a subwoofer that i wanted to use, so i used hw=2.0 and worked like charm

  5. Desmond Says:

    Thanks. Worked for me

  6. thana Says:

    you made my day!

  7. OSS-Audio-Device beim mplayer auswählen « Says:

    […] letzter Zeit immer häufiger den altgedienten mplayer verwende, musste ich mal nachschauen und bin hier fündig geworden. Der Befehl für den mplayer lautet: mplayer -ao oss:/dev/dsp […]

  8. Drawin Kumar Says:

    Great & simple article, I can use it on windows too :)
    e.g. mplayer -ao dsound:device=2 *.mp3
    To use the secondary device.

  9. alo Says:

    very good. Thank you

Leave a Reply