In Version 5 beta 3, there is an easy way to redirect the output: Simply put a file named “alsa.txt” on the /boot drive, whith only one number in it. On Raspi, 0 should be HDMI, 1 should be Onboard Analog, 2 would be an external card. If there is no file present, it defaults to 0. When logged in, see below how to find your card number via “aplay -l”. You could also use trial&error by using numbers counting up from 1 until you find your correct output.
The upcoming Version 5 will be switching to external usb devices when they are present while booting up, and fall back to HDMI if there is no output. “alsa.txt” will still be supported for special interfaces, or to manually select internal analog audio, if it has to be that awful port.
Version 4 Preparations to Change Output
Get a Raspi with ethernet and connect it to your network, so you can easily login via ssh. After logging in, start by remounting the filesystem for write access.
sudo mount -o remount,rw /
For v4.20 and older, the audio output has to be sent through ALSA, instead of going to both HDMI and Headphones, which is default. The player argument “adev” (means audio device) “both” will make use of the Raspberry Hardware directly. Sending it through ALSA (a standard Linux sound framework) means we can send it to every output available to the system. Sadly, it cannot be changed for mp4m-sync. Beta 5 is already using ALSA, which means you can skip the first step.
First, the mp4museum.py script needs to be changed accordingly: “both” is to be replaced by “alsa”.
Find out your sound output number
Now let’s check on the current configuration of the system
This option of aplay (which is an audio player) gives you a list of the devices present. Please note that these numbers will be different, depending on the configuration of your Pi, if a display is connected with HDMI Audio, etc.
Change Audio Output
In the screenshot above i marked the device to which i would like to switch the output to. To change the system default audio device, we need to make changes to a configuration file:
sudo nano /usr/share/alsa/alsa.conf
Change the two lines defaults.ctl.card and defaults.pcm.card to the ID you found out using aplay -l.
Open the mixer with alsamixer, make your changes and exit with the Escape Key.
If you want to make your changes permanent, store your configuration with the following command:
sudo alsactl store
Note: Some Soundcards do not allow for Volume Control with the mixer. The volume can only changed through alsamixer if you have changed the audio output device in the mp4museum.py script.