How to setup streaming server via VLC

This tutorial describe installation and configuration of VLC streaming server on Linux (IE Ubuntu). Linux server has no GUI and all setup goes thorough command line.

First at all we need to install vlc, vlc without gui and optionally some extra codecs. For ubuntu 11.10 you should type:

$sudo apt-get install vlc vlc-nox libavcodec-extra-53

*Note: You may ask “why I need vlc when I have vlc-nox?”. Without vlc package some errors may occurred during starting streaming.

Now you can create configuration file vlm.conf at location /home/username/streaming/ .
In vlm.conf paste following lines:

new channel1 broadcast enabled
setup channel1 input "http://urltostream"
setup channel1 output #http{mux=ts,dst=:8090/live1}
setup channel1 option http-reconnect
setup channel1 option no-sout-rtp-sap option no-sout-standard-sap option ttl=1 option sout-keep

new channel2 broadcast enabled
setup channel2 input "http://urltostream"
setup channel2 output #transcode{vcodec=h264, vb=1024, scale=1, acodec=mpga, ab=128, channels=2} :duplicate{dst=std{access=http, mux=ts, dst=:8090/live2}}
setup channel2 option http-reconnect
setup channel2 option no-sout-rtp-sap option no-sout-standard-sap option ttl=1 option sout-keep

new channel3 broadcast enabled
load playlist.conf
setup channel3 output #transcode{vcodec=h264, vb=1024, scale=1, acodec=mpga, ab=128, channels=2} :duplicate{dst=std{ access=http, mux=ts, dst=:8090/live3}}
setup channel3 option no-sout-rtp-sap option no-sout-standard-sap option ttl=1 option sout-keep

control channel1 play
control channel2 play
control channel3 play

This conf will create three channels to broadcast. channel1 re-stream http stream that is setted on line 2. On line 3 there are output configuration: output container (mux=ts means mpeg_ts) and output url (dst=:8090/live means you can acces via client on http://server_ip:8090/live1).

channel2 also re-stream content from input url on line 8. The only difference here is output line 9. This stream is not only re-streaming it also do transcoding and output is set to different video-audio codec and container.

channel3 not doing re-streaming it play content from local server. At line 14 for it load another conf file playlist.conf which contains playlist items (see below). playlist.conf is located in same folder as vlm.conf.

Content of playlist.conf:

setup channel3 input /path/to/video1
setup channel3 input /path/to/video2
setup channel3 input /path/to/video3

For more information please see Advanced Streaming Using the Command Line and Streaming HOWTO with Vlm

Starting with command:

$nohup cvlc -Ihttp --file-logging --log-verbose=1 --logfile="vlc.log" --vlm-conf vlm.conf & echo $! > vlc.pid

Stopping with command:

$kill `cat vlc.pid`

Leave a Comment

Posting your comment...

Subscribe to these comments via email