This is my setup for my media center. Its main purpose is for me to be able to replicate it, in case of need. However, with a few modifications, it can be a great way for you to have a Raspberry Pi with the following features:
- an mpd server to stream local music, with an equalizer and snapcast support to stream.
- an Airplay capable machine (for Apple Music for example).
* An SD card, with the latest 64-bit Raspberry Pi OS installed on it. Use [Raspberry Pi imager](https://www.raspberrypi.com/software/) for that purpose.
* A Raspberry Pi, where the firmware has been updated with the possibility of USB booting.
## First configuration
* Insert the SD card in the Pi, start up, and SSH to it.
* Be sure to be in the wanted distribution target. For instance, I regularly need to be in _testing_, for mpd to be up to date. This can be done my modifying _/etc/apt/sources.list_. I usually type in the explicit name of testing (currently _trixie_) to be sure where I'm at.
Please note that this step can be done after the other configurations are performed, as most of the things will be copied from the SD card to the USB media device.
* Inside, there is a folder called usb-boot. It comes from RonR, a user from the Raspberry Pi forums. You can also [download it here](https://forums.raspberrypi.com/viewtopic.php?t=196778). The version included in this repository is from Feb 11, 2024.
* You can now remove your SD card and boot the system from the USB media device.
## Configuring the audio
* I use a HifiBerry DAC. For that purpose, I need to do the following:
* update `/boot/config.txt`
* remove `dtparam=audio=on`
* add `dtoverlay=hifiberry-dacplusadc` (find what you need on the [documentation](https://www.hifiberry.com/docs/software/configuring-linux-3-18-x/))
* while you're on this file, you can also disable things you probably don't need like bluetooth (`dtoverlay=disable-bt`) or WiFi (`dtoverlay=disable-wifi`).
* Copy the `/etc/asound.conf` file.
* You can use the `equalizer.sh` script to configure the equalizer. A value I like is `74-66-64-66-72-72-66-64-66-74`.
### Troubleshooting audio
If you're having trouble with the Raspberry Pi audio, try one of the following things:
*`sudo raspi-config` => `1 System Options` => `S2 Audio`.
* list your devices with `aplay -l`.
* try `speaker-test -c 2`, it should output sound.
* you can also try `speaker-test -D hw:<card number>,<device number>`.
## Configuring mpd
My music is copied with rsync through my NAS. For that purpose I use a set of scripts, that you would have to modify to suit your needs.
* Fist, we create a folder where we'll mount to NAS: `mkdir /media/mantis-music`.
* Then a folder where to copy the music: `mkdir /home/pi/music`.
* You can extract the cover of audio files and uploading them to your NAS by running `utilities/2-cover-upload.sh`.
* You can remove unwated files (such as `.DS_Store` and `Thumbs.db`) and uploading these changes to your NAS by running `utilities/3-remove-unwanted-files.sh`.
I bought a machine named Vero 4K+, running OSMC, to read my video library on my TV. It works fine on a number of files, but was struggling on some others, when no hardware decoder was available. I [found this thread](https://discourse.osmc.tv/t/ff-h264-dropping-and-skipping-frames/37459) that gave a first hint. I then decided to made a quick list of all the format of my files, to be able to test them.
### Usage
`video-info.sh` generates a CSV file with the format, the format profile, and the codec ID. It can be opened with any spreadsheet software. If it is interrupted, an option to resume the operation is available, so that it is possible to launch it multiple time on huge video libraries.
It generates a file named `videoinfo-date_hour.csv` in the folder where the videos are located.
By default, only the following file extensions are taken into account: `mkv`, `mp4`, and `avi`. You can easily add more by modifying the script. You can know which file extensions you have in your library by typing the following command (more [on this thread](https://stackoverflow.com/questions/1842254/how-can-i-find-all-of-the-distinct-file-extensions-in-a-folder-hierarchy)):
`find . -type f | sed -e 's/.*\.//' | sed -e 's/.*\///' | sort | uniq -c | sort -rn`