Brent's Homepage

Streaming Video Signals with VideoLan Client

Using the VideoLan Client to stream video

This is just a desciption of the process that I went through to get the VideoLan Project's client (VLC) streaming out to the desktops at our schools. We are using a combination of two machines and three Hauppauge PVR 500MCE cards. The first attempts that I did at getting it to work were a little rough, so I have been working to streamline the process a bit and I think I have gotten it down to a pretty good system.

Install and update your Linux box

Sorry for you that are wanting to stream using VLC and the PVR cards on a Windows box, but this ain't happening for you. Right now VLC only supports streaming the PVR cards in Linux. Install Linux on the machine. I used Fedora Core 4 and the rest of this will work off of that assumption. If you are using something else then you probably got the ability to work out what you need to do different to get it working for you.

Upgrade the machine next. The PVR cards require certain modules for the kernel and those are tied to the kernel version that you have on the box. When you go to install those modules they will install for the current running kernel and won't upgrade. What that means is that if your machine reboots to a newer kernel after an upgrade, the modules won't be there and nothing will work. It is easiest to just go ahead and make it up to the newest kernel that is out and then make sure you get the modules for that kernel when we get there. Reboot the box and let it come up with the newest kernel. Once you are sure that it came up fine, then remove the old kernels. You can do that with some commands like this:

rpm -qa kernel kernel-smp

rpm -e <output of previous command, minus the running kernel>

This will make sure you have the latest kernel and that it is the one that is running.

Yum config and IVTV setup

To do this you are going to need to add several yum repos to your configs. Most of them can be added in the diabled state and then enabled when you need the packages from them. You will need packages from ATrpms-stable, ATrpms-testing, DAG, Freshrpms, and Extras. Rather than link you to those respective sites, I am just going to post the entries to my yum.conf:

name=Dag RPM Repository for Fedora Core 

name=Extra Fedora rpms dries - $releasever - $basearch
gpgcheck=1 enabled=0 [freshrpms] name=Freshrpms RPM Repository for Fedora Core baseurl=$releasever/$basearch/freshrpms gpgcheck=1 enabled=1 [at-stable] name=ATrpms RPM Repository for Fedora Core baseurl=$releasever/en/$basearch/at-stable/ gpgcheck=0 enabled=0 [at-testing] name=ATrpms for Fedora Core $releasever Testing baseurl=$releasever/en/$basearch/at-testing/ gpgcheck=0 enabled=0

You might notice that I have the enabled. This is because I use packages from there a lot and I trust Matthias. To say that I don't trust Dag is false, he just isn't making packages for FC4 right now. Personally, I don't trust the ATrpms packages, but that is pretty much just a philosophical problem that I have with Axel. He replaces a lot of "core" packages and just put some stuff in his packages that I don't agree with, as we will see in a minute.

Axel does do one nice thing in that he has a package that contains all the GPG keys for these repos. To get them do a:

yum install atrpms

This package is at best a meta package containing GPG keys and some config changes and at worst a fscking annoyance. You will get a bunch of stuff from that package, some of it good some of it bad. There are a couple things you want to do now though. It installs a program called "check4updates" that is a really crappy version of the yum service that you can enable on Fedora. The first thing to do is:

rm /etc/cron.daily/0check4updates

rm /etc/sysconfig/check4updates

You have now removed that particular insanity. It is a good thing to import the GPG keys that the package provides. These can be imported using rpm:

rpm --import /usr/share/atrpms/RPM-GPG-KEY.*

To see everything that is in this package you can use:

rpm -q --filesbypkg atrpms

This will give you a list of everything that is installed by the package and you can use and remove whatever you want. It is important that you don't just remove this package though since yum doesn't like to have broken deps in the rpms database and it will work to fix them, no matter how distructive that may or may not be. The next step is to start installing the ivtv stuff on the box. The first thing you need to do is find out what kernel you are running.

First we need to get the kernel modules that match your running kernel. Before you do this make sure you are on the kernel that you want to be on. Most likely you are wanting to be on the newest Fedora kernel, so if you haven't already do the reboots that I mentioned before. Then you should be able to use this command to get the modules for your running kernel:

yum --enablerepo=at-testing install ivtv-kmdl-`uname -r`

The uname command will just make sure that the current kernel name is in there correctly. The packages at 'at-rpms' are keyed off of Fedora kernel names, so if you have recompiled a custom kernel or anything you may have to look at Axel's site folder for ivtv and find the line that you need. Once that downloads and installs then continue on with the rest of the ivtv install

yum --enablerepo="at-testing" install ivtv
yum --enablerepo="at-stable" install ivtv-firmware-audio

This should get you all the ivtv stuff and its dependencies.

Now we need to add the modprobe.conf entries. I took these from the Fedora MythTV Install Guide and they have worked good for me. Add the following lines to /etc/modprobe.conf:

# ivtv (PVR-500MCE)
alias char-major-81 videodev
alias char-major-81-0 ivtv
alias char-major-81-1 ivtv
alias tveeprom tveeprom-ivtv
alias tuner tuner-ivtv
alias msp3400 msp3400-ivtv

Now run:

# /sbin/depmod -ae
# /sbin/modprobe ivtv

If it runs cleanly, then chances are that you are good to go. I would go ahead and drop that modprobe ivtv line into /etc/rc.local and reboot. I am a big fan of a reboot here. As near as I can tell there are some firmware things that get loaded and a reboot here really helps that all work correctly.

Rebuilding VideoLan Client with PVR Support

OK so assuming all went well in the previous section we are now ready to rebuild and install VLC. I like to work with RPMs when I can so I would head to and grab the source rpm for VLC. You will also need rpmbuild installed. You can do that with yum if you don't have it. Remember even though the executable is rpmbuild the package is called rpm-build. I don't know what that is all about. Once you get that source rpm installed you can try using my modified spec file. If that doesn't work, then you just need to add '--enable-pvr' to the configure section for VLC in the spec. (Be careful, because there are two configure sections. It is the second one.) Most likely you don't have all the dependencies to build the package so you will need to install those with yum. Here is what my yum command looks like:

yum --enablerepo=dries install gcc-c++ \
XFree86-devel \
libpng-devel \
libxml2-devel \
libgcrypt-devel \
gnutls-devel \
libdvdread-devel \
libdvdnav-devel \
libdvbpsi-devel \
libogg-devel \
libebml-devel \
libmatroska-devel \
libmodplug-devel \
libmad-devel \
libid3tag-devel \
lame-devel \
faac-devel \
faad2-devel \
a52dec-devel \
flac-devel \
mpeg2dec-devel \
libvorbis-devel \
speex-devel \
libtheora-devel \
SDL-devel \
fribidi-devel \
aalib-devel \
libcaca-devel \
esound-devel \
arts-devel \
alsa-lib-devel \
wxGTK-devel \
xosd-devel \
lirc-devel \

That might get them all. Once you get vlc built then you can install the package that is built (usually in /usr/src/redhat/RPMS/i386/) using the really nifty:

yum localinstall <path to rpm>

That command should pull in all the packages needed to install your new vlc package.

Using VLC as a streamer

Before you can really get to working with VLC you need to setup your PVR cards to the inputs and channels that you need. To this kind of changing there are a couple programs that you want to use. The first is "ivtvctl", using this you can control pretty much all aspects of the card. I would actually say that it has too much power. In the cases where you don't want to have that much power there are two programs called, "" and "". These programs aren't located in your path so you have to put the full path to them. They are located in "/usr/lib/ivtv/". To change the input that is on the card, the best way is to use:

ivtvctl -d /dev/video0 -p 0 

This will set the tuner located at video0 to the S-Video port. If you want to use the composite then set it to 2 and if you want to use the coax set it to 6. If you want to see what all the options are, then replace the -p with a -n and it will show you. There are a lot of other options that you can muck with, but I didn't have to. If you are using anything but the coax tuner then you should be done. If you are using the coax the most likely you will need to set the channel you want to stream. The easiest way to do that in my opinion is using the "" interface:

/usr/lib/ivtv/ --channel 6 --input /dev/video0

Obviously change the channel number to the one that you want. "" has a lot of options that you might want to monkey with, but I didn't have to. If you want to change settings on the card on the you can use the GUI version of called
Now you should be able to run vlc from the command line and get a nice GUI. Click on the file option and select "Open Capture Device". You should see a PVR tab. This is where you want to work now. Most likely you want to work with /dev/video0 and then you are going to want to click the stream option and muck with the settings there for what you want to get done. When you are done messing with your encoding options and variables, note the top of the dialog which shows you the options. You will need these if you plan to build a command line that will run VLC without the GUI. My command line looks like this:

vlc -I http --http-host  \
pvr:/dev/video0:norm=ntsc:size=720x480:bitrate=3000000:maxbitrate=4000000 --cr-average 1000 \
--sout '#transcode{vcodec=mp4v,vb=2048,scale=0.5}:\
duplicate{dst=std{access=http,mux=ts,url=}}' &

Yes that is a pretty big mess, but once you start to learn how it works, it isn't too bad. The "-I" option with http after it tells vlc not to use the gui but instead starts a webserver and hosts it on port 8075. The rest of it is a mess that passes all the options to the encoder and everything. For more info about it hit the VLC documentation pages.

Finishing Up

So once every thing is lined out, if you want the box to do this at boot up, then you need to put this stuff into the start up. I just make a script and called it from /etc/rc.local
Mainly, my script just calls "modprobe ivtv" then the commands to get the cards on the correct inputs and channels, and last I call vlc with the options that I want it to have. Make sure to put the '&' at the end so that each command will pass control back so that the machine will continue to boot correctly.

version 1.4 edited 9/6/05
Contact Us | ©2005 Pico Computing