<SOLVED> Streaming with MPD and Icecast2
Re: Streaming with MPD and Icecast2
I have set-up a working mpd/mpc on Debian 10 in Virtualbox just by tweaking the original mpd.conf, putting the tracks in /var/mpd/music and chown that directory to mpd:<USER> so it can be done.
I'm also trying to learn FreeBSD in Virtualbox and got it running there too, it was slightly easier as well!
This track is playing in FreeBSD.
Code: Select all
$ mpc
10 000 Maniacs - Hey Jack Kerouac
[playing] #1/14 0:23/3:24 (11%)
volume: n/a repeat: on random: on single: off consume: off
Code: Select all
$ cat /etc/mpd.conf
Code: Select all
$ ls -la /home/radio
Code: Select all
$ cat /home/<USER>/mpd/mpd.log
Code: Select all
encoder "lame"
Re: Streaming with MPD and Icecast2
Hahaha fair enough!Dennis99 wrote:I'm still here, I've been trying to find a cure for covid-19 as it's easier!
I imagine FreeBSD could make a good server. I tried to set it up as a desktop OS on an old netbook I have and it was a nightmare. I gave up.Dennis99 wrote:I'm also trying to learn FreeBSD in Virtualbox and got it running there too, it was slightly easier as well!
You want the whole /etc/mpd.conf file? It's pretty long. /home/<USER>/ is the same as /home/radio/. Yeah, did I forget to change it in one place? radio is my username and hostname for this box I'm working on. I can tell you ls -la /home/radio/ is /Library and /mpd.Dennis99 wrote:What is?Code: Select all
$ cat /etc/mpd.conf
andCode: Select all
$ ls -la /home/radio
I don't often use mp3 but I think the encoder should beCode: Select all
$ cat /home/<USER>/mpd/mpd.log
Code: Select all
encoder "lame"
I'm at work right now and just got here, but I will get you the results of cat /etc/mpd.conf and cat /home/radio/mpd/mpd.log when I get home. Also, I will try putting encoder "lame" in my /etc/mpd.conf.
Re: Streaming with MPD and Icecast2
Code: Select all
$ cat /home/radio/mpd/mpd.log
Mar 29 11:11 : config: option 'encoding' on line 242 was not recognized
Mar 29 11:11 : config: option 'description' on line 245 was not recognized
Mar 29 11:11 : config: option 'host' on line 246 was not recognized
Mar 29 11:11 : update: added /Rick Astley - Never Gonna Give You Up.mp3
Mar 29 11:11 : client: [0] opened from [::1]:45360
Mar 29 11:11 : client: [0] closed
Mar 29 11:11 : client: [1] opened from [::1]:45362
Mar 29 11:11 : client: [1] closed
Mar 29 11:11 : client: [2] opened from [::1]:45364
Mar 29 11:11 : client: [2] closed
Mar 29 11:11 : client: [3] opened from [::1]:45366
Mar 29 11:11 : client: [3] closed
Mar 29 11:14 : client: [4] opened from [::1]:45368
Mar 29 11:14 : client: [4] closed
Mar 29 11:14 : client: [5] opened from [::1]:45370
Mar 29 11:14 : client: [5] closed
Mar 29 11:15 : client: [6] opened from [::1]:45372
Mar 29 11:15 : client: [6] closed
Mar 29 11:15 : client: [7] opened from [::1]:45374
Mar 29 11:15 : client: [7] closed
Mar 29 11:15 : exception: Failed to create /var/lib/mpd/state: Permission denied
Mar 29 11:15 : client: [8] opened from [::1]:45376
Mar 29 11:15 : client: [8] closed
Mar 29 11:15 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Mar 29 11:15 : exception: nested: Failed to bind to '[::]:8000'
Mar 29 11:15 : exception: Failed to bind socket: Address already in use
Mar 29 11:15 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Mar 29 11:15 : exception: nested: Failed to bind to '[::]:8000'
Mar 29 11:15 : exception: Failed to bind socket: Address already in use
Mar 29 11:15 : player: problems opening audio device while playing "Rick Astley - Never Gonna Give You Up.mp3"
Mar 29 11:15 : exception: Failed to create /var/lib/mpd/state: Permission denied
Mar 29 11:15 : exception: Failed to create /var/lib/mpd/state: Permission denied
Mar 29 11:15 : player: played "Rick Astley - Never Gonna Give You Up.mp3"
Mar 29 11:16 : config: option 'encoding' on line 242 was not recognized
Mar 29 11:16 : config: option 'description' on line 245 was not recognized
Mar 29 11:16 : config: option 'host' on line 246 was not recognized
Mar 29 11:17 : client: [0] opened from [::1]:57696
Mar 29 11:17 : client: [0] closed
Mar 29 11:18 : client: [1] opened from [::1]:57698
Mar 29 11:18 : client: [1] closed
Mar 29 11:19 : client: [2] opened from [::1]:57700
Mar 29 11:19 : client: [2] closed
Mar 29 11:42 : client: [3] opened from [::1]:57710
Mar 29 11:42 : client: [3] closed
Mar 29 11:42 : client: [4] opened from [::1]:57712
Mar 29 11:42 : client: [4] closed
Mar 29 11:42 : client: [5] opened from [::1]:57714
Mar 29 11:42 : client: [5] closed
Mar 29 11:42 : client: [6] opened from [::1]:57716
Mar 29 11:42 : client: [6] closed
Mar 29 11:42 : client: [7] opened from [::1]:57718
Mar 29 11:42 : client: [7] closed
Mar 29 11:42 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Mar 29 11:42 : exception: nested: Failed to bind to '[::]:8000'
Mar 29 11:42 : exception: Failed to bind socket: Address already in use
Mar 29 11:42 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Mar 29 11:42 : exception: nested: Failed to bind to '[::]:8000'
Mar 29 11:42 : exception: Failed to bind socket: Address already in use
Mar 29 11:42 : player: problems opening audio device while playing "Rick Astley - Never Gonna Give You Up.mp3"
Mar 29 11:42 : exception: Failed to create /var/lib/mpd/state: Permission denied
Mar 29 11:46 : exception: Failed to create /var/lib/mpd/state: Permission denied
Mar 29 11:46 : player: played "Rick Astley - Never Gonna Give You Up.mp3"
Mar 29 11:47 : config: option 'encoding' on line 242 was not recognized
Mar 29 11:47 : config: option 'description' on line 245 was not recognized
Mar 29 11:47 : config: option 'host' on line 246 was not recognized
Mar 29 11:47 : client: [0] opened from [::1]:47896
Mar 29 11:47 : client: [0] closed
Mar 29 11:48 : client: [1] opened from [::1]:47898
Mar 29 11:48 : client: [1] closed
Mar 29 11:48 : client: [2] opened from [::1]:47900
Mar 29 11:48 : client: [2] closed
Mar 29 11:48 : client: [3] opened from [::1]:47902
Mar 29 11:48 : client: [3] closed
Mar 29 11:48 : client: [4] opened from [::1]:47904
Mar 29 11:48 : client: [4] closed
Mar 29 11:50 : client: [5] opened from [::1]:47906
Mar 29 11:50 : client: [5] closed
Mar 29 11:50 : client: [6] opened from [::1]:47908
Mar 29 11:50 : client: [6] closed
Mar 29 11:50 : client: [7] opened from [::1]:47910
Mar 29 11:50 : exception: Failed to create /var/lib/mpd/state: Permission denied
Mar 29 11:50 : client: [7] closed
Mar 29 11:50 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Mar 29 11:50 : exception: nested: Failed to bind to '[::]:8000'
Mar 29 11:50 : exception: Failed to bind socket: Address already in use
Mar 29 11:50 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Mar 29 11:50 : exception: nested: Failed to bind to '[::]:8000'
Mar 29 11:50 : exception: Failed to bind socket: Address already in use
Mar 29 11:50 : player: problems opening audio device while playing "Rick Astley - Never Gonna Give You Up.mp3"
Mar 29 11:50 : exception: Failed to create /var/lib/mpd/state: Permission denied
Mar 29 11:58 : exception: Failed to create /var/lib/mpd/state: Permission denied
Mar 29 11:58 : player: played "Rick Astley - Never Gonna Give You Up.mp3"
Mar 29 11:58 : config: option 'encoding' on line 242 was not recognized
Mar 29 11:58 : config: option 'description' on line 245 was not recognized
Mar 29 11:58 : config: option 'host' on line 246 was not recognized
Mar 29 11:59 : config: option 'encoding' on line 242 was not recognized
Mar 29 11:59 : config: option 'description' on line 245 was not recognized
Mar 29 11:59 : config: option 'host' on line 246 was not recognized
Mar 29 11:59 : client: [0] opened from [::1]:34792
Mar 29 11:59 : client: [0] closed
Mar 31 18:00 : config: option 'encoding' on line 242 was not recognized
Mar 31 18:00 : config: option 'description' on line 246 was not recognized
Mar 31 18:00 : config: option 'host' on line 247 was not recognized
Mar 31 18:00 : client: [0] opened from [::1]:35830
Mar 31 18:00 : client: [0] closed
Mar 31 18:01 : client: [1] opened from [::1]:35832
Mar 31 18:01 : client: [1] closed
Mar 31 18:01 : client: [2] opened from [::1]:35834
Mar 31 18:01 : client: [2] closed
Mar 31 18:01 : client: [3] opened from [::1]:35836
Mar 31 18:01 : client: [3] closed
Mar 31 18:01 : client: [4] opened from [::1]:35838
Mar 31 18:01 : client: [4] closed
Mar 31 18:01 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Mar 31 18:01 : exception: nested: Failed to bind to '[::]:8000'
Mar 31 18:01 : exception: Failed to bind socket: Address already in use
Mar 31 18:01 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Mar 31 18:01 : exception: nested: Failed to bind to '[::]:8000'
Mar 31 18:01 : exception: Failed to bind socket: Address already in use
Mar 31 18:01 : player: problems opening audio device while playing "Rick Astley - Never Gonna Give You Up.mp3"
ls -la /home/radio/:
Code: Select all
$ ls -la /home/radio/
total 52
drwxrw-rw- 8 radio radio 4096 Mar 31 18:00 .
drwxr-xr-x 3 root root 4096 Mar 15 15:28 ..
-rwxrw-rw- 1 radio radio 1414 Mar 30 08:57 .bash_history
-rwxrw-rw- 1 radio radio 220 Mar 15 15:28 .bash_logout
-rwxrw-rw- 1 radio radio 3526 Mar 15 15:28 .bashrc
drwxr-xr-x 3 radio radio 4096 Mar 28 11:48 .config
drwxrw-rw- 3 radio radio 4096 Mar 20 23:34 .gnupg
drwxrw-rw- 3 radio radio 4096 Mar 22 15:40 Library
drwxrw-rw- 3 radio radio 4096 Mar 15 16:04 .local
drwxr-xr-x 2 radio radio 4096 Mar 31 18:01 mpd
-rw-r--r-- 1 radio radio 5 Mar 31 18:00 pid
-rwxrw-rw- 1 radio radio 807 Mar 15 15:28 .profile
drwxrw-rw- 2 radio radio 4096 Mar 17 22:16 .ssh
The entirety of cat /etc/mpd.conf:
Code: Select all
$ cat /etc/mpd.conf
# An example configuration file for MPD.
# Read the user manual for documentation: http://www.musicpd.org/doc/user/
# or /usr/share/doc/mpd/html/user.html
# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory "/home/radio/Library"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use
# playlist files not created by the server but only if they are in the MPD
# format. This setting defaults to playlist saving being disabled.
#
playlist_directory "/home/radio/Library/playlists"
user "radio"
#
# This setting sets the location of the MPD database. This file is used to
# load the database at server start up and store the database while the
# server is not up. This setting defaults to disabled which will allow
# MPD to accept files over ipc socket (using file:// protocol) or streaming
# files over an accepted protocol.
#
db_file "/home/radio/mpd/tag_cache"
#
# These settings are the locations for the daemon log files for the daemon.
# These logs are great for troubleshooting, depending on your log_level
# settings.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog, or to journal if mpd was started as
# a systemd service.
#
log_file "/home/radio/mpd/mpd.log"
#
# This setting sets the location of the file which stores the process ID
# for use of mpd --kill and some init scripts. This setting is disabled by
# default and the pid file will not be stored.
#
pid_file "/home/radio/mpd/pid"
#
# This setting sets the location of the file which contains information about
# most variables to get MPD back into the same general shape it was in before
# it was brought down. This setting is disabled by default and the server
# state will be reset on server start up.
#
state_file "/home/radio/mpd/state"
#
# The location of the sticker database. This is a database which
# manages dynamic information attached to songs.
#
sticker_file "/home/radio/mpd/sticker.sql"
#
###############################################################################
# General music daemon options ################################################
#
# This setting specifies the user that MPD will run as. MPD should never run as
# root and you may use this setting to make MPD change its user ID after
# initialization. This setting is disabled by default and MPD is run as the
# current user.
#
#
# This setting specifies the group that MPD will run as. If not specified
# primary group of user specified with "user" setting will be used (if set).
# This is useful if MPD needs to be a member of group such as "audio" to
# have permission to use sound card.
#
#group "nogroup"
#
# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other then the default, any.
# This setting can deny access to control of the daemon. Choose any if you want
# to have mpd listen on every address. Not effective if systemd socket
# activation is in use.
#
# For network
bind_to_address "localhost"
#
# And for Unix Socket
#bind_to_address "/run/mpd/socket"
#
# This setting is the TCP port that is desired for the daemon to get assigned
# to.
#
#port "6600"
#
# This setting controls the type of information which is logged. Available
# setting arguments are "default", "secure" or "verbose". The "verbose" setting
# argument is recommended for troubleshooting, though can quickly stretch
# available resources on limited hardware storage.
#
#log_level "default"
#
# Setting "restore_paused" to "yes" puts MPD into pause mode instead
# of starting playback after startup.
#
#restore_paused "no"
#
# This setting enables MPD to create playlists in a format usable by other
# music players.
#
#save_absolute_paths_in_playlists "no"
#
# This setting defines a list of tag types that will be extracted during the
# audio file discovery process. The complete list of possible values can be
# found in the user manual.
#metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc"
#
# This example just enables the "comment" tag without disabling all
# the other supported tags:
#metadata_to_use "+comment"
#
# This setting enables automatic update of MPD's database when files in
# music_directory are changed.
#
#auto_update "yes"
#
# Limit the depth of the directories being watched, 0 means only watch
# the music directory itself. There is no limit by default.
#
#auto_update_depth "3"
#
###############################################################################
# Symbolic link behavior ######################################################
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links outside of the configured music_directory.
#
#follow_outside_symlinks "yes"
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links inside of the configured music_directory.
#
#follow_inside_symlinks "yes"
#
###############################################################################
# Zeroconf / Avahi Service Discovery ##########################################
#
# If this setting is set to "yes", service information will be published with
# Zeroconf / Avahi.
#
#zeroconf_enabled "yes"
#
# The argument to this setting will be the Zeroconf / Avahi unique name for
# this MPD server on the network. %h will be replaced with the hostname.
#
#zeroconf_name "Music Player @ %h"
#
###############################################################################
# Permissions #################################################################
#
# If this setting is set, MPD will require password authorization. The password
# setting can be specified multiple times for different password profiles.
#
#password "password@read,add,control,admin"
#
# This setting specifies the permissions a user has who has not yet logged in.
#
#default_permissions "read,add,control,admin"
#
###############################################################################
# Database #######################################################################
#
#database {
# plugin "proxy"
# host "other.mpd.host"
# port "6600"
#}
# Input #######################################################################
#
input {
plugin "curl"
# proxy "proxy.isp.com:8080"
# proxy_user "user"
# proxy_password "password"
}
# QOBUZ input plugin
input {
enabled "no"
plugin "qobuz"
# app_id "ID"
# app_secret "SECRET"
# username "USERNAME"
# password "PASSWORD"
# format_id "N"
}
# TIDAL input plugin
input {
enabled "no"
plugin "tidal"
# token "TOKEN"
# username "USERNAME"
# password "PASSWORD"
# audioquality "Q"
}
# Decoder #####################################################################
#
decoder {
plugin "hybrid_dsd"
enabled "no"
# gapless "no"
}
#
###############################################################################
# Audio Output ################################################################
#
# MPD supports various audio output types, as well as playing through multiple
# audio outputs at the same time, through multiple audio_output settings
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# An example of an ALSA output:
#
audio_output {
# type "shout"
encoding "mp3"
encoder "lame"
type "httpd"
name "Dead Pirate Radio"
description "Dead Pirate Radio"
host "localhost"
# mount "/mpd.mp3"
port "8000"
# tags "yes"
# quality "5.0"
bitrate "192"
# password "<password>"
# protocol "icecast2"
# device "hw:0,0" # optional
# mixer_type "hardware" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
}
#
# An example of an OSS output:
#
#audio_output {
# type "oss"
# name "My OSS Device"
# device "/dev/dsp" # optional
# mixer_type "hardware" # optional
# mixer_device "/dev/mixer" # optional
# mixer_control "PCM" # optional
#}
#
# An example of a shout output (for streaming to Icecast):
#
#audio_output {
# type "shout"
# encoder "vorbis" # optional
# name "My Shout Stream"
# host "localhost"
# port "8000"
# mount "/mpd.ogg"
# password "hackme"
# quality "5.0"
# bitrate "128"
# format "44100:16:1"
# protocol "icecast2" # optional
# user "source" # optional
# description "My Stream Description" # optional
# url "http://example.com" # optional
# genre "jazz" # optional
# public "no" # optional
# timeout "2" # optional
# mixer_type "software" # optional
#}
#
# An example of a recorder output:
#
#audio_output {
# type "recorder"
# name "My recorder"
# encoder "vorbis" # optional, vorbis or lame
# path "/var/lib/mpd/recorder/mpd.ogg"
## quality "5.0" # do not define if bitrate is defined
# bitrate "128" # do not define if quality is defined
# format "44100:16:1"
#}
#
# An example of a httpd output (built-in HTTP streaming server):
#
#audio_output {
# type "httpd"
# name "My HTTP Stream"
# encoder "vorbis" # optional, vorbis or lame
# port "8000"
# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6
# quality "5.0" # do not define if bitrate is defined
# bitrate "128" # do not define if quality is defined
# format "44100:16:1"
# max_clients "0" # optional 0=no limit
#}
#
# An example of a pulseaudio output (streaming to a remote pulseaudio server)
# Please see README.Debian if you want mpd to play through the pulseaudio
# daemon started as part of your graphical desktop session!
#
#audio_output {
# type "pulse"
# name "My Pulse Output"
# server "remote_server" # optional
# sink "remote_server_sink" # optional
#}
#
# An example of a winmm output (Windows multimedia API).
#
#audio_output {
# type "winmm"
# name "My WinMM output"
# device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
# or
# device "0" # optional
# mixer_type "hardware" # optional
#}
#
# An example of an openal output.
#
#audio_output {
# type "openal"
# name "My OpenAL output"
# device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
#}
#
## Example "pipe" output:
#
#audio_output {
# type "pipe"
# name "my pipe"
# command "aplay -f cd 2>/dev/null"
## Or if you're want to use AudioCompress
# command "AudioCompress -m | aplay -f cd 2>/dev/null"
## Or to send raw PCM stream through PCM:
# command "nc example.org 8765"
# format "44100:16:2"
#}
#
## An example of a null output (for no audio output):
#
#audio_output {
# type "null"
# name "My Null Output"
# mixer_type "none" # optional
#}
#
###############################################################################
# Normalization automatic volume adjustments ##################################
#
# This setting specifies the type of ReplayGain to use. This setting can have
# the argument "off", "album", "track" or "auto". "auto" is a special mode that
# chooses between "track" and "album" depending on the current state of
# random playback. If random playback is enabled then "track" mode is used.
# See <http://www.replaygain.org> for more details about ReplayGain.
# This setting is off by default.
#
#replaygain "album"
#
# This setting sets the pre-amp used for files that have ReplayGain tags. By
# default this setting is disabled.
#
#replaygain_preamp "0"
#
# This setting sets the pre-amp used for files that do NOT have ReplayGain tags.
# By default this setting is disabled.
#
#replaygain_missing_preamp "0"
#
# This setting enables or disables ReplayGain limiting.
# MPD calculates actual amplification based on the ReplayGain tags
# and replaygain_preamp / replaygain_missing_preamp setting.
# If replaygain_limit is enabled MPD will never amplify audio signal
# above its original level. If replaygain_limit is disabled such amplification
# might occur. By default this setting is enabled.
#
#replaygain_limit "yes"
#
# This setting enables on-the-fly normalization volume adjustment. This will
# result in the volume of all playing audio to be adjusted so the output has
# equal "loudness". This setting is disabled by default.
#
#volume_normalization "no"
#
###############################################################################
# Character Encoding ##########################################################
#
# If file or directory names do not display correctly for your locale then you
# may need to modify this setting.
#
filesystem_charset "UTF-8"
#
###############################################################################
Code: Select all
$ ls -la /home/radio/Library
total 4988
drwxrw-rw- 3 radio radio 4096 Mar 22 15:40 .
drwxrw-rw- 8 radio radio 4096 Mar 31 18:00 ..
drwxr-xr-x 2 radio radio 4096 Mar 21 22:53 playlists
-rwxr--r-- 1 radio radio 5092133 Mar 20 23:30 'Rick Astley - Never Gonna Give You Up.mp3'
Code: Select all
$ ls -la /home/radio/mpd
total 36
drwxr-xr-x 2 radio radio 4096 Mar 31 18:01 .
drwxrw-rw- 8 radio radio 4096 Mar 31 18:00 ..
-rw-r--r-- 1 radio radio 7023 Mar 31 18:01 mpd.log
-rw-r--r-- 1 radio radio 0 Mar 29 10:29 pid
-rw-r--r-- 1 radio radio 263 Mar 31 18:01 state
-rw-r--r-- 1 radio radio 12288 Mar 29 11:11 sticker.sql
-rw-r--r-- 1 radio radio 303 Mar 29 11:11 tag_cache
Code: Select all
radio@radio:~$ mpc ls
Rick Astley - Never Gonna Give You Up.mp3
radio@radio:~$ mpc ls | mpc add
radio@radio:~$ mpc -w update
Rick Astley - Never Gonna Give You Up.mp3
[paused] #1/2 0:00/3:32 (0%)
volume: n/a repeat: off random: off single: off consume: off
ERROR: Failed to enable output "Dead Pirate Radio" (httpd); Failed to bind to '[::]:8000'; Failed to bind socket: Address already in use
radio@radio:~$ mpc play
Rick Astley - Never Gonna Give You Up.mp3
[paused] #1/2 0:00/3:32 (0%)
volume: n/a repeat: off random: off single: off consume: off
ERROR: Failed to enable output "Dead Pirate Radio" (httpd); Failed to bind to '[::]:8000'; Failed to bind socket: Address already in use
Re: Streaming with MPD and Icecast2
I think we are trying to run as 2 different things which need different setups, I run as a system daemon, you are trying to run a user daemon and that needs the configs in a totally different place.
Thought I would RTFM! From the manual If you run MPD as a user daemon (and not as a system daemon) blah blah blah
https://www.musicpd.org/doc/html/user.html
So as a system daemon, clean up mpd.conf by cleaning up the httpd bit with only the following:
Code: Select all
audio_output {
type "httpd"
name "Dead Pirate Radio"
encoder "lame"
port "8000"
bitrate "192"
tags "yes"
}
Code: Select all
# systemctl stop mpd.service
Code: Select all
# systemctl start mpd.service
Code: Select all
mpc
Code: Select all
$ mpc
volume: n/a repeat: on random: on single: off consume: off
As to playlists, I put some songs in the song queue as a test, it's mpc save <filename> to save the playlist, it's saved as a .m3u
eg:
$ cat /mpd/playlists/test.m3u
Kate Bush- Them Heavy People.ogg
Love - Alone Again Or.ogg
etc
Then mpc clear to empty the queue and mpc load <filenam> to load the playlist.
Re: Streaming with MPD and Icecast2
Code: Select all
audio_output {
# type "shout"
# encoding "mp3"
encoder "lame"
type "httpd"
name "Dead Pirate Radio"
# description "Dead Pirate Radio"
# host "localhost"
# mount "/mpd.mp3"
port "8000"
tags "yes"
# quality "5.0"
bitrate "192"
# password "<password>"
# protocol "icecast2"
# device "hw:0,0" # optional
# mixer_type "hardware" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
}
Code: Select all
radio@radio:~$ su -
Password:
root@radio:~# nano /etc/mpd.conf
root@radio:~# systemctl stop mpd.service
root@radio:~# systemctl start mpd.service
root@radio:~# exit
logout
radio@radio:~$ mpc
Rick Astley - Never Gonna Give You Up.mp3
[paused] #1/3 0:00/3:32 (0%)
volume: n/a repeat: off random: off single: off consume: off
radio@radio:~$ mpc -w update
Rick Astley - Never Gonna Give You Up.mp3
[paused] #1/3 0:00/3:32 (0%)
volume: n/a repeat: off random: off single: off consume: off
radio@radio:~$ mpc play
Rick Astley - Never Gonna Give You Up.mp3
[paused] #1/3 0:00/3:32 (0%)
volume: n/a repeat: off random: off single: off consume: off
ERROR: Failed to enable output "Dead Pirate Radio" (httpd); Failed to bind to '[::]:8000'; Failed to bind socket: Address already in use
Re: Streaming with MPD and Icecast2
I'll just worry about getting one stream working first.
Re: Streaming with MPD and Icecast2
You can have a different mpd.conf with a different name with differently named music directory if you want and playlist(s) and differently named tag_cache, log, pid. state and sticker.sql files.
In the new conf, have the same user but a different port (eg 6610) and on the audio output httpd a different port (eg 8002).
Then start the new mpd with
Code: Select all
$ sudo mpd /etc/<newconf>.conf
Code: Select all
$ mpc -h 127.0.0.1 -p 6610
Code: Select all
$ mpc -h 127.0.0.1 -p 6610 -w update
Code: Select all
$ mpc -h 127.0.0.1 -p 6610 ls | mpc -h 127.0.0.1 -p 6610 add
Code: Select all
mpc -h 127.0.0.1 -p 6610 play
Just as an aside the original can still be seen on
Code: Select all
$ mpc
Code: Select all
$ mpc -h 127.0.0.1 -p 6600[
The world is your lobster.
Re: Streaming with MPD and Icecast2
I'm still working on getting this first stream working though. It says it failed to enable httpd output and the address is already in use. I think I'm going to try shout and see if I can't get that working. I really don't understand why there aren't more comprehensive tutorials for this.
Re: Streaming with MPD and Icecast2
Dennis99 wrote: You can have a different mpd.conf with a different name
Then start the new mpd withCode: Select all
$ sudo mpd /etc/<newconf>.conf
Re: Streaming with MPD and Icecast2
Re: Streaming with MPD and Icecast2
Code: Select all
● mpd.service - Music Player Daemon
Loaded: loaded (/lib/systemd/system/mpd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2020-04-05 12:16:27 PDT; 11s ago
Docs: man:mpd(1)
man:mpd.conf(5)
file:///usr/share/doc/mpd/user-manual.html
Process: 10161 ExecStart=/usr/bin/mpd --no-daemon $MPDCONF (code=exited, status=1/FAILURE)
Main PID: 10161 (code=exited, status=1/FAILURE)
Apr 05 12:16:26 radio systemd[1]: Starting Music Player Daemon...
Apr 05 12:16:27 radio mpd[10161]: Apr 05 12:16 : exception: Failed to bind to '[::1]:6600'
Apr 05 12:16:27 radio mpd[10161]: Apr 05 12:16 : exception: nested: Failed to bind socket: Address already in use
Apr 05 12:16:27 radio systemd[1]: mpd.service: Main process exited, code=exited, status=1/FAILURE
Apr 05 12:16:27 radio systemd[1]: mpd.service: Failed with result 'exit-code'.
Apr 05 12:16:27 radio systemd[1]: Failed to start Music Player Daemon.
EDIT #1: So after changing type to "shout" mpd had a whole bunch of other complaints. Every time it complained about something I edited /etc/mpd.conf until I ended up with:
Code: Select all
audio_output {
type "shout"
encoding "mp3"
encoder "lame"
# type "httpd"
name "Dead Pirate Radio"
# description "Dead Pirate Radio"
host "localhost"
mount "/mpd.mp3"
port "6700"
tags "yes"
# quality "5.0"
bitrate "192"
password "<password>"
# protocol "icecast2"
# device "hw:0,0" # optional
# mixer_type "hardware" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
}
Code: Select all
root@radio:~# systemctl status mpd.service
● mpd.service - Music Player Daemon
Loaded: loaded (/lib/systemd/system/mpd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2020-04-05 12:42:00 PDT; 14min ago
Docs: man:mpd(1)
man:mpd.conf(5)
file:///usr/share/doc/mpd/user-manual.html
Process: 450 ExecStart=/usr/bin/mpd --no-daemon $MPDCONF (code=exited, status=1/FAILURE)
Main PID: 450 (code=exited, status=1/FAILURE)
Apr 05 12:41:55 radio systemd[1]: Starting Music Player Daemon...
Apr 05 12:42:00 radio mpd[450]: Apr 05 12:42 : exception: Failed to configure output in line 240
Apr 05 12:42:00 radio mpd[450]: Apr 05 12:42 : exception: nested: Need full audio format specification
Apr 05 12:42:00 radio systemd[1]: mpd.service: Main process exited, code=exited, status=1/FAILURE
Apr 05 12:42:00 radio systemd[1]: mpd.service: Failed with result 'exit-code'.
Apr 05 12:42:00 radio systemd[1]: Failed to start Music Player Daemon.
Code: Select all
root@radio:~# systemctl stop mpd
root@radio:~# systemctl start mpd
root@radio:~# mpc
Rick Astley - Never Gonna Give You Up.mp3
[paused] #1/3 0:00/3:32 (0%)
volume: n/a repeat: off random: off single: off consume: off
root@radio:~# systemctl status pd
Unit pd.service could not be found.
root@radio:~# systemctl status mpd
● mpd.service - Music Player Daemon
Loaded: loaded (/lib/systemd/system/mpd.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2020-04-05 13:17:58 PDT; 17s ago
Docs: man:mpd(1)
man:mpd.conf(5)
file:///usr/share/doc/mpd/user-manual.html
Main PID: 658 (mpd)
Tasks: 6 (limit: 4915)
Memory: 13.0M
CGroup: /system.slice/mpd.service
└─658 /usr/bin/mpd --no-daemon
Apr 05 13:17:57 radio systemd[1]: Starting Music Player Daemon...
Apr 05 13:17:58 radio systemd[1]: Started Music Player Daemon.
EDIT#3: Alright. After rebooting:
Code: Select all
radio@radio:~$ mpc
Rick Astley - Never Gonna Give You Up.mp3
[paused] #1/3 0:00/3:32 (0%)
volume: n/a repeat: off random: off single: off consume: off
radio@radio:~$ mpc play
Rick Astley - Never Gonna Give You Up.mp3
[paused] #1/3 0:00/3:32 (0%)
volume: n/a repeat: off random: off single: off consume: off
ERROR: Failed to enable output "Dead Pirate Radio" (httpd); Failed to bind to '[::]:8000'; Failed to bind socket: Address already in use
radio@radio:~$ systemctl status mpd
● mpd.service - Music Player Daemon
Loaded: loaded (/lib/systemd/system/mpd.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2020-04-05 13:26:43 PDT; 29s ago
Docs: man:mpd(1)
man:mpd.conf(5)
file:///usr/share/doc/mpd/user-manual.html
Main PID: 449 (mpd)
Tasks: 6 (limit: 4915)
Memory: 41.2M
CGroup: /system.slice/mpd.service
└─449 /usr/bin/mpd --no-daemon
Here are the results of ss -natu, if that helps at all:
Code: Select all
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 0.0.0.0:68 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:68 0.0.0.0:*
udp UNCONN 0 0 169.254.<sub.net?>:137 0.0.0.0:*
udp UNCONN 0 0 169.254.<?.???>:137 0.0.0.0:*
udp UNCONN 0 0 <otherip>:137 0.0.0.0:*
udp UNCONN 0 0 <myLANip>:137 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:137 0.0.0.0:*
udp UNCONN 0 0 169.254.<sub.net?>:138 0.0.0.0:*
udp UNCONN 0 0 169.254.<?.???>:138 0.0.0.0:*
udp UNCONN 0 0 <otherip>:138 0.0.0.0:*
udp UNCONN 0 0 <myLANip>:138 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:138 0.0.0.0:*
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
tcp LISTEN 0 50 0.0.0.0:445 0.0.0.0:*
tcp LISTEN 0 5 0.0.0.0:8000 0.0.0.0:*
tcp LISTEN 0 5 127.0.0.1:6600 0.0.0.0:*
tcp LISTEN 0 50 0.0.0.0:139 0.0.0.0:*
tcp ESTAB 0 0 <myLANip>:22 <myLANip>:40358
tcp LISTEN 0 128 [::]:22 [::]:*
tcp LISTEN 0 50 [::]:445 [::]:*
tcp LISTEN 0 5 [::1]:6600 [::]:*
tcp LISTEN 0 50 [::]:139 [::]:*
Code: Select all
Apr 05 12:07 : exception: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
Apr 05 12:07 : exception: OutputThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
Apr 05 12:07 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Apr 05 12:07 : exception: nested: Failed to bind to '[::]:8000'
Apr 05 12:07 : exception: Failed to bind socket: Address already in use
Apr 05 12:29 : player: played "Rick Astley - Never Gonna Give You Up.mp3"
Apr 05 13:17 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Apr 05 13:17 : exception: nested: Failed to bind to '[::]:8000'
Apr 05 13:17 : exception: Failed to bind socket: Address already in use
Apr 05 13:18 : client: [0] opened from [::1]:46178
Apr 05 13:18 : client: [0] closed
Apr 05 13:25 : player: played "Rick Astley - Never Gonna Give You Up.mp3"
Apr 05 13:26 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Apr 05 13:26 : exception: nested: Failed to bind to '[::]:8000'
Apr 05 13:26 : exception: Failed to bind socket: Address already in use
Apr 05 13:26 : client: [0] opened from [::1]:39212
Apr 05 13:26 : client: [0] closed
Apr 05 13:26 : client: [1] opened from [::1]:39214
Apr 05 13:26 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Apr 05 13:26 : exception: nested: Failed to bind to '[::]:8000'
Apr 05 13:26 : exception: Failed to bind socket: Address already in use
Apr 05 13:26 : exception: Failed to enable output "Dead Pirate Radio" (httpd)
Apr 05 13:26 : exception: nested: Failed to bind to '[::]:8000'
Apr 05 13:26 : exception: Failed to bind socket: Address already in use
Apr 05 13:26 : client: [1] closed
Re: Streaming with MPD and Icecast2
Re: Streaming with MPD and Icecast2
Code: Select all
audio_output {
# type "shout"
# type "alsa"
# encoding "mp3"
# encoder "lame"
type "httpd"
name "Dead Pirate Radio"
# description "Dead Pirate Radio"
bind_to_address "<MyLANIP>"
# host "localhost"
# mount "/mpd.mp3"
port "8001"
tags "yes"
# quality "5.0"
bitrate "192"
# password "<password>"
# protocol "icecast2"
# device "hw:0,0" # optional
# mixer_type "hardware" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
}
Code: Select all
root@radio:~# systemctl restart mpd
root@radio:~# mpc
Rick Astley - Never Gonna Give You Up.mp3
[paused] #1/3 0:00/3:32 (0%)
volume: n/a repeat: off random: off single: off consume: off
root@radio:~# mpc play
Rick Astley - Never Gonna Give You Up.mp3
[playing] #1/3 0:00/3:32 (0%)
volume: n/a repeat: off random: off single: off consume: off
Code: Select all
● mpd.service - Music Player Daemon
Loaded: loaded (/lib/systemd/system/mpd.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-04-09 19:30:48 PDT; 14min ago
Docs: man:mpd(1)
man:mpd.conf(5)
file:///usr/share/doc/mpd/user-manual.html
Main PID: 11144 (mpd)
Tasks: 6 (limit: 4915)
Memory: 13.5M
CGroup: /system.slice/mpd.service
└─11144 /usr/bin/mpd --no-daemon
Apr 09 19:30:47 radio systemd[1]: Starting Music Player Daemon...
Apr 09 19:30:48 radio systemd[1]: Started Music Player Daemon.
Code: Select all
Apr 09 19:28 : client: [1] closed
Apr 09 19:30 : player: played "Rick Astley - Never Gonna Give You Up.mp3"
Apr 09 19:30 : client: [0] opened from [::1]:41178
Apr 09 19:30 : client: [0] closed
Apr 09 19:30 : client: [1] opened from [::1]:41180
Apr 09 19:30 : client: [1] closed
Apr 09 19:34 : player: played "Rick Astley - Never Gonna Give You Up.mp3"
Apr 09 19:37 : player: played "Rick Astley - Never Gonna Give You Up.mp3"
Apr 09 19:41 : player: played "Rick Astley - Never Gonna Give You Up.mp3"
Apr 09 19:47 : client: [2] opened from [::1]:41190
Apr 09 19:47 : client: [2] closed
Re: Streaming with MPD and Icecast2
Ices (ogg only): http://icecast.org/ices/
ezstream: http://icecast.org/ezstream/
butt: https://danielnoethen.de/butt/
Liquidsoap (proably the most complicated but fully featured): https://www.liquidsoap.info/
New talk on Liquidsoap
https://www.youtube.com/watch?v=GmMUuKyy6hY
Re: Streaming with MPD and Icecast2
Re: Streaming with MPD and Icecast2
liquidsoap 'output.icecast(%vorbis,host = "HOST", port = PORT,password = "PASSWORD", mount = "mount.ogg", mksafe(playlist("playlist.txt")))'
where playlist.txt is a list of tracks one per line with the full path /media/usb/The Aurora Principle - Before the Storm.ogg
or change to mp3 by changing 2 things:
liquidsoap 'output.icecast(%mp3,host = "HOST", port = PORT,password = "PASSWORD", mount = "mount.mp3", mksafe(playlist("playlist.txt")))'
You can also normalize and do smart crossfades still on 1 line if you want:
liquidsoap 'output.icecast(%mp3,host = "HOST", port = PORT,password = "PASSWORD", mount = "mount.mp3", mksafe(smart_crossfade(normalize(playlist("playlist.txt")))))'
Re: Streaming with MPD and Icecast2
My stream is all working now. Man, this has been frustrating. I have one mpd stream set up without icecast and soon I plan to get to work setting up the other mpd streams.
I will keep this thread bookmarked though, in case I decide I want to try out Liquidsoap. It does seem pretty interesting. I'm not much interested in having all the fancy features right now but one day I may change my mind.
Thanks for the help, mate. You're a hero.
Re: <SOLVED> Streaming with MPD and Icecast2
I copied my /etc/mpd.conf file and changed the path to the files that needed their own paths, changed the port for the user (now 6601) and output (8002) and the music source directory path as well as the music output port and I'm getting an error:
Code: Select all
root@radio:~# mpd /etc/mpd2.conf
Apr 11 18:12 : exception: Failed to bind to '[::]:6601'
Apr 11 18:12 : exception: nested: Failed to bind socket: Address already in use
EDIT: After changing the user port of the second mpd to 6700, I get far fewer errors and the errors I do get I still get for the instance of mpd that does work, so clearly that error means nothing. However, the second instance of mpd still will not start on boot. I don't know how to make it start on boot.
Re: <SOLVED> Streaming with MPD and Icecast2
The second instance needs you to fiddle about with systemd and I only have a little knowledge of it.
Have a read of https://fedoramagazine.org/systemd-template-unit-files/, I think it's what you need.