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 and play the audio from it. I believe you can set things up to have multiple streams even.

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. Because my NAS doen't have any kind of audio hardware I still need a Music Player that can handle streams (Mplayer, FFmpeg, VLC, etc.—even a web browser works) to actually hear the audio.
  • MPDroid - It's the only Android client in F-Droid that works on my old tablet (Android 4.4).
  • MALP - Android client that's pretty similar to MPDroid, but kinda (barely) still being worked on. In the past I preferred MPDroid, but I've come round to this after trying it again. I'd thought it didn't play audio, but it does.
  • Ymuse - Simple GUI client.

Haven't Tried

Just listing some GUI clients I might try at some point.

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).

NB: Qnapclub is basically dead now, but the MPD package on it's replacement is currently not available due to an error (https://www.myqnap.org/?s=mpd)

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.

Only option I have for output is HTTPD. This has a bit of lag when doing things like skipping songs and starting that is slightly annoying, so if you can use something else I recommend doing that.

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 (m3u is barely a 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. Typically the playlists are not shown in the regular playlist view, but can be loaded from the general file browser. Metadata in m3u playlists doesn't seem to show:

  • MPDroid doesn't seem to see playlists in music_directory, even in the file browser.
  • ncmpcpp shows playlists from playlist_directory and music_directory on the browse page.
  • MALP doesn't show playlists in file browser.
  • ymuse shows playlists in file browser, but can't load songs unless they use absolute paths. Web URLs don't even work.

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.

Cover Art

MPD now supports cover art. It'll grab any image in the same directory as the file called cover.[png|jpg|tiff|bmp].

Streaming

You can use mpd to host an Internet Radio stream using shout/ice cast.

See Also

mpd.txt · Last modified: 2024/11/05 19:58 by rjt