There are several choices under Linux on how one goes about getting
the video signal recorded into a digital format on the hard drive:
- Analog Capture
- Video4Linux drivers and software with a supported analog capture card
- Video4Linux2 drivers and software with a supported analog capture card
- Braodcast 2000 appears to support other analog capture devices which may have their own drivers in addition to the V4L and V4L2 ones mentioned above. I haven't tried this yet and can't comment further.
- IEEE 1394 drivers and software with supported hardware
- Rip of DVD and conversion to a codec other utilities understand (this
doesn't really interest me personally, and doesn't really constitute capture per se, but I
mention it as it is something others seem to be interested in)
For purpose of this project I used the IEEE 1394 interface, which requires the following be installed:
- IEEE 1394 Linux kernel drivers (I used 2.4.x of the kernel, but 2.2.x works as well)
- Libraw1394 - Free library required by dvgrab 0.89
- dvgrab 0.89 capture utility, Free Software
I have used both a Sony TRV-900 cam corder (no pass-through, requires you to record to tape first,
then capture from the digitally recorded tape) and a Sony DVMC-DA2 Media Converter (which does pass
analog straight through to firewire with no intermediate recording step required). Connect whatever hardware you
are using to your host adapter (a list of supported hardware is here).
Once the drivers and libraries are installed (and you've booted a kernel capable of loading the drivers),
you'll need to create the raw1394 device if it doesn't already exist (the docs don't tell you how to do this, but a quick look at the
source code reveals the device MAJOR number required. If you're using devfs this step isn't necessary):
mknod -m 666 /dev/raw1394 c 171 0
Then, load the necessary device drivers:
Now the system is ready to grab. Create an empty directory on a disk with enough room for the capture
(Around 10GB per hour of video). cd into that directory and, when you're ready to begin recording,
run the following command:
dvgrab --autosplit --frames 5400 filename
This will create a bunch of three minute clips named filename001, filename002, and so on.
When you've recorded all you want to, simply control-c out of dvgrab. I recommend starting your recording
a minute or two early, and ending it a minute or so after your certain you've gotten everything. This way
you can be sure to have captured everything you need, and you can clip off the extraneous stuff using
your NLE software.
The reason I create such short clips is twofold: one, because I find 3-4 minutes a manageable size to work
with, particularly when selecting video clips from within MainActor or whatever NLE program I am using, and
second, because even though I run 2.4.x of the linux kernel and use filesystems which support large file
sizes, most software (Broadcast 2000 is a happy exception) under Linux still has
trouble with filesizes greater than 2 GB. This includes some of the utilities
I mention below, which are needed to convert the results to DivX. I should mention that MainActor
is capable of reading and writing files up to 4 GB in size (I suspect they may be using an
unsigned int as an argument to lseek(), which strictly speaking isn't correct, though it does appear to
double the filesize limit), but I was unable to use these larger files with any other
playback or conversion utilities. dvgrab enforces a filelimit size of around 1 GB
Once you've captured the material you want, you have several choices for doing
NLE under Linux. Of those, I have tried:
- MainActor 3.55 - Easy to use, commercial software, costs about $100
- Broadcast 2000 - Free Software, doesn't have the filesize limitations everything else seems to suffer from, requires 2.4.x
- Kino - Free Software, as rudimentary DV-out capabilities, early in its development cycle.
In my experience MainActor
is the easiest to get started with, but it does have some bugs (a new version is due out
any day, however, but in the meantime, save your work early and often,
just like you would under Windows), and it is commercial software.
The demo is completely functional, but it plasters the MainActor
Watermark all over your output until you pay for it and enter a key
they email to you. Broadcast 2000 appears to be very promising, but I
was unable to get the old version to load my DV AVIs. Downloading
and trying out the new version is high on my list of things to do.
If using MainActor, start the NLE with the following command:
Once you've edited your material to your liking, be sure to save it in
a format other Linux utilities understand. If it is something I care about
I keep a master in DV Format, which I either burn to CD-R or output back
to DV (I haven't done the latter under Linux yet). However, avifile and
its associated utilities don't grok DV, so I also save the material in
a set of temporary files in MJPEG AVI format (720x480 resolution, default
quality settings in Main Actor).
Again, filesize is important. MainActor can read and store files up to
4 GB in size -- I think they use an unsigned integer with lseek() -- but
almost any other Linux utility (Broadcast2000 possibly excepted) will
choke on anything larger than 2 GB in size, so be sure to keep your clips
under 2 GB! I generally use files of about 1 GB in size, which means a
42 minute TV program will require 3-4 MJPEG AVI files. Since these files
are temporary anyway, so this is only a minor inconvenience.
Converting to DivX
You will need the following in order to convert your MJPEG AVIs to
- avifile 0.53.4 - free software, allows linux apps to use WIN32 video codecs
- Morgan Multimedia MJPEG codec - commercial, costs $20, demo copy works great but has expiry date
- x2divx - free software, include avi2divx and mpeg2divx, requires avifile
Once the software is installed (don't forget to install the codecs in /usr/lib/win32 !!) you are ready to convert your work to DivX format! avi2divx takes a list of avi files and writes the DivX output to the last filename in the list (so
don't screw up and forget to name an output file or you'll find the last file in your list overwritten). The command
I use looks like this:
avi2divx -b 6000 mjpeg-01.avi mjpeg-02.avi ... mjpeg-nn.avi divx.avi
This instructs avi2divx to create a DivX file named divx.avi
(using the slow codec, which in my experience usually yields better results)
with a bitrate of 6000 using files mjpeg-01.avi through mjpeg-nn.avi
An example created using this procedure (the credits sequence to Star Trek Voyager) can
be downloaded here (2 Minutes: approx. 20 MB).
The result for a 42 minute television show will be a file around 460 MB in size, which you can then burn to CD-R.
Finally, you'll want to be able to playback your DivX videos. There are
a number of players out there that do the trick, but the two I've had the
best luck with are:
- avi-xmms plugin - works great with the right hardware and XFree drivers (e.g. MGA G200, G400, G450 adapters), otherwise jumpy
- xine 0.3.6 - works great on systems with fast CPUs
avi-xmms works very well on my dual PII/450 with 512 MB RAM, a Matrox G400 card, running XFree 4.0.1
on a Mandrake 7.2 system with a 2.4.x kernel. However, on a colleague's Dual PIII/733 system
with an Nvidia (using the older drivers) it was unbearably slow.
Xine 0.3.6 on the other hand was unbearable on my dual PII/450, but played back with near-perfect
smoothness on my colleague's dual PIII/733.
The most surprising thing about the 450 MB DivX file I generated was the quality. This is particularly
true if one uses one's NLE to crop the image, eliminating any "hard" edges, such as where the
image goes suddenly black on the side. There is an excellent article
on DivX quality here that gives some great tips on improving
the quality of the output. On a high resolution computer screen, such as
my colleague's SGI 1600SW Flatpanel, you will see a noticable difference between
a DivX file and DVD. However, when played at its native resolution in a window, or
displayed on a standard television screen, the difference in quality is barely discernible.
This is truly amazing, and certainly beats keeping one's video library on Hi8, VHS, VCD,
Of course, VCD and SVCD can be played back on many consumer DVD players,
something you can't do with DivX. However, there are a couple of different projects
(here and here)
that are working to change this. In the meantime, I am in the process of
putting together a small computer system that will act as my DivX and MP3
home video component, which will reside discreetly in my stereo stack between
my receiver and my VCR.
Addendum: As I was writing this, a timely thread appeared on slashdot, discussing
the two set top projects mentioned above.