Build a Linux VCR with WebVCR+ HOWTO

By Allen Cook,

v0.2, January 2003

This document describes the required steps to set up and use a WebVCR+ installation to record videos

Table of Contents

     1.2.TV Card
2.Linux Configuration
     2.1.Kernel Configuration
     2.2.TV Card Drivers
     2.3.Sound Card Drivers
     2.4.System Clock
     2.5.Other Required Programs
3.Video Recorders
     3.2.lavrec (MJPEG tools)
     4.3.Using WebVCR+


1.1 Requirements

In order to build your own Linux VCR you need a few pieces of hardware.

A supported TV Card

A supported Sound Card

Plenty of Hard drive space

Enough processor and ram for your Video Recorder

1.2 TV Card

Any TV card that is supported under video4linux can be used with WebVCR+. Check either bttv or MjpegTools for a list of supported cards.

Linux Configuration

2.1 Kernel Configuration

Compiling your own kernel is optional, however if you want to compile youre own kernel, make sure to enable these settings. If you don't know how to compile your own kernel, check out the HOWTO here. These settings can be build as a module or built into the kernel.

Character Devices -> Real-Time Clock support - Make sure this is enabled, because an accurate clock is crucial to synchronizing your system with your cable/satellite provider.

Character Devices -> I2C Support -> I2C bit-banging Interfaces - This is required by the TV Card driver

ATA/IDE/MFM/RLL support -> IDE, ATA and ATAPI Block devices -> IDE Chipset support/bugfixes - Enable support for your particular chipset. Disk performance is crucial, especially when recording to relatively uncompressed formats such as mpeg1 or jmpeg. If your disk cannot keep up with the demand it will start to drop frames.

Multimedia Devices -> Video For Linux - This is the API used by programs under linux to grab video from the tv card, so its required.

Sound -> Sound Card Support - Required for recording sound

Sound -> OSS Sound Modules - Required if a video recorder uses OSS

2.2 TV Card Drivers

Drivers for your TV Card can be found here
Read the Mini-HOWTO for help installing the bttv drivers

2.3 Sound Card Drivers

I bet youre wondering why we didn't enable the sound card driver under the kernel configuration step? Well thats because were going to use the ALSA Drivers instead. I found with my machine the kernel drivers tended to get out of sync with the video very quickly, or crash the video recorder all together. The ALSA drivers are much more stable, especially for long term use.
Read the mini-HOWTO for help installing ALSA drivers.
Be sure to load the modules snd-pcm-oss and snd-mixer-oss to enable the oss emulation.

2.4 System Clock

Another thing that needs to be done is synchronize the system clock with your cable/satellite provider. In oder to set the clock you need to call the date command with the format


HH=Hours (24 hour or Military time)

Next call hwclock

hwclock --systohc

If you have satellite or digital cable, you can just hit the "Info" button and find the current time. Otherwise you will have to wait till a program comes on, then set your clock to the time the program was supposed to start.
If you have to be off, start recording a minute or two too early, not too late. Shows tend to start on time, and end early to allow for commercials and credits before the next program starts.

2.4 Other Required Programs

Apache - Apache was probably installed with your operating system, but if it wasnt get the rpm, binaries or source from

PHP - An installation guide for PHP can be found here.

Perl - XML::Twig - Perl is probably already installed in your system. To install XML::Twig type

perl -MCPAN -e "install XML::Twig"

at a command prompt as root

XMLTV - XMLTV is easy to install as of 5.5, and has very few perl dependencies. You can download the latest version here. Just untar the archive, then type

perl Makefile.PL
make install

at the command prompt.

Next, configure XMLTV. Type

tv_grab_na --configure
as root and follow the instructions. If you live outside of North America, replace na with uk or de, depending on what country you live in.

MySQL - You can probably install this from rpm or whatever packaging system your distribution uses, you can download binaries here.

Xawtv - The only real reason you need Xawtv is to change channels on your tv card, if the video record wont do that for you, which most of them wont. Download it at the Xawtv homepage and follow the instruction there.

Video Recorders

3.1 NVRec

Taken from the NVRec Homepage

     NVrec aims to be a high quality, generic capture core. At the moment it supports v4l1 and v4l2 devices as video sources, and oss as an audio source. It can output to quicktime (in RTjpeg, YUV2, or RAW format), AVI (in DivX format), NuppelVideo format, MPEG-1, and streaming multicast/unsicast.

     NVrec includes deep buffering to minimise frame drops, in high load situations, and a smooth framedropping algorithm to keep the video as smooth as possible if you do have to drop frames. It also has a audio "stretcher" to make sure that exactly the right amount of audio is written to the output file (this compensates for lack of clock synch between video and audio cards).

     NVrec is written in an extremely modular way, to make it easy to integrate with existing applications, or add your own output formats. NVrec requires the following programs, again taken from thier homepage

AUTOCONF a recent version (tested on 2.53) is required for newer nvrec distributions.
AUTOMAKE a recent version (tested on 1.6.1) is required for newer nvrec distributions.
DIVX4LINUX is required for DivX encoding support in DIVX4rec.
LIBMP3LAME is required for mp3 recording support in DIVX4rec.
AVIFILE is required to build the DIVX tools (currenly only version 0.5.x, 0.6.x and 0.7.x are actively supported).
These are all thats required to get divx4rec or nuvrec working, which are the two you are most likely to use. divx4rec records in realtime to divx5 format, which means you need a pretty beefy machine. nuvrec is much less compressed and therefore doesn't require as much processor and ram, however the files it produces are very large and not compatible with Windows.

NVRec gets updated regularly, and as a result has alot of nice features and works with the latest version of Divx. It does require alot of resources though, and with the constant updates things can get broken, such as deinterlacing on the current build.

3.2 lavrec

lavrec is part of the MJPEGTools project. The description on thier homepage says

     The mjpeg programs are a set of tools that can do recording of videos and playback, simple cut-and-paste editing and the MPEG compression of audio and video under Linux.

lavrec is the part of that package that records from the video4linux device (TV Card) to a MJPEG file, with uncompressed PCM audio. This means that the files are quite large, an hour for about 3 GB in my experience. You can use ffmpeg to convert them to divx5 later, however.

Get binaries in rpm, deb and other package formats here.

3.3 ffmpeg

FFMPEG is a multimedia tool for recording, converting and streaming video under Linux. In WebVCR+ you can use it to initially record the video, and also to convert the video to many formats during the time your machine is not recording.

You can download the latest version here (direct link).


4.1 WebVCR+ Setup

Now to the fun part :) Setting up WebVCR+! First, go download WebVCR+ here.

Untar the archive into a directory that is in your webserver's root, so that you can access it through your webserver. Then cd into that directory and type


as root. This will start the install process. You should be asked for a few pieces of information
MySQL hostname, root password, username and password for new WebVCR+ user
User and Group the webserver runs as
Location of your crontab
Number of days worth of listings to keep in database at one time
The day of the week to update listings
After entering all this information the script should run and your WebVCR+ should be ready to be configured.

4.2 WebVCR+ Configuration

Point your browser to http://hostname/subdirectory/config.php
Were hostname is the hostname or ip of the computer you installed it on, and subdirectory is the directory under your webserver root you installed WebVCR+ to. For instance if the IP address of my tv recording linux computer was and my subdirectory was webvcr I would go to
There are two things on this page that have to be configured first. The directory to store video is pretty self explanatory. That must be set before anything can be recorded. The other required setting is the location of your xmltv listings. Don't worry, they will be created for you in the next step, just type in a directory and filename

example: /home/pyroman/xmltv_listings.xml Click "Save" and then at the command prompt in your webvcr directory, type

as root. This will take a while, as it grabs your listings and puts them into the database. After this first time you wont have to run again manually.
Back in the web configuration you can go to "Video Recorder Configuration" to configure settings such as bitrate, quality and video recorder to use.
If you type in your own video recorder, see the "Help" next to the "Recording Program" field.

4.3 Using WebVCR+

Now click on "Now on TV". This should bring up a TV Guide like listing of channels and what is on right now. You can navigate this to record programs or add favorites. You can also use the "Station","Category" or "Name" boxes to search for programs, then record or add favorites that way.

You can use the "Movies Running Now","Movies Running Today" or "All scheduled movies" links to see any movies coming on any channel, and record them.
The "Video Library" link will give you a listing of all video files in your video directory set under "Settings". You can browse subdirectories, rename files or delete them.
The "Favorites" link gives you a list of all of the favorite programs you have set. Each favorite is recorded every time it comes on, regardless of the channel. Favorites are also processed by priority, the highest priority being at the top of the list, and lower priorities being under it. If a higher priority Favorite comes on tv during a lower priority favorite, the higher priority will override it. Favorites will override regularly recorded programs as well. See the "Help" page under Favorites for more information