<SOLVED> Streaming with MPD and Icecast2

Kernels & Hardware, configuring network, installing services

Re: Streaming with MPD and Icecast2

Postby Huecuva » 2020-04-05 18:15

Oh, I missed that part of your post. Heh. So then does that make all the different instances of mpd start on boot with their correct .conf files?
Huecuva
 
Posts: 116
Joined: 2017-06-09 04:00

Re: Streaming with MPD and Icecast2

Postby Huecuva » 2020-04-05 18:55

So I changed the type to "shout" and changed the port to "6600". It didn't complain about being unable to start the type this time but it's still complaining about the port and socket. Here is systemctl status mpd.service:
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.
I don't know what else could be using localhost and I'm not sure how to figure that out. Also, after rebooting it has a whole bunch more complaints. I'll post more about those when I've moved to my other rig to better be able to work on this.

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
}
Now it gives me this error. I thought uncommenting encoding "mp3" would fix that but it made no difference at all.
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.

EDIT#2: Well, that's odd. After changing my /etc/mpd.conf file back to what I had with httpd:
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.
Now let's see what happens after I reboot. TBC.

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
And going to <myIP:8000> still just times out. I don't know what the hell is going on here.

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                           [::]:*   

And here is everything from mpd.log dated today:
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
Huecuva
 
Posts: 116
Joined: 2017-06-09 04:00

Re: Streaming with MPD and Icecast2

Postby Huecuva » 2020-04-07 00:58

It seems like I may end up having to use Alsa instead of httpd or shout.
Huecuva
 
Posts: 116
Joined: 2017-06-09 04:00

Re: Streaming with MPD and Icecast2

Postby Huecuva » 2020-04-10 01:50

So after adding a bind_to_address to my audio_output section and changing the port thus:
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
}

and then editing the port forwarding in my router and restarting mpd:
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

Here is systemctl status mpd:
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.


Here is everything from mpd.log dated today after my failed Alsa attempt:
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


However, going to <MyPublicIP>:8001 still just times out. I don't know if this is some kind of networking issue now or if my streaming just still isn't working.
Huecuva
 
Posts: 116
Joined: 2017-06-09 04:00

Re: Streaming with MPD and Icecast2

Postby Dennis99 » 2020-04-10 14:22

Just for interest, other streamers are available especially into Icecast and I've tried them all:
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
Dennis99
 
Posts: 19
Joined: 2012-07-24 15:02

Re: Streaming with MPD and Icecast2

Postby Huecuva » 2020-04-10 17:52

I don't need too many fancy features, so I won't be using Liquidsoap if it's that complicated. Mpd seems simple enough but it seems to be refusing to work so I want to stick to simple. My music is 99.9% mp3 so that rules out ices of that's ogg only. Is ezstream easier to use than mpd? I might give that one a try. At this point I'm really starting to lose patience with mpd.
Huecuva
 
Posts: 116
Joined: 2017-06-09 04:00

Re: Streaming with MPD and Icecast2

Postby Dennis99 » 2020-04-11 13:37

Once you get your head round Liquidsoap, you can get an output for an Icecast server which is what you want with one line!
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

Image

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")))'

Image
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")))))'
Dennis99
 
Posts: 19
Joined: 2012-07-24 15:02

Re: Streaming with MPD and Icecast2

Postby Huecuva » 2020-04-11 19:34

Well, it turns out my stream has been working. I was able to connect to it if I went to my mpd server's LAN IP. It wasn't working on my public IP because the DMZ hadn't been configured correctly. Or rather, it was configured correctly but the modem/gateway was never rebooted.

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.
Huecuva
 
Posts: 116
Joined: 2017-06-09 04:00

Re: <SOLVED> Streaming with MPD and Icecast2

Postby Huecuva » 2020-04-12 00:30

The main issue of this thread is taken care of, so I'm not going to set it back to unsolved, but running more than one instance of mpd is proving more troublesome than you lead me to believe. If this fails to get any attention I'll make a new thread. I've already posted about this on the mpd forum but the one guy who has bothered to respond there seems a wee bit condescending so far so we'll see how well that goes.

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

The second mpd instance will not start automatically. When I reboot the mpd server, I can log into it and type in mpc and get the status for 6600 which is the first instance and it works but if I type in mpc -h 127.0.0.1 -p 6601 it says connection refused. However, despite the error above, it will work if run manually.

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.
Huecuva
 
Posts: 116
Joined: 2017-06-09 04:00

Re: <SOLVED> Streaming with MPD and Icecast2

Postby Dennis99 » 2020-04-12 11:22

I bet the condescending blokes name is Max, I think he is the main developer and unless you have the very latest version he's not interested.
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.
Dennis99
 
Posts: 19
Joined: 2012-07-24 15:02

Re: <SOLVED> Streaming with MPD and Icecast2

Postby Huecuva » 2020-04-12 19:21

It is indeed Max. Another guy there has responded (before my reply to Max has even been approved) and stated that Max is skeptical of mpd's http streaming capabilities. If he's the main developer, why doesn't he do something about it then? As for what version of mpd I have, I have whatever version is available in the debian repositories, as I just used apt to install it.

Anyway, thanks for the link. I'll have a look through that. I changed some stuff since that post and I figured out I also had to change the bind_to_address for the user. I no longer get that error now. I've also made a third mpd.conf file and while it seems to start manually just fine (also doesn't start on boot but I assume that's for the same reason the second one doesn't and the answer could potentially be found in that link you posted), it throws a completely nonsensical error when I try to connect to it with mpc. mpc -h 0.0.0.0 -p 6700 works just fine on the second instance but mpc -h 0.0.1.0 (or whatever IP I give it) -p 6800 when attempting to connect to the third mpd yields an error: mpd error: invalid argument. It doesn't make any sense.
Huecuva
 
Posts: 116
Joined: 2017-06-09 04:00

Previous

Return to System configuration

Who is online

Users browsing this forum: No registered users and 12 guests

fashionable