Friday, February 28, 2014

Broadcasting audio over the network using VLC

This is pretty much a rip-off of a response that I wrote in a reddit thread, but it's useful, and if nothing else, I'd like a way to be able to reference this in the future!  Of course, there are other ways to do this, but this was the easiest to do with the tools I already had installed.

Regarding, in general, a way to stream audio over the network:
VLC makes for a fairly easy solution. The syntax is a little bizarre, but the documentation[1] seems pretty good.
Here's an example that will stream my headset microphone input out over the network as a Vorbis OGG stream:
cvlc -vvv \
pulse://alsa_input.usb-Logitech_Logitech_G930_Headset-00-Headset.analog-mono \
--sout '#transcode{vcodec=none,acodec=vorb,ab=128,channels=2,samplerate=44100}:http{dst=192.168.2.170:8080/stream.ogg}'
Then, on the other computer, you can use VLC or some other audio player, or even a web browser, and point it at the URL (192.168.2.170:8080/stream.ogg in my example.)
My example uses pulseaudio. If you're also using pulseaudio, you can find the MRL for your input by running
pacmd list-sources | grep name
and replacing my "alsa_input...analog-mono" string with the one you find. You'll also need to change the IP to your IP address, obviously.
If you run into issues, you can use the VLC gui (if you're running a gui) to help you generate the proper transcode string and input MRL. In VLC, open the playlist and choose Audio capture under Devices on the left, right click the one you want, and follow through on the Stream wizard.
This should at least give you a starting point!


You've gotten better at Linux! (6)

No comments:

Post a Comment