MPD on CPU Deficient Devices

Revision as of 15:12, 26 November 2024 by Root (talk | contribs) (Created page with "...IE, what happens if a small Router device with a single CPU core is asked to decode an MP3 file? Well, if PulseAudio is involved, there's just a bunch of static. A quick way to test is to have MPD play directly to the ALSA Hardware (see /etc/mpd.conf below);<syntaxhighlight lang="text"> music_directory "/MP3" log_file "/tmp/mpd.log" pid_file "/tmp/run/mpd.pid" playlist_directory "/MP3" db_file "/MP3/mpd.db" log_file "/var/log/mpd.log" log_level "verbose" bind...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

...IE, what happens if a small Router device with a single CPU core is asked to decode an MP3 file?

Well, if PulseAudio is involved, there's just a bunch of static.

A quick way to test is to have MPD play directly to the ALSA Hardware (see /etc/mpd.conf below);

music_directory		"/MP3"
log_file		"/tmp/mpd.log"
pid_file		"/tmp/run/mpd.pid"
playlist_directory	"/MP3"
db_file			"/MP3/mpd.db"

log_file "/var/log/mpd.log"
log_level "verbose"

bind_to_address		"0.0.0.0"
port         	       "6600"

user			"mpd"
group			"audio"
password		"password@read,add,control,admin"

audio_output {
    type    "alsa"
    name    "Direct ALSA Output"
    device  "hw:0,0"  # Adjust based on your output device
    ### device is the key component to output directly to an Audio Device without PulseAudio
}

...then mpc -h password@192.168.x.y add WhatEver.mp3, then mpc -h password@192.168.x.y play 1 (where x.y completes the devices IP Address mode)

mpd --version

...doesn't do crap in OpenWRT in terms of displaying which CODEC is being used for MP3 Files. It just always shows MAD as the DECODER.

The only way to test is with the below Directives added into the /etc/mpd.conf (PS, it will result in no playback for MP3 files, even though mpd --version shows the same thing, with or without the below configuration. Cool OpenWRT!)

decoder {
     plugin  "mad"  ### Nope, not for OpenWRT
     enabled  "no"
}

decoder {
     plugin  "mpg123"  ### Nope, not for OpenWRT
     enabled  "no"
}

decoder {
     plugin  "ffmpeg"
     enabled  "no"
}

And according to this: https://mpd.readthedocs.io/en/latest/plugins.html#decoder-plugins MPD only supports mad, mpg123, and ffmpeg, so lame and others are out. Tried the above ones and mad seems to be the least efficient. And some quick tests show that OpenWRT does NOT support mpg123! And worse than that, if ffmpeg is turned off and mad is turned on, that doesn't work either. Unless all other codecs rely on ffmpeg???