simple overtone streaming with vlc

· by [Joakim Verona] · Read in about 2 min · (269 words) ·

For my Sylt project https://github.com/jave/overtone-sylt, I wanted a very simple and robust way to stream the output from a jackd sound server to a client machine on the network.

There are many ways to do this, but a pretty simple way is to use VLC.

An advantage over netjack, which is another method, is that you can do it after-the-fact. You can start jackd and do things locally. Then you can attach a listener, and remove it on the fly. Netjack is much more convoluted.

sudo dnf install vlc-plugin-jack

vlc \
jack://channels=2:ports=.* \
--sout "#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}:http{mux=mp3,dst=:9999/test}"

A quick test is to use hyrogen play through this stack.

  • start hydrogen
  • qjackctl
  • and the vlc on server
  • and vlc on client

Latency isn’t too great with this method though.

Opus, which is a nice new codec, might help. It’s listed as supported with:

vlc --list-verbose

For this test I used RTSP, which is like RTP but with more docorations such as a control layer and other niceties.

vlc \
jack://channels=2:ports=.* \
--sout "#transcode{vcodec=none,acodec=opus,ab=128,channels=2,samplerate=44100}:rtp{port=1234,sdp=rtsp://192.168.200.15:9999/test.sdp"

on the client(s), run:

vlc rtsp://192.168.200.15:9999/test.sdp

When using sdp=rtsp, it is possible not to give any destination address. VLC will then send the stream to any client that connects to it.

There seems to be a bug in vlc, such that I was able to rdp strem with the «vorb» codec, but not «opus». Latency with vorb are a couple of seconds.

Mplayer, on the other hand, works fine with opus on the client side:

mplayer rtsp://192.168.200.15:9999/test.sdp

The latency is better but still in the seconds range, not the desired milliseconds-range.

I will work to improve this for Sylt!