New to mpd

General Discussion about MPD – anything that doesn't fit in the other MPD forums.
Post Reply
UKenGB
Posts: 5
Joined: May 12th, 2021, 5:10 pm

New to mpd

Post by UKenGB »

I mean totally new. Only just started looking at it today, so I have a lot to learn, but I hope mpd can help with my plan.

I want to stream Satellite radio stations (FreeSAT here in UK) onto my local LAN. I can do this using a SAT>IP server over http, but they are mp2 (i.e. MPEG 1 layer 2) streams and the players I want to use cannot handle mp2. They do support mp3, so should support mp2 as well, but they don't. So I need to transcode and am hopeful mpd can do what I need, reading the SAT>IP mp2 stream (with the curl plugin?) and transcoding to mp3 (or aac) via http output. However would appreciate help with a couple of questions:-
  • Am I right in thinking a single instance of mpd with a single conf file can handle a single stream, i.e. one input and one output (with possibly stuff in between)?
  • So multiple streams would require multiple instances each with their own conf file specific for that stream?
  • Can mpd be configured to STOP its input (i.e. 'pulling' the SAT>IP output) when there are no listeners?
  • With any running instance of mpd, is it possible to enable and disable an input from an external script (using mpc presumably)?
The problem is that I need to disconnect from the SAT>IP server when there are no listeners so that tuner is released. Apart from disliking the idea of continuously trying to stream when no-one's listening, there are way more radio stations than tuners and they HAVE to be released and hence available for other processes - a different station or TV.

Hope someone can help with the above so I can figure how best to use mpd.

Thanks.
max
Forum team
Posts: 1256
Joined: January 15th, 2013, 3:43 pm

Re: New to mpd

Post by max »

I don't think MPD is a good fit for you. It can be used, but it's not optimized well for that. You'd need one MPD instance (or MPD partition) per channel, and one HTTP port per channel. Each MPD instance/partition needs to be explicitly told to start playback, which requires a MPD client (in addition to the HTTP client receiving the stream from MPD). This is cumbersome and complex.
If you have time, you will find lots of potential in the MPD code base to build a perfect solution for you, and I'll glady help you, but unless you want to get your hands dirty with C++, don't use MPD.
UKenGB
Posts: 5
Joined: May 12th, 2021, 5:10 pm

Re: New to mpd

Post by UKenGB »

Thanks max. I was thinking of simply firing up an instance of mpd with specific conf file for each stream (that I assume would immediately start streaming) and then kill that process when no more listeners.

There would only need to be one configuration for each radio station I want available (<20) and unlikely to ever require more than 2 simultaneously.

Could mpd stream to Icecast?
max
Forum team
Posts: 1256
Joined: January 15th, 2013, 3:43 pm

Re: New to mpd

Post by max »

UKenGB
Posts: 5
Joined: May 12th, 2021, 5:10 pm

Re: New to mpd

Post by UKenGB »

Thanks, yes, I saw it could stream (push) to Icecast, but outputting via http would work better in this case. So there'd be an http stream available for that station. Another quick (and I hope final) question:-

Can the 'bind_to_address ADDR' setting include more than just the hostname, i.e. followed by a 'mountpoint', so full stream address would be e.g. http;//myserver:port/mountname/ ?

If no mountpoint possible and only distinguishable by port, that wouldn't be so good. Not impossible though.
max
Forum team
Posts: 1256
Joined: January 15th, 2013, 3:43 pm

Re: New to mpd

Post by max »

Not possible, needs different addresses/ports.
UKenGB
Posts: 5
Joined: May 12th, 2021, 5:10 pm

Re: New to mpd

Post by UKenGB »

Ok, gotcha.

Just thought, I could set up a suitable (and different) hostname for each station. That would work well.

Thanks again max, I need to try this out.
skidoo
Posts: 222
Joined: April 28th, 2013, 10:06 pm
Location: Western Germany

Re: New to mpd

Post by skidoo »

How about an Apache as reverse proxy with some URL rewrite magic?
UKenGB
Posts: 5
Joined: May 12th, 2021, 5:10 pm

Re: New to mpd

Post by UKenGB »

Food for thought.
Post Reply