Recently, I’ve been working on a solution for playing videos in public places (indoors). The requirement was an HD TV with an attached mini PC box, which plays a playlist created via web interface on a central server.
All the movies will be uploaded to the server and downloaded by the boxes through FTP. The box features a listening socket, for controlling the software remotely and checking the online-status. I used mplayer as the video player.
It was quite a fun project, involving custom configuration of X.org and a lot of Perl-coding on the box-side. It just boots up and starts playing it’s local playlist without user interaction. The server runs a PHP application for managing the boxes and creating playlists.
The box itself is a Zotac ZBOX AD02 with AMD Fusion chipset. It features an energy efficient AMD Neo X2 CPU, which contains a Radeon HD 3200 graphics core (It even supports AMD-V; AMD’s virtualization technology). It’s also got VESA mounting gear, so you can mount it to the back of most displays / TVs.
Everything went pretty good at first. I set up Debian 6 and installed AMD’s proprietary vdeo driver and got pretty smooth 1080p video playback. Wonderful video performance for such a small and relatively cheap PC!
My setup at this time was, that my old CRT monitor was connected through VGA and sound went through the front headphone jack. So as I was trying to hook the box to my TV through HDMI, I noticed there was no sound playing. I’ve tried a lot of things, from changing to the open source video drivers (radeon / radeonhd) to fiddling around with ALSA and some other stuff.
Finally, after lots of googleing, I found the cause: AMD’s HDMI Sound got supported by ALSA in version 1.0.23 (which was released in April 2010 …). Debian’s Kernel 2.6.32-5 still used ALSA 1.0.19, so I had to upgrade.
I downloaded the current Linux kernel source from kernel.org and followed this How To to build and install the debian package.
Then I had to disable the onboard Azalia sound chip in the BIOS settings, as there was still no HDMI audio as long as it was activated.
After booting the new kernel image, there is still one important step. I had to unmute the S/PDIF channel in alsamixer. If you don’t have the alsamixer command, you need to install alsa-utils through apt or aptitude.
In alsamixer there should only be the S/PDIF channel, so press m to unmute it. You can see it’s not mute when there is oo in the above box, instead of MM.
Now to find out the exact ALSA device/channel configuration to use for you applications, run aplay -l and you will see something like this:
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
Subdevice #0: subdevice #0
As we only have AMD’s HDMI Audio enabled, we only see this one soundcard. In ALSA speak this is device 0,3. Try playing a video or audiofile with mplayer now, to see if your sound is working correctly:
mplayer -ao alsa:device=plughw=0.3 /path/to/file.mp3
I use plughw here, because it automatically converts the audio stream to the right format for the soundcard, as opposed to hw, where the audio stream must be in the right format already.
Some applications (like aplay) take the device and channel separated by a comma (,) instead of a dot, so be aware of that.