LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-19-2017, 10:09 AM   #1
Beren329
LQ Newbie
 
Registered: Oct 2014
Posts: 26

Rep: Reputation: Disabled
Question Configuring clients for mpd server


Hello All!

I have a question regarding mpd and ncmppcpp[cppcpppppcppppppp] that I hope someone might be able to help with. I'm new to setting up both.

Here's the situation: in trying to repurpose rather than junk a number of old gadgets I have lying around, I'm working creating a simple household digital music server. The idea is to use an old netbook with an external drive as the server, and then stream music from there to every other device in the house, including a few old phones that'll become players/remotes.

So, I did a headless Debian install on the old netbook, which is connected to an external HD containing many gigs of music. I'm using mpd as the server, controlled locally via ncmpcpp. That part works great.

On the android phones/tablets, I'm using MPDroid, which works beautifully: each of those devices both works as a remote for the main system *and* can pipe the audio directly to the device. So, for example, an old phone hooked up to a radio/portable speaker in the kitchen can stream music from the server to the kitchen radio.

What I'm having trouble with, a little ironically, is doing the same things (both controlling the server AND streaming the audio *to* the remote computer) to my other linux boxes (a laptop and a desktop) that run Linux using ncmpcpp!

I've been able to get it to work in a way that seems awfully kludgy to me:

The "server" is configured to stream on port 8000; the main port specified in mpd.conf is 6601`

1. Run mpc on the client to connect it to the httpd stream coming from the server:

Code:
mpc add http://10.0.0.205:8000
2. Then run one instance of ncmpcpp that just pipes in the audio from that stream.

3. Then run *another* instance of ncmpcpp on the client, pointing it to port 6601, which allows one to control and select music on the server from the client:

Code:
ncmpcpp --host 10.0.0.205 --port 6601
This *does* work, but it seems like a really awkward solution to me, and I fear I'm missing something stupidly obvious. Would anyone have any suggestions?

Thanks!

Mark in St. Paul MN
 
Old 06-22-2017, 02:39 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 13,147
Blog Entries: 9

Rep: Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603Reputation: 3603
i'm surprised you got it working at all.
i have been told that mpd can be remote-controlled, but is not really suitable to stream music to other devices.


i'm guessing your setup would not work for remote streaming? meaning, when you leave your house (home network)?
 
1 members found this post helpful.
Old 06-24-2017, 12:37 PM   #3
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,455

Rep: Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302
Just set up mpd to output a stream, then open something like VLC on the device which you want to listen on and pint it at the IP address and port. Then open ncmpcpp with something like "ncmpcpp -h <ipofstreamingserver>" and you'll be able to control it.
The key thing to remember is that mpd doesn't output to network by default -- it is set up to be controlled over a network and run on a headless device with speakers attached.
 
1 members found this post helpful.
Old 06-24-2017, 03:25 PM   #4
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,455

Rep: Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302
I finally* bothered to find out why mpd stopped working on my machine** and found that the http streaming section of mpd.conf is easy enough to populate and that encoding as wav didn't work so well on my wireless-attached laptop but streaming as flac is fine though, of course, if you're just streaming for background music vorbis or lame will be fine and even less bandwidth-intensive. I listened to the stream using:
Code:
mplayer http://192.168.1.12:8000
Where the IP addresses is the server IP. Then connected ncmpcpp to it in another terminal window with:
Code:
ncmpcpp -h 192.168.1.12
For completeness the streaming section of the mpd.conf looks like this on my machine:
Code:
audio_output {
        type            "httpd"
        name            "My HTTP Stream"
        encoder         "flac"          # 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:2"
}
*It's not been working for months and I don't really listen to music with any other player as they're not as convenient so shows how lazy I am.
**I kept on getting an error that mpd was unable to decode the given file -- turns out that while, on my reinstalling Debian a while back, I hadn't removed the folder that I was pointing mpd to for my music collection but the simlinks in it stopped being valid.

Last edited by 273; 06-24-2017 at 03:29 PM. Reason: Realised I needed to comment out "bitrate" since I am using flac
 
1 members found this post helpful.
Old 06-24-2017, 07:07 PM   #5
Beren329
LQ Newbie
 
Registered: Oct 2014
Posts: 26

Original Poster
Rep: Reputation: Disabled
Thank you 273!

I'd discovered the VLC solution independently, and indeed it's a little more elegant than what I was doing. I also realized it makes more sense, as far as controlling the stream goes, to just SSH into the server and run ncmpcpp there.

Thanks for the flac suggestion, though--sound quality is really important to me, and most of my music is in FLAC format anyway, so streaming with flac as the encoder is a great idea!

Mark
 
Old 06-24-2017, 07:15 PM   #6
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,455

Rep: Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302
Glad you've got things working as you like them.
I wouldn't bother sshing into the server and running ncmpcpp there unless you're worried about leaving mpd open on the network -- using a remote client is just as easy. Not sure whether you're aware of Gnome Music Player Client either? It's not a bad controller and is installable as gmpc in Debian.
I don't recall whether VLC will keep listening when the music stops, I know mplayer doesn't otherwise I would suggest mplayer might be better as it's just a command line. Mind you, anything you can listen to a music stream with will work.
Streaming as FLAC is still fairly high overhead but it's worth trying and more likely to work than wav.
In case you can't tell I've been a great fan of mpd ever since I first got it working (which took me ages due to PulseAudio permissions and the like). I was impressedto find it can even play network streams itself and stream to icecast servers to make one's own "internet radio station".
 
Old 06-24-2017, 07:29 PM   #7
Beren329
LQ Newbie
 
Registered: Oct 2014
Posts: 26

Original Poster
Rep: Reputation: Disabled
I'm totally learning why you'd be enamored with mpd--simple, high-quality, and really useful. I'm also rather enamored of ncmpcpp--love the retro look of the console-only visualizer, for one thing! This is also, of course, a subset of a sort of process of falling in love with the command line and terminal for all sorts of things.
 
Old 06-24-2017, 07:44 PM   #8
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,455

Rep: Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302
Indeed, it's frustrated me a lot because, to me at least, it's one of those situations where a simple tool makes you have to actually think about what you are setting up. So have to admit that, sometimes, I just feel like using things like Gnome Music Player Client.
 
  


Reply

Tags
mpd, ncmpc, streaming


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Configuring the MPD Music Server on Ubuntu Linux LXer Syndicated Linux News 0 07-31-2016 06:15 PM
[SOLVED] mpd clients dont play music after resume from suspend botnet Slackware 10 07-27-2010 11:17 AM
Configuring Open LDAP Server & Clients in Ubuntu varun2109 Linux - Server 2 01-29-2010 11:08 AM
Configuring Mac OS X clients with Samba Server maelstrom209 Linux - Networking 3 07-28-2009 02:01 PM
configuring a server so that clients can execute different instances of same app. drsparikh Linux - Networking 3 02-18-2006 09:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration