Hack 85. Stream Video with VLC
VLC provides the ability to stream video to and from any platform it runs on.
There are many different commercial streaming video servers out on the Internet, but if you have installed VLC [Hack #56], not only can you view videos, but you can also stream them across the network. This hack describes how to use the VLC streaming video wizard to stream your video content across the network.
There are a number of reasons you might want to stream video using VLC besides just "because you can." Streaming video across the network puts the primary load of encoding video onto the server. This means you can play back video on systems that might be too slow to play the video otherwise because the viewing application only needs to perform one taskdecoding the video rather than the two tasks of encoding and simultaneously decoding. Or you might store your video files on a fileserver and want to play them on your laptop over the wireless network, but the wireless link is a bit too slow to play it directly over the network. Or, you might just want to play the same video on multiple computers at the same time. Whatever the reason, VLC provides a wizard that takes most of the guesswork out of configuring a streaming server.
To set up the streaming video server, first launch VLC and click File Wizard. Select "Stream to Network in the window that appears and click Next. The next window lets you choose the input stream to use. You may choose to input using a local file, in which case you click Choose to select one or more files from your file system. Alternatively you can click "Existing playlist" to select one or more files from your current playlist. Click Next once you have selected input to stream.
The next window lets you choose your streaming method. If you plan to stream to only one computer, select UDP Unicast and enter the client's IP address in the text box below. UDP Multicast lets you stream to multiple computers using multicast. If you have a multicast network, enter the IP address of the multicast group in the text box (between 22.214.171.124 and 239. 255.255.255). If you aren't sure what multicast is, you probably want to choose either UDP Unicast or HTTP. Click HTTP and VLC will stream over HTTP. You may either enter an IP address and port that VLC will listen for incoming connections. A better move is to just leave it blank and have VLC default to listening to connections for your IP address on port 8080. Click Next after you have made your choices.
The next window allows you to choose how to encapsulate the video. What you choose here depends largely on the speed of the streaming server and the speed of the client. If your client is fast, you might want to stick with the default format that VLC chooses for the video. For slower clients you might want to choose MPEG S (MPEG transport stream format) to stream MPEG video, which slower computers will have an easier time playing. The next window lets you configure the Time-To-Live setting for UDP Unicast methods. Generally leave this value alone so VLC will use the default. Click Finish and VLC will start streaming the video.
Once the video begins streaming, you can pause or stop playback from the VLC controls just like with any video. On the client side, launch VLC (or any other video player like MPlayer that can handle VLC streams) click File Open Network Stream and choose either UDP/RTP, UDP/RTP Multicast, or HTTP to match the VLC server settings. Click OK, and VLC will start playback of the streaming video in progress.