Saturday, March 20, 2010

Streaming DVD over Wifi with VLC

As you maybe aware, my original intention was to build a centralized media/communication centre for home uses. I actually wanted to stream digital TV over Wifi originally until I got totally bogged down by searching for the correct TV Tuner with drivers support on BSD system. I decided to offload this task onto an Ubuntu system and work is still in progress...

That being said, readers who are interested in FreeBSD DVB-T drivers are recommended to take a look at /usr/ports/multimedia/cx88 as its pkg-descr reads:
cx88 provides drivers for PCI and PCI-e TV/radio capture cards based on the Conexant CX23880/1/2/3 and CX23885/7/8 chip families.

My second-hand Compaq comes with a Sony DVD-Rom, so instead of streaming digital TV I decided to use it for streaming DVD over Wifi as it was more easily achievable, and a quite fun experience.


















VLC is a powerful open-source media player which opens pretty much every multimedia filetypes. It runs on several OS (Windows, Linux/Unix and Mac OS) and can be configured as either a streaming server and client. http://www.videolan.org/vlc/. In fact, I had experiences of using VLC to run a corrupted media file. The player tries to compensate for the corruption so the file still plays at a lower quality...

Installing VLC
On FreeBSD, the VLC installation was actually more difficult than running the software.

While VLC website has several documents, I could not find VLC installation notes on FreeBSD system other than recommending using ports - so I went ahead with port installation only to realise there were several dependencies...

My suggested steps of VLC port installation is summarized as follows:
1. Update port collection to the latest release. (portsnap fetch extract update)
2. Prior to installing VLC, install the "libdvdcss", "libdvdnav" and "libdvdread" software packages. They are located under /usr/ports/multimedia directory.
3. Install VLC from /usr/ports/multimedia/vlc with "make clean install".

As a side note, VLC source code compilation uses "gmake" instead of "make". Source code compilation adds flexibility when it comes to configuring VLC options, for example, there is an option allowing VLC to be run by root (#./configure --enable-run-as-root). I didn't note this option was available when I did a "make config" under vlc port directory.


Streaming DVD
Having successfuly installed the vlc program, there are two steps to stream dvd. First, mount the DVD drive onto system as root user, using the following commands:
# /bin/ln -sf /dev/acd0 /dev/dvd
# /bin/chmod 666 /dev/dvd # Such that non-root user can "execute" (access) the DVD rom

Secondly, invoke VLC through CLI as non-root user:
/usr/local/bin/cvlc dvd:///dev/dvd --sout '#standard{access=http,mux=ts,dst=192.168.2.252:8080}'
In my example, I used clvc (VLC without command line) to stream DVD to 192.168.2.252:8080.

VLC comes with a http control interface. To enable this add the following to the command liine:
\ -I http --http-host 192.168.2.252:8081

Finally, if you would like to authenticate the client machine:
\ --sout-http-user user --sout-http-pwd password


For the wireless client machine, I used a HP-mini Netbook. It was running on XP with VLC installed and was connected to the AP residing on the 192.168.2/24 subnet.

The video stream was received by setting VLC player to open "network stream", protocol to "http" and entering the URL above (192.168.2.252:8080). The control interface (play, pause, fast-forward) was accessible through web-browser at the corresponding ip/port (192.168.2.252:8081).


Setting DVD Region Code
At first, when I started streaming DVD the quality was very choppy. VLC player displayed an error about unable to crack the css key. It turned out to be related to the dvd-rom's region setting. http://en.wikipedia.org/wiki/DVD_region_code
There are several small programs which can be found when googling "regionset" and "regionget" which comes as source code. These programs can read and modify the region setting of the DVD drive.
In my case, I set my dvd-rom's region to 4 (Australia) and didn't experience any video quality problem afterwards.


A note that on VLC distribution... the overall attitude of VLC developers towards distribution of their software is actually very supportive base on what I've read. However, the distribution of libdvdcss package comes with a legal warning because this software cracks the DVD encryption of region code, for more details please look at their FAQ http://www.videolan.org/support/faq.html


While it was a fun experience, in my setting today the DVD-Rom was removed because its D-style power supply cable is plugged into a T10B PCI to power my analog phone. In a separate occasion I also found a second-hand original Microsoft XBox for <$50 and now it is running XBMC. More details on these in future posts.

VLC logo's copyright note: Copyright © 1996-2009 VideoLAN. This logo or a modified version may be used or modified by anyone to refer to the VideoLAN project or any product developed by the VideoLAN team, but does not indicate endorsement by the project.



No comments:

Post a Comment