Watch streaming video over the LAN with VLC
I have a large collection of videos on my Windows PC. Before today, in order to watch the videos on my computer somewhere else in the house, we’d have to copy the movie to a USB stick and transfer it to the other computer.
Since this is an almost daily occurrence, and copying videos can take a while, I decided to look into streaming the videos over the Local network.
My first thought was to create a virtual host on my local Apache server, and have the videos streamed by Apache over HTTP. This worked reasonably well for a while, but after about 10 minutes or so the video started to lag on the other side. This also happened when I tried streaming the file via FTP, using Filezilla FTP server.
I also tried using Nginx which has an FLV streaming module. The videos on my PC are mostly .avi or .divx, so I’d have to transcode to FLV before hand in order to stream. I didn’t want to have to transcode each file to FLV, since it was already taking up a huge amount of space on my hard disk.
This whole time I was using VLC to play the videos. I had totally overlooked the fact that VLC was also a video streaming server. It turns out, VLC can transcode and stream at the same time (using FFMpeg internally), so you don’t need to transcode files before hand, and keep around multiple copies of the same file in different encodings.
Here is the article on streaming video with VLC that I followed. Pretty soon I had VLC on my PC streaming movies to multiple PCs and laptops on the local network. The videos playback can also be controlled from the streaming server, so I could start and play movies for my 2 and a half year old daughter Joana while doing my work.
The only problems with streaming with VLC is that you’ll have to mix and match video encodings and streaming protocols to figure out which works. For me, streaming H264 streamed over RTP seemed to work best. Edit: I somehow missed their documentation on supported streaming protocols.
Step by step to setting up streaming a video with VLC over your LAN:
- Open VLC on your PC with the video
- Click on: Media -> Streaming…
- Choose the video file you want to stream (double click) A window opens with the streaming options.
- Choose RTP for the streaming protocol. For the address put in the IP* of the computer to stream to. You can leave the port number as is.
- Choose H264 from the “profiile” dropdown. This selects “MPEG-TS” for encapsulation, H264 for Video and MPEG-4 for audio.
- Click Stream.
- Then on the computer you want to watch from, Open VLC.
- Click on Media -> Open Network
- Choose RTP and the computers IP or localhost. Leave the port number as is.
- Click “Play”
You can also use the command line.
To open the command line on XP: Start -> Run -> type in “cmd” and click enter
On Vista: Start -> type “cmd” into the search box and click enter
In the command prompt, type: net view
For the list of IPs: arp -a
To get the IP of a computer given its name: ping <name>
To get the name of the current computer: hostname
Before trying out VLC, I was thinking of setting up Red5 to stream videos, since I have worked with it before to stream video and audio for XMPP (Instant Messaging), but since VLC does the job really well and is so easy to set up, I’m sticking to that for now.