Video Streaming with VLC Player

The VCL player form VideoLAN is an awesome piece of software. Apart from playing most video formats and supporting conversion from one to another, it has a video streaming server built into it. All you need is a video file or video capture device and a few clicks to start broadcasting your videos over network. The best part is it is open source and available for multiple operating systems.

Screenshot of the VLC Player on Windows.

Setting up the server

  • This is really easy. Download and install the VLC player from this site. Choose all components during installation.
  • Select the Start->Program Files->VideoLAN menu and click on VLC Media Player in the submenu. This will start the VLC player
  • From File menu , select Wizard and the Wizard dialog will show up. Now with ‘Stream to Network’ radio button checked , click on ‘Next’ button.
  • Here you will be prompted to select an existing stream or choose a new one. We will create a new stream, so click the ‘Choose’ button.
  • The ‘Open…’ dialog box shows up. Here you can select a video file which you want to stream. So browse and select a file. Click the ‘OK’ button. Then click the Next button.
  • Right now we will select HTTP radio and enter nothing in the ‘Destination’ editbox. Click ‘Next’. Here select a format (on windows, select ASF) and click ‘Next’ button again.
  • You can enter ‘1’ in the TTL box for now and click ‘Finish’ to complete the process.

VLC Player streaming video onto network.

Your server is working. Now open another instance of VLC Player . From ‘File’ menu select ‘Open Network Stream’. On the dialog that shows up, select the ‘HTTP/HTTPS/..’ radio button on ‘Network’ tab and enter ‘localhost:8080’ in the edit box beside it . Click ‘OK’. You should be able to see the video in the VLC Player. At this stage you can pause and restart the video on server and it will reflect in the second instance of VLC Player. You can also start Windows Media Player, and from File->Open URL , open the http://localhost:8080 stream and enjoy the video. If you are connected an intranet then you can access the video stream from other machines similarly by substituting ‘localhost’ with your IP address.

Streaming from different sources

Source of video can be a file, VCD/DVD, TV tuner card, camcoder or (it seems) any common video capturing device. When you choose to create a new stream you have the option of picking up the video source. Most video/audio capture devices would show under the ‘DirectShow’ tab. I connected a camcoder and it was detected as a video source after clicking Refresh.

My camcoder showing up in the video devices dropdown.

You can broadcast to a single computer using RTP Unicast or broadcast to a range of IP addresses using RTP Multicast.

Showing videos in webpages

Once you have a server , you may want to host webpages that show the video. The good news is that you would have installed the Mozilla Plugin for VLC Player by opting for a full installation. The code to make a basic webpage with the plugin is given below:

<embed type="application/x-vlc-plugin"
name="video1"
autoplay="no" loop="yes" width="400" height="300"
target="http://localhost:8080" />
<br />
<a href="javascript:;" onclick='document.video1.play()'>Play video1</a>
<a href="javascript:;" onclick='document.video1.pause()'>Pause video1</a>
<a href="javascript:;" onclick='document.video1.stop()'>Stop video1</a>
<a href="javascript:;" onclick='document.video1.fullscreen()'>Fullscreen</a>

More details can be found on this page.


Screenshot of VLC Player plugin (FireFox) and Windows Media Player (IE) showing streaming video in web pages.

Similarly on IE , we can use Windows Media Player for this purpose. Sample code for an HTML file is given below:

<OBJECT id=WMPPlayer41 style="width:350px;height:350px" 
classid=clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6 VIEWASTEXT>
<PARAM NAME="URL" VALUE="http://localhost:8080">
</OBJECT>

Experimenting with the VLC Player. I am sure you will find out many interesting features and applications. Please share them with me.

Home page of VideoLAN Project
http://www.videolan.org/

Download site for VLC Player
http://www.videolan.org/vlc/

Online documentation of VLC Player
http://www.videolan.org/doc/

Information on RTP Unicast and RTP Multicast
http://en.wikipedia.org/wiki/Real-time_Transport_Protocol

Information on TTL (Time To Live)
http://en.wikipedia.org/wiki/Time_to_live