Mplayer sound via SPDIF

I recently lost sound via mplayer on my MythTV mediacenter. This affected any of my video collection that weren't DVD iso images since mplayer was the configured player for most types. At first I thought it might have been related to doing a system update, but now I think it was related to my tinkering which got interrupted by the kids - and then promptly forgotten about. Days or weeks later, I was surprised to find the sound missing when playing videos (rarely done - I usually watch the recordings or DVDs which use the internal player).

Now that I've fixed the issue, the problem is obvious. I have a Gigabyte motherboard and I use the SPDIF output to take the sound via optical cable into my surround sound receiver. In the video setup, I had the default player set to mplayer with the command:

mplayer -ao alsa:device=spdif -fs -zoom -quiet -vo xv %s


This directed sound to the SPDIF output. But, when using MythStream, no sound came out when watching things such as the Apple movie trailers (MythStream doesn't let you specify settings for mplayer like MythVideo does). Thus the tinkering began. What I needed to do is configure mplayer to always send sound to SPDIF. You can do this by specifying settings in ~/.mplayer/config

ao=alsa:device=spdif


Now, everything is good. Mplayer sound always goes via SPDIF, whether I'm playing it through MythTV (MythVideo) or not.

Note that before I arrived at this solution I'd tried other settings in the mplayer config. When I had the settings wrong I saw the following when running mplayer from the command line:
...
Forced audio codec: hwac3
Cannot find codec for audio format 0x73627276.
Read DOCS/HTML/en/codecs.html!
Audio: no sound
...


This was occurring because I'd been googling for solutions and was lead to try values such as:
ao=alsa:device=hw#0.1
ac=hwac3


in the mplayer config file.

Popular posts from this blog

Slow, Buffering, Stuttering Udemy Video

Memory upgrade for media center

JUnit parameterized test with Spring autowiring AND transactions