Live Webcam Streaming using VLC on the Command Line

The following are notes on using VLC as both server and server to stream a webcam from a ender across a LAN to multiple receivers. It focusses only on internal LAN streaming, using RTSP, UDP and RTP as the streaming solutions, and working via the command line in Linux. VLC offers other form of streaming (e.g. HTTP, which are covered in some of my older notes) and the GUI is quite good for selecting streaming options.

Network and Computer Configuration

All commands were tested on PCs with Intel i5-4590 CPUs, 16GB of RAM and solid state drives. They were running Ubuntu 14.04 LTS and used VLC 2.1.4. The webcams were Logitech C170 and identified as /dev/video0 by the operating system (if you have two or more webcams then it may appear as a different device). Some tests involved client/server connected to the same switch using 1Gb/s links/switch, while others involved a hierarchy of switches (i.e. client - switch - switch - switch - server) and were limited to 100 Mb/s to the central switch. All tests involve client and server on the same LAN.

I was only interested in video, so audio was disabled in all cases. I use the -vvv to produce extra verbose output; you can safely remove it once you have the command that works for you. I use cvlc on the server (I do not display the video and so no GUI) and vlc on the receiver.

For the following commands the server (i.e. the computer with the webcam that we want to view) has IP address and the receivers are, where xx is some number other than 01.

Unicast Streaming with RTSP for Control and RTP for Data

Start the server/sender:

cvlc -vvv v4l2:///dev/video0 --sout '#transcode{vcodec=mp2v,vb=800,acodec=none}:rtp{sdp=rtsp://:8554/}'

Examples of other options you may set include:

Start the client/receiver:

vlc -vvv --network-caching 200 rtsp://

Multiple receivers can receive the same stream (although it is only using multiple unicast streams - see the next section for true multicast). Just start the receiver on other computer in the same way as above.

Unicast Streaming with UDP for Data (no Control)

Start the server/sender:

cvlc v4l2:///dev/video0 --live-caching=10 --sout '#transcode{vcodec=mp2v,vb=256,acodec=ne}:std{access=udp{caching=10},mux=raw,dst=}'

Start the client/receiver:

vlc --network-caching 200 udp://@:1234

Multicast Streaming with RTP for Data (No Control)

Start the server/sender:

cvlc -vvv v4l2:///dev/video0 --sout '#transcode{vcodec=mp2v,vb=800,acodec=none}:rtp{dst=,port=5004,mux=ts}'

Similar options as when using RTSP, with the following additions:

Start the client/receiver:

vlc -vvv --network-caching 200 rtp://

Similar to RTSP, adjust network caching to produce an acceptable trade-off of delay and smoothness.

Multiple computers can view the same stream by running the above client command. This uses multicast across the LAN. Assuming the switch supports multicast, for N receivers, a single packet will be sent from server to switch, and then the switch will send a copy of that packet to each of the subscribed receivers.