You are not logged in.

#1 2013-06-03 02:57:53

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Using ncmpcpp to listen to a MPD stream

I have set up mpd so as to stream music played on my server as per the wiki:

audio_output {
	type          "httpd"
	name          "My HTTP Stream"
	encoder       "vorbis"             # optional, vorbis or lame
	port          "8000"
#	quality       "5.0"                # do not define if bitrate is defined
	bitrate       "128"                # do not define if quality is defined
	format        "44100:16:1"
}

I can then listen to the server's stream on my laptop with:

mpc add http://192.168.1.2:8000

However, trying to set up ncmpcpp to listen by default to the server, using this config always results in a failed connection with a timeout:

mpd_host = "192.168.1.2"
mpd_port = "8000"

Ideally, I would like to be able to just edit .ncmpcpp/config and point it at either localhost or my server. I have tried using 8000 and 6600 in both places in ~/.mpd/mpd.conf and either get a blocked connection or no sound at all. I also tried setting MPD_HOST in my environment, but the effect was the same.

Am I missing something obvious?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#2 2013-06-03 10:11:45

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Using ncmpcpp to listen to a MPD stream

`mpc add` connects to localhost (or whatever is in MPD_HOST) and adds a file or stream to the playlist. Configuring ncmpcpp like that would translate to passing

--host 192.168.1.2 --port 8000

to mpc. You would use this for remote control of an mpd server.

Offline

#3 2013-06-03 20:59:17

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Using ncmpcpp to listen to a MPD stream

Thanks Raynman, that was my assumption.

However, using mpc add does work. Launching ncmpcpp with those parameters does not:

┌─[Shiv ~ ]
└─╼ ncmpcpp -h http://192.168.1.2 -p 8000                                                                                                                                    
Couldn't connect to MPD (host = http://192.168.1.2, port = 8000): Failed to resolve host name

Without the http:// errors with:

Couldn't connect to MPD (host = 192.168.1.2, port = 8000): Timeout

Odd.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2013-06-03 22:43:44

Tarqi
Member
From: Ixtlan
Registered: 2012-11-27
Posts: 179
Website

Re: Using ncmpcpp to listen to a MPD stream

Raynman wrote:

You would use this for remote control of an mpd server.

jasonwryan wrote:

Without the http:// errors with:

Couldn't connect to MPD (host = 192.168.1.2, port = 8000): Timeout

Port 8000 is the stream port. Try 6600.


Knowing others is wisdom, knowing yourself is enlightenment. ~Lao Tse

Offline

#5 2013-06-03 22:48:38

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Using ncmpcpp to listen to a MPD stream

Thanks Tarqi: I have tried all of those permutations:

ncmpcpp -h 192.168.1.2 -p 6600                                                                                                                                           
Couldn't connect to MPD (host = 192.168.1.2, port = 6600): Timeout while connecting

I suspect that this is a conflict with running mpd on the client (even though killing the local daemon makes no difference).

I'm going to chalk it up to me misunderstanding what is possible. The mpc add approach works so I will stick with that...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2013-06-03 22:56:45

Tarqi
Member
From: Ixtlan
Registered: 2012-11-27
Posts: 179
Website

Re: Using ncmpcpp to listen to a MPD stream

Sorry, read the thread again and totally misunderstood the topic. Post deleted.

Last edited by Tarqi (2013-06-03 23:03:28)


Knowing others is wisdom, knowing yourself is enlightenment. ~Lao Tse

Offline

#7 2014-04-23 15:06:58

iomartin
Member
Registered: 2013-10-10
Posts: 8

Re: Using ncmpcpp to listen to a MPD stream

I know this topic is almost one year old, but I was wondering if you ever got ncmpcpp working, as I'm facing the same issue right now.

Offline

#8 2014-04-23 16:16:47

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Using ncmpcpp to listen to a MPD stream

@iomartin: The following might be useful to you, but (especially if it isn't) you should maybe start your own thread. Now that you bumped it, I think it can't hurt to add some more information because I'm not convinced the confusion was ever completely cleared up and it might help others who find their way to this thread.

I just did a quick test and it works fine for me. MPD runs on my desktop with a decent speaker set. My laptop is on the same network and with

ncmpcpp -h $DESKTOP_IP

(this uses the default port 6600) I can connect and get it to pump sound through the speakers. Note that the speakers are connected to the desktop PC. I emphasize this because part of the issue was confusion about different client-server interactions. See also these items in the list on http://mpd.wikia.com/wiki/What_MPD_Is_and_Is_Not

MPD Is

  • A server that plays music (Music Player Daemon) locally.

MPD Is Not

  • A server that serves music to clients, clients are just remote controls.

But you can use a http stream to send the audio from the server to clients. These clients don't have to know that the stream is generated by mpd. In jasonwryan's case, the client is another mpd instance running on his laptop (so another mpd server, not an mpd client, because an mpd client is just a remote control for a server), but you could use mplayer on some Windows player instead.

`mpc add` runs the mpc client on the laptop, this client connects to the mpd server on the laptop and this server connect to the stream provided by the other mpd server (not on the laptop). You could then also start ncmpcpp on the laptop as a remote control for the mpd instance on the external server (by specifying the host, like with -h). Then this ncmpcpp instance sends commands to the server to control the http stream. This stream flows in the opposite direction over the network back to the laptop and the mpd instance on the laptop sends the incoming stream to the laptop speakers (or some other audio output).

jasonwryan got a connection timeout. I don't know why, but I can say your mpd needs to be listening for TCP connections and not just local connections on a Unix socket and of course you shouldn't have any firewalls blocking the connection.

Last edited by Raynman (2014-04-23 16:19:38)

Offline

Board footer

Powered by FluxBB