Skip to content

Setting up a local stream with VLC or LiquidSoap

Avanish Pathak edited this page Apr 22, 2016 · 4 revisions

VLC

Setup VLC

  1. Install the latest version of VLC.
  2. Make the vlc command available to you. I recommend creating a symlink at /usr/local/bin/vlc to the VLC binary inside the VLC.app package, eg. /Applications/VLC.app/Content/MacOS/VLC

Start StreamMachine

  1. Start the StreamMachine server in standalone mode (see the StreamMachine README for details). It'll probably be something like:
    ./streammachine-cmd --config ./config/standalone.json
  2. Visit the StreamMachine Admin UI at /admin. Either create a stream or confirm that one is already present and waiting for a Source. Also make note of its stream key and audio type.

Start a VLC stream server

Start a stream via VLC, with the following sout configuration:

Config Description
mux The type of encapsulation to wrap around the audio stream. For MP3 files, use dummy.
dst A source specifying the ip/port that your StreamMachine instance is listening to for a source, along with the password and stream name.
access Set to shout, which tells VLC to forward the stream to an "Icecast" server (which is actually the StreamMachine server, pretending to be Icecast). See here for more info: https://github.com/videolan/vlc/blob/master/modules/access_output/shout.c
Example commands:
  • Stream a local mp3 file:
vlc --repeat airtalk_episode.mp3 --sout \
'#standard{mux=dummy,dst=source:[email protected]:8002/streamname,access=shout}'
  • You can also connect to a remote live stream:
vlc http://live.scpr.org/kpcclive --sout \
'#standard{mux=dummy,dst=source:[email protected]:8002/streamname,access=shout}'

Start the stream

  1. Visit the VLC Web Interface, by default at http://localhost:8080. You may need to set a password in the vlc command with the http-password option. You can also open the VLC OS X client and configure the password there.

  2. Play the file. Check the StreamMachine output to make sure that everything is connecting properly and that the Source was registered and activated.

Your stream should now be audible at the configured port/stream path.

Liquidsoap

Setup Liquidsoap

  1. Install the latest version of liquidsoap (use brew, apt-get etc.)
  2. Ensure the command liquidsoap works for you (liquidsoap is successfully installed).

Start StreamMachine

  1. Start the StreamMachine server in standalone mode (see the StreamMachine README for details). It'll probably be something like:
    ./streammachine-cmd --config ./config/standalone.json

Create a Playlist

  1. We are going to support multiple mp3 files, by creating a playlist. a. Note the path of a playlist.m3u which has paths to all your mp3 files b. Create your own playlist with
find /path/to/mp3/folder -name "*.mp3" > ~/playlist.m3u

Stream to StreamMachine via Liquidsoap

  1. The final step, tell liquidsoap to hit the right endpoint, authenticate and start playing your playlist
  2. The command you're looking for is
liquidsoap 'output.icecast(%mp3, host="localhost", port=8002, password="password", mount="test", mksafe(playlist("playlist.m3u")))'

Your stream should now be audible at the configured port/stream path.