User Tools

Site Tools


mpd

MPD

MPD (Music Player Daemon) is a light-weight server for streaming music. Because it's a server you'll also need a client to tell the server what to do, but this setup means you can run the server on one computer, and use a number of other devices to control it.

Notes on Clients

  • ncmpcpp - Curses-based client that seems more full-featured than any of the available GUI ones. Good tag management, which includes being Picard-friendly. I think you still need a Music Player that can handle streams (MPlayer, FFmpeg, VLC, etc.) to actually hear the audio though; unless I'm not understanding something? I usually just point my web browser to the stream URL.
  • MPDroid - It's the only Android client in F-Droid that works on my old tablet (Android 4.4).

Guide

QNAP

Notes on using MPD on a QNAP TS-231P. Setup to work on my local network only.

I used this package from a third-party repository (see: Install our repository, if needed).

The files you need are in /opt/MPD/, to start you'll want to get into the config. file at /opt/MPD/etc/mpd.conf

(It's also worth mentioning that the error log file is at /opt/MPD/var/log/mpd/mpd.log)

A lot of the defaults of fine, but:

  • Check your music_directory and playlist_directory
  • Check your user
  • I can't remember what was set initially, but you can comment out bind_to_address, as the default works.
  • Review log_level, gapless_mp3_playback, restore_paused, save_absolute_paths_in_playlists, auto_update.
  • Check the password stuff.
  • Curl input plugin's just for Internet stuff so I disabled it.
  • audio_output depends on your usage. My NAS has no soundcard, so I disabled ALSA and enabled HTTPD. If you want to use it to host an Internet accessible stream look at Shout. You can have multiple, and select which are active with your client.
    • Give your stream a fun name :)
    • Check the quality settings.
    • Default format was only mono! Change it to “44100:16:2”
    • And the rest of the file is up to you again.
    • If you don't want your output to be resampled you can add and set to “no” auto_resample, auto_channels, and auto_format

When the config's ready you can start or restart MPD through the NAS's web interface, or through running ./mpd –kill from /opt/MPD/bin (it will restart itself).

You don't need to forward ports unless you want to access MPD from outside the local network.

My Config

Here's the contents of mine, for reference:

music_directory         "/share/Multimedia/Music"
playlist_directory      "/share/Multimedia/Music/playlists/mpd"
db_file                 "/opt/MPD/var/lib/mpd/tag_cache"
log_file                "/opt/MPD/var/log/mpd/mpd.log"
pid_file                "/opt/MPD/var/run/mpd/pid"
state_file              "/opt/MPD/var/lib/mpd/state"
sticker_file            "/opt/MPD/var/lib/mpd/sticker.sql"
 
user                    "[...]"
password                "[...]"
#default_permissions    "[...]"

#log_level                              "default"
gapless_mp3_playback                    "no"
#restore_paused                         "no"
save_absolute_paths_in_playlists        "no"
auto_update                             "yes"

audio_output {
        type            "httpd"
        name            "MPD QNAP HTTPD"
        port            "8000"
#       quality         "5.0"
        bitrate         "320"
        format          "44100:16:2"
        max_clients     "0"
        always_on       "yes"
        tags            "yes"
}

#replaygain                     "album"
#replaygain_preamp              "0"
#replaygain_missing_preamp      "0"
#replaygain_limit               "yes"
#volume_normalization           "no"

filesystem_charset              "UTF-8"

Playlists

Got stuck on this for a bit because it's weird.

The playlist_directory you configure is meant for playlists made with MPD. Deceptively, it uses .m3u files, but they're not standard: They're a plain list of file paths relative to configured music_directory, they work just fine with Unicode, they don't use the #EXTM3U header, and if you create them outside of MPD and put them here they won't read the first line.

You can, however, load many kinds of playlists from other directories, but I've had mixed results with this: MPDroid doesn't seem to see playlists in music_directory, so I've only had luck using absolute paths; ncmpcpp shows playlists from playlist_directory and music_directory on the browse page, and the ones in music_directory work fine with relative paths.

If you do want to manually make playlists by hand, or by exporting from your Music Player, give them an .m3u extension, leave the first line blank, make the paths relative to the configured music_directory, and don't add anything else.

So they should look something like this:

Bowie, David/[1974] Diamond Dogs (30th Anniversary Edition)/1,06 Rebel Rebel.mp3
Bowie, David/[1973] Aladdin Sane (30th Anniversary Edition)/2,11 John I'm Only Dancing (Sax Version).mp3
Bowie, David/[1973] Pin Ups/08 Sorrow.mp3
Bowie, David/[1975] Young Americans/08 Fame.mp3
Bowie, David/[1972] The Rise And Fall Of Ziggy Stardust And The Spiders From Mars/10 Suffragette City.mp3
Bowie, David/[1971] Hunky Dory/02 Oh! You Pretty Things.mp3
Bowie, David/[1971] Hunky Dory/12 Bombers (previously unreleased) [bonus].mp3
Bowie, David/[1983] Let's Dance/01 Modern Love.mp3
Bowie, David/[1975] Young Americans/01 Young Americans.mp3

If you load this in MPD, then resave it, it'll sort out that first line silliness.

See Also

mpd.txt · Last modified: 2021/09/03 00:21 by rjt