~ 2 min read
Streaming multicast videos with VLC and mini-sap server
VLC, formerly known as VideoLAN is one of the most main-stream applications used today to achieve media playing, and especially video stremaing. It supports unicast (udp, http, mmsh) and broadcast/multicast streaming (udp and rtp).
Multicast is fairly the most profitable protocol to use when talking in terms of bandwidth so lets see how it works..
Firstly, install vlc (accomplished by apt-get install vlc
) and then running it: vlc -vvv movie.avi –sout ‘#standard{access=udp,mux=ts,dst=239.255.12.42}’
.
At this point VLC will run in console mode, debugged and start the stream. The VLC client which is found on a different computer but on the same multicast subnet on the LAN can be launched and directed to this multicast IP, although a better way is to run a sap server that will announce all the streams that the vlc server plays to all vlc clients on the LAN.
To do that, download mini-sap server from here and compile it, which is pretty straight-forward: ./configure && make && make install
.
Once that is done, a few changes might be required to make on the config file sap.cfg to adjust the multicast IP and other issues you may want to tweak, after which ./sapserver -c sap.cfg -s
will run the sap announcing server and clients may open their playlist windows and be aware of video streams on the LAN.
If several interfaces are present it might be needed to add a static route so that multicast won’t go through the default gateway which is invalid. route add -net 239.0.0.0 netmask 255.0.0.0 dev eth0
.