0

tl;dr how to reliably stream audio on demand between 2 linux machines over the network on demand?


Hello, sometimes I want to play something from my laptop through the bigger speakers of home sound system. That system is connected to another laptop that's mainly used for watching video. Initially I was thinking to buy a wireless receiver for the home sound system but it seems easier to me to just turn off the multimedia laptop and stream to it instead of changing sound system input, etc.

Since both machines are running recent fedora linux I thought that would be easy but turned out it is not so easy. Initially I attempted to use PulseAudio streaming. It actually worked but because the multimedia laptop is older and has only 54mbit wifi connection to the network, the sound often had glitches. Also I've hit a pulse audio bug that configuring local multicast broadcast PULSE_SINK actually DoSes local network (here) and (here).

So I thought that I need some more professional protocol for streaming than the raw stream pulse audio creates. I see that VLC is suggested for the purpose. But I'd like to be able to stream to the remote server only when I want. That means when I set $PULSE_SINK to some other value, the remote server should play, otherwise sound should play locally as normal.

I was wondering if anybody has done that - create a vlc listener and then create a local PulseAudio sink that send audio there if used. Otherwise don't send anything. I see how to create a VLC listener but I'm not savvy with PulseAudio and before I lose too much tie with that, I hoped somebody can tell me how to do or at least suggest that something works so I don't setup something that wouldn't work quiet as expected.

I'm open to non-vlc solutions as long as they do not flood network and audio plays without glitches.

Thank you!

0

My personal method for on demand streaming audio is the use of MPD, which has a built in http server, and is designed to be a headless music database based audio application to be controlled by a surprising number of client software. This method is particularly useful if you also perhaps want accessibility from a host not located on your LAN.

Use of VLC's HTTP or Telnet remote interfaces is an option too, if for some reason you're really set on using VLC, though there is a bit more overhead and less in the way of variety for client software, meaning less flexibility. My own experience there is limited to the Android app "VLC Direct Pro", but general instructions for use of VLC's http server can be found here The general gist is as follows:

  1. To activate the web interface, click the Tools menu in VLC and select Preferences. Click the All option under Show settings to view VLC’s advanced settings. Scroll down in the list of advanced settings and select Main interfaces under the Interface header. Click the Web check box to enable the HTTP interface. Save your settings and restart VLC. Each time you start VLC, the web server will be started in the background.

  2. Point your web browser at http://localhost:8080/ to access VLC's web interface.

  3. To enable connectivity from other computers, add them to the /usr/share/vlc/lua/http/.hosts file. If you're traversing a NAT'ed gateway, open the necessary ports.

  4. "Access control has been simplified in VLC 2.1.0. You can restrict access to the web interface by using a simple password that can be set under Tools → Preferences (all) → Interfaces → Main interfaces → Lua → Lua HTTP → Password". (from the VLC documentation here). Bear in mind, this is an http, not https, authentication measure, so it's something to consider keeping restricted to a LAN/VPN if security is at all a concern.

In addition to these options, the http control feature is definitely a fairly popular option, found in other media players such as Winamp or XBMC (just off the top of my head...the list is really quite long), so you can afford to pick whichever option works best for you.

| improve this answer | |
  • Basically I want to set PULSE_SINK variable or some other variable and the music to play on the other machine. I don't care if it would be VLC or something else. I'll have a look at MPD but I need the client (player) to be on always on and wait to receive content and not the reverse. Or maybe I don't understand what is client here. I'll read about it to be sure. – akostadinov Oct 11 '14 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.