This article is very very old (2002). I haven't been doing video work in a while. This can give you an overview to the process, but is not likely to be useful for the technical details anymore. If I ever do need to do this again (not completely out of the question) I'll produce and updated version.
For a project I was recently doing I needed to do a bunch of video processing. Since I was in the mood for a challenge(and the fact that the software to do the project with MacOS was on order still) I went ahead and figured out how to do it all with Linux. Let me start out by noting that I am in no way a complete expert on this subject. There are A LOT of projects related to video and linux. And many of them are under heavy development. This is meant more as a brief overview to the process of mangling and encoding video under linux.
So to start we're going to take a little romp through some of the various pieces of hardware and software that can be used to edit/encode video with linux. Then we will follow up with a quick course on producing movies from production to distribution(and all point in between).
Editing will not be covered in great detail, but the available software will be discussed. Editing could be covered as a topic on it's own(as many others can too). So it will be left to more detail when more time permits.
Hardware and Software
Firewire and the DV format have made the process of making movies with a computer significantly easier. Before you needed a whole collection of hardware, like video capture cards, lots of cables and adapters, and a giant pile of other bits and pieces. Firewire has reduced it to 3 things. Your computer, a firewire capable camera, and a 6-pin -> 4-pin firewire cable. With those 5 things(3 things sir) you could produce a documentary without too much trouble(we are not going to take into account the "creative" end of things.)
Of course there's a small problem there. You probablly want to give that movie you make to someone else. So if they don't have a miniDV player you have to give them a VHS cassette or something. Unfortunately outputting to VHS require some kind of hardware output device. Thankfully we have video CD(VCD) something that any CDROM drive can read.
Hardware (that we are using)
- MiniDV Camera - A run of the mill digital video camera. You can pick one up at "The Good Guys" for ~$350 last time I checked. The only requirement is that it provide a minidv output plug(aka 4-pin firewire).
- Firewire ports - Firewire now comes built in on most macs and pci cards can be bought for ~$50 for a PC. It's pretty much plug and pray now. Linux has support for any OHCI(open host control interface, the firewire hardware implementation standard) compliant firewire board, as well as some manufacturer specific ones(although not all firewire features are supported.)
- CD/DVD Burner - Everyone know what this is. (I hope. ;-))
Hardware (that you could use)
- Conventional Video Camera - You know the kind. It has some RCA plugs for outputting audio and video and it uses Hi-8(or VHS if you're really old school) tape. As long as it has an output you're set.
- Video Capture Board - A piece of hardware for taking analog video signals and converting them to computer formated video in some format(usually mpeg-1 or raw avi). There are quite a number that work with linux. Just check out the video4linux project website.
Software (that we are using)
- Linux Firewire Drivers (and associated userspace tools) - If you don't have firewire hard disks you can just use the one that comes with the 2.4.x kernel. Otherwise you'll need to grab the latest version out of CVS. There are probably other fixes in the CVS version as well, but I haven't run across them. You'll also need libraw1394 and libavc1394 to handle the incoming data and to control the camera respectively. There are debian packages for all the user space libraries.
- dvgrab - This is a command line tool for pulling data into your computer from the camera. It has very simple opperation and I fell in love with it's auto split feature while capturing 5 tapes worth of footage. (You can set it to make a new file every time it sees a "record" mark on the tape.) The code for this is also built into kino and provides its capture facilities.
- mjpegtools - A collection of utilities for dealing with mjpeg movies(and DV as well from the CVS tree). This collection inclues an mpeg-2 encoder, and mp2(mpeg-1 layer 2) encoder, a dv to yuv format converter, and a dv audio stripping program. (There is also a multiplexer(basically it interlaces an audio and video files data for streaming playback) but I've been using a different one.
- kino - A simple video editor with vi key bindings being developed by the same guy as dvgrab. Provides basic editing functionality. nothing fancy(yet), and as yet quite unfinished. But it will do simple stuff.
- cdrdao - Cdrdao records audio or data CD-Rs in disk-at- once (DAO) mode based on a textual description of the CD contents. [blatently stolen from the site] For this exercise it isn't really necessary to understand what it is as much as know that you need it. the vcdtools make using it trivial.
- vcdtools - 2 utilities mkvcdfs and vcdmplex. vcdmplex takes a mpeg-1 movie and a mpeg-1 layer 2 video and multiplexes them. mkvcdfs will then take the resulting mpeg and make a disk image and a table of contents that you can pass to cdrdao. note: sorry about the lack of a link this package doesn't seem to be supported anymore
Software (that you could use)
- Blender - While blender is not free software(or open source for that matter) it does provide some decent video sequencing facilities with its sequence editor. (You would be amazed at how much is in this 2MB download.) It also provides some rudimentary fades and such. (so if you wanted some of those kinds of things you could do them in blender and then pull the changes back into kino.)
- Broadcast 2000 - Broadcast 2000 is a fairly full featured editor. But it has an interface from hell. I might be willing to do more on this if I get the time to play with it some more. (I really need the time to sit down and learn how to use it. But from the description on the site it sounds like a fairly full featured editor.) The author of broadcast 2000 was working on the next version called Cinelera but due to the downturn in the tech industry he lost his job and has ceased working on it.
- video4linux - These are the drivers that you would need if you aren't using Firewire. These provide a generic interface to a large collection of video capture hardware.
- VCDImager -A more complex collection of tools that provide a much more robust way of generating VCD tables of contents and other things necessary to producing VCDs.
That does it for the software and hardware. So now we can get on with what you really want to know.
Setting up the Computer
The assumption being made is that you(as a linux user) already know how to do a couple things. One is how to reconfigure and recompile your kernel. The other is that you are either a) able to compile code from sources or b) are willing to trust some random people that the binaries they are providing are safe to run. After that it should be smooth sailing. Note: Debian users should note that almost all of the tools necessary for making movies are available as .deb packages. The only problem is that the latest version of the software are not always available. so if you have a problem you will have to revert to compiling packages by hand.
Let's start with kernel configuration. You will need to add support for firewire to your kernel. You can either use the drivers that come with the 2.4 series or you can download the latest versions of the drivers from CVS on the linux1394 site. Depending on your firewire needs you can make this decision on your own. (if you need to use a firewire harddrive you need the CVS version.)
After you get the kernel drivers installed you will need to get the user space half of the driver. It is comprised of libraw1394, a library for providing access to the raw data coming into(or going out) of the firewire port, and libavc1394, which provides control over camera's and such.
The next step is to install all the applications.
- mjpegtools(CVS version)
The websites for these tools have more specific information about their installation. A lot of the video tools don't follow the standard configure; make; make install process. But it's not too bad.
Overview of the Entire Process
Making movies is pretty easy.
Maybe not quite as easy as hunting ("You just stand there looking cute, and when something moves you shoot" Tom Lehrer) but pretty easy. While you do need some equipment digital video has greatly reduced the amount you need.
The rest of this paper is going to take you on a walk through the various processes of making a movie using linux. We will start our tour with actually shooting the movie. Then we will move to getting it into the computer. After that we will talk about editand. And lastly about encoding and VCD production(these are combined since they depend on each other.
Production - making the movie
This is going to basically just state a couple simple rules.
Good sound is half the battle. If you can afford the time and have the equipment get as much of the sound as you can "for real". A lot of movies "loop"(aka ADR aka recording lines in a studio after the movie has finished shooting) dialog. The chances of making this sound better than the real thing aren't so good. (and often doing it isn't practical for the home studio.) Also a decent microphone in the right position will go a long way. But here's a fun fact... When shooting Batman Returns(you remeber that one don't you) only 5% of the sound in the film was actually recorded on the set. The entire film was looped. Why? Because between the sound of the air conditioning to keep the penguins cold and the squeaking of the bat/cat suits the sound was completely unusable. What about that last 5%? That was all the talking at the "press conference" podium in front of a sea of microphones.
There is a lot to be said for steady camera work. If you are doing something where keeping the camera stationary would really be of benefit get a tripod and use it. Also lighting can make a huge difference. If conditions/time permit spend some time adjusting the exposure on your camera to match the light levels. Your image will be less washed out and that will produce a better looking image once compression is applied.
Capture - getting the movie onto the computer
There's a lot to be said for GUIs, but give me a program with a nice CLI interface anyday. dvgrab is THE program for doing batch video captures under linux. It supports an auto split feature that allows you to break up your incoming video depending on several conditions. In one mode it breaks the video up based on frames. You specify how many frames you want in each file and it does it. Another is "record mark" spliting. DV camera's put markers onto the tape when ever the record button is pressed. This makes it easy to break up a video by "takes". The last if size splitting. dvgrab makes sure that none of your files exceed 1GByte. This is it's default mode and it will fall back if you have a really long take. This is a left over from when the 2GB limit on file sizes was more prevalent.
dvgrab also supports several output formats. 2 are for use and one is for testing. The 2 for use are the DV 1 and DV 2 AVI formats. I tend to use the DV 2 format since it can be moved to other systems(like windows or macos) if you need to share data. (as I'll mention again editing under linux is still in its early stages. it can be done, but sometimes you just want something like iMovie or Final Cut Pro.)
So the basic usage is as follows:
dvgrab --autosplit --format dv2 <filename>
What that tells dvgrab
is to start capturing from the firewire bus and put the data into files with
I think dvgrab combined with a firewire device control utility and an analog to minidv converter box(sony sells one for ~$300 combined with a little script to setup record times and manage post precessing of the resulting data could be put together to create a TiVO like device. Though I'm not sure if it would be cost effective.
Post - editing the movie
Produce - encoding and burning
Information about encoding. formats, codecs, standards, vcd, svcd depends on the bitrate/size. at vcd resolution(mpeg-1 ~1000Kb/sec 540x480) about 1.5 hours. (you can basically fit a movie on a 99-minute(still havn't figured out where to get these) CDROM) After you have your edited movie the next step is to encode it. Encoding is a 3 step process. First you take your output from kino and strip out the video and encode it as an MPEG-1 movie:
lav2yuv -I 1 <avifile> | mpeg2enc -o <outputfile>.m1v
Next you strip out the audio and encode it as MPEG-1 Layer II audio:
lav2wav <avifile> | mp2enc -V -o <outputfile>.mp2
The last step in the encoding process is to recombine the audio and video into a single mpeg stream. This is done with a multiplexer. Basically it takes the two MPEG movies and interlaces them to allow it to play back as a stream.
vcdmplex <outputfile>.m1v <outputfile>.mp2 <multiplexedfile>.mpeg
The last thing to do is burn your movie to a cd. But before you can do that you have to prepare the movie(or movies if you have more than one) to be burned. There is a simple utility called mkvcdfs that makes this really easy. You pass it a list of mpegs and it generates a disk image and the acompanyieng table of contents(toc) for use with cdrdao. You run it like this:
mkvcdfs <multiplexedfile>.mpeg [<more mpegs>]...
Now all that left to do is burn it to a cd. This is done using cdrdao. [I need to learn what this does BEFORE I give a demonstration.] But all you have to do is tell it where to write(same as the device id in cdrecord) and the name of the toc file that you got from mkvcdfs and it will do the rest.
cdrdao --device 0,0,0 write vcd.toc
after that finishes you should have a nice shiny new video cd. (Or a coaster. ;-)