Making Digital Movies on Linux

How to transform your Linux system into a digital video workshop.

To start, check out whether the digital camcorder is compatible with Linux. The short answer is, if it has an IEEE1394 connector, it probably is compatible. If you're not sure, go to, click on Compatibility and then Camera. If the camcorder is not IEEE1394-enabled, you're out of luck. Although analog video capturing still is possible and works well for many people, it is beyond the scope of this article.

Once you've established the compatibility, you need an IEEE1394 card on your computer. Most of the cheap and not-so-new cards work with Linux, but check the IEEE1394 site, looking at the Compatibility page, which has Chipset and Host Adapter tables.

You definitely need plenty of free disk space. The DV format used by IEEE1394 camcorders requires approximately 15GB for each hour (slightly variable), and you need a couple more gigabytes for processing. You don't need an extraordinarily fast hard drive to capture the movie, though. Modern hardware that easily can do 4MBps of sustained write and still have some headroom left is enough. It is highly recommended that DMA on IDE drives is enabled, if your system supports it. XFS seems to be the fastest when capturing video, but other popular filesystems work just fine.

A fast CPU isn't necessary to capture the movie from the camcorder. When you transcode the movie to another video format, however, there is no such thing as a too-fast CPU.

Necessary Software and Installation Tips

Making all the software work together is perhaps the most difficult part of this job, and the order of installation is important. Some of these applications are included in various distributions, so take a look at your Linux installation CD before downloading. If you don't find what you need on the installation CD, download all the software listed in the Resources section at the end of this article.

You definitely need an IEEE1394-enabled kernel, otherwise your IEEE1394 adapter will not work. The distribution I'm using (Red Hat 8.0) already has all the required drivers in the kernel. If your distribution does not have this, you may have to patch the kernel; see the IEEE1394 site for patches and instructions. This is the live list of IEEE1394 modules on my system:

raw1394               9208   0  (unused)
ohci1394             20076   0  (unused)
ieee1394             46988   0  [raw1394 ohci1394]

These are the relevant IEEE1394 lines from my modules.conf file. They may or may not work for you, I provide them only as a hint:

alias char-major-171 raw1394
alias ieee1394-controller ohci1394
post-install ohci1394 /sbin/insmod raw1394

The libraw1394 library is a must-have, because all IEEE1394 software is based on it. dvgrab, the command-line application that actually captures the movie, also is required. Kino, an application that can capture movies and do some preprocessing, is nice to have but not mandatory. See the IEEE1394 site for all of these applications.

If you plan to convert movies to the DivX format, you need a DivX codec. The one I'm using is the binary-only codec provided by The examples provided in this article are based on this codec. Another DivX codec is XviD, which is a free software (GPL) DivX implementation that provides good quality and speed. If you plan to use it, be aware that some command-line examples provided here might need small changes-read man transcode. Intercodec compatibility in the DivX world is good, and I'm looking forward to a not-so-distant future when I'll switch all my tools to XviD.

If you want to convert your movies to the SVCD format, you need mjpegtools, available at The application that actually converts the captured movie into a format suited for CD-burning is called transcode. Its name is quite appropriate, because to transcode means to convert from one file format to another. If you're using an RPM-based distribution, I advise you not to download and install RPM packages, due to many library and codec mismatches between systems; instead, grab the tarball and do an rpm -ta or rpmbuild -ta. These commands generate an RPM package that is perfectly suited for your system; install it instead of a ready-made package. If you install a new codec or library and transcode depends on it, you will have to rebuild transcode anyway (see

To edit your DivX AVI files and do some post-processing, I recommend using Avidemux. It is a simple yet well designed video-editing tool focused on the AVI container format. Don't be surprised to see DV AVI and DivX AVI too. The container is the same, AVI, but the content is different-different video and/or audio codecs. That's why when you say "I've got an AVI file", you are not saying much. You must specify the codec(s) to describe the file fully.

Finally, to watch the results (DivX, SVCD) and to debug the intermediary steps, you need a media player. The one I recommend is xine. It knows almost every media format, including DVD and proprietary formats, such as QuickTime, Real and Windows Media, and it has a plugin for Mozilla and the other browsers. xine has several user interfaces that are actual player applications. Some are native KDE applications, others are GNOME applications, yet others are desktop-independent, so choose one that best suits your needs.

Remember, when installing multimedia software, observe the three-step rule: codecs then libraries and applications last. This is not a very strict and rigid rule, but it is useful to keep in mind when you start installing the required software.

Setting the Stage

Do some planning prior to capturing and processing the movies, otherwise you'll end up chasing multi-GB files all over the hard drive. The following is the method I use to organize my digital workshop.

In my home directory, I create the ~/dv directory, where I keep everything: scripts, captured files and converted movies. In ~/dv, I keep a few scripts with helpful names: grab, conv-divx, conv-svcd, burn-svcd and so forth.

Every movie is a separate subdirectory in ~/dv, such as ~/dv/party. The scripts in ~/dv accept one parameter, which is the name of the movie subdirectory. For example, ./grab party to capture the movie that I've named Party, and then ./conv-divx party to convert it to DivX.

Each movie directory has a few subdirectories of its own, such as, ~/dv/party/dv to keep the captured files, ~dv/party/divx to keep the DivX files and ~dv/party/svcd to keep the SVCD files. Here's this file layout in a clearer form:

|-- burn-svcd*
|-- conv-divx*
|-- conv-svcd*
|-- grab*
`-- party/
    |-- divx/
    |-- dv/
    `-- svcd/

All of the following scripts and examples in this article assume the file layout described above.

Lights, Camera, Capture!

Load a Digital8 cassette in your camcorder. Connect the camcorder to the computer using the IEEE1394 cable. Power up the camcorder in VCR mode (to play movies) and rewind to the beginning. Now run the grab script (Listing 1) in the ~/dv directory, with the desired name of the movie directory as a parameter, such as ./grab party.

Listing 1. The grab script captures content from the camcorder to disk.

if [ ! $1 ]; then
  echo "Usage: $0 dirname"
mkdir -v ${name} || exit
pushd ${name}
mkdir -v dv || exit
pushd dv
dvgrab --autosplit --frames ${frmax} \
  --format dv2 ${name}-

This script creates a directory for your movie, creates the dv/ subdir and starts to capture the movie. It autosplits the DV AVI files to keep them small (8,000 frames is roughly equivalent to 965MB on my video gear). Another split occurs at every scene change, so some files may be shorter. See man dvgrab for details.

You must start the script before pressing the Play button on the camcorder. You must Ctrl-C the script after the camcorder finishes playing. Do not try to edit anything while capturing, because you cannot do it reliably. Simply capture the entire cassette to the PC in one session. I'll tell you how to edit things out immediately, if that's what you want to do.

If your hard drive is too slow or if you do some other disk-intensive work while capturing, which I don't recommend, some frames may be lost. In that case, dvgrab notifies you, and you have to recapture the entire movie.

You can use Kino to do some preprocessing on the DV files, usually to delete scenes. Although I do not recommend it, you also can use Kino to convert the files to another format, but better tools for that are discussed below. Also, Kino, instead of dvgrab, can be used to capture the movie, but the simplicity of the latter and the fact that it's easily scriptable make it a better tool for the job in most cases.

Transcode to SVCD

The advantage of this format is you can play SVCD disks on most existing standalone DVD players. The disadvantage is poor image quality. But, overall, SVCD is the recommended format if you plan to watch your movies on TV and not on a computer. See Listing 2 for the script conv-svcd, which performs the conversion for you.

Listing 2. conv-svcd converts the capture files to SVCD.

if [ ! $1 ]; then
  echo "Usage: $0 dirname"
#### Standard SVCD, up to 43min / 700MB CD
bitrate=""; format="4"
#### User-rate SVCD, up to 60min / 700MB CD
#### (reduce bitrate if mplex tries to split file)
# bitrate="-w 1580"; format="5"
pushd ${name}
mkdir -v svcd || exit
pushd svcd
transcode -i ../dv \
  -V -B 0,15,16 ${bitrate} \
  -F ${format},"-a 2 -I 1 -S ${maxfs}" \
  -b 128 -E 44100 -J resample \
  -y mpeg2enc,mp2enc -o ${name} \
  --print_status 10
mplex -f ${format} -o ${name}.mpg ${name}.m2v \
vcdimager -t svcd --add-dir=SEGMENT \

To understand the transcode parameters, please read man transcode. I also provide a brief explanation here. The parameters on the first line of Listing 2 (-i ../dv) are related to the input. transcode can take a whole directory as input, provided that all files are similar.

The second and third lines describe the processing of the video stream. The image size in the original DV video stream, in NTSC format, is 720 × 480 pixels; the pixels are not square, so the DV image corresponds to only 640 × 480 pixels-a player must rescale it on the fly. The default SVCD image size in NTSC is 480 × 480, also with non-square pixels; it corresponds to an on-the-fly rescaled image of 640 × 480. So, we need to rescale the image from 720 × 480 to 480 × 480 and that's what the -B 0,15,16 input does. It rescales 0 × 16 pixels on the vertical size (0, no rescaling) and 15 × 16 pixels on the horizontal size (that's 240).

The -F parameter uses double quotes to pass parameters to mpeg2enc (see man mpeg2enc), which is an mjpegtools utility used by transcode to generate the output MPEG-2 stream. Literally, -F 4 means generate SVCD compliant video, and -F 5 means generate something close to SVCD but not exactly.

The fourth transcode line contains parameters related to sound processing. The fifth line specifies the output codecs and the output filenames.

The result of running transcode is a couple of files: the video stream and the audio stream that you need to combine into a single MPEG2 file. mplex, the next command in the script, does that and creates an .mpg file (the SVCD-compliant MPEG2 file). Verify the MPEG file with xine before burning the CD.

In the end, vcdimager takes the MPEG file and creates a CD image in SVCD format that is ready to be burned onto a blank CD. The CD burning is shown in Listing 3, the burn-svcd script.

Listing 3. burn-svcd burns SVCD video to standard CD-R media.

if [ ! $1 ]; then
  echo "Usage: $0 dirname"
speed="32"        # change to match your CD-writer
dev="0,0,0"       # change to match your CD-writer
drv="generic-mmc" # change to match your CD-writer
pushd ${name}
pushd svcd
# you may need to add sudo before cdrdao
cdrdao write --device ${dev} --driver ${drv} \
  --keepimage --speed ${speed} -v 1 videocd.cue

With the indicated parameters, you can create standard SVCD disks. If you use 700MB blank CDs, which are better than 650MB for video, you can store up to 43 minutes of video on one disk. If you use 30-minute DV cassettes (like I do), that's okay, but if you use the popular 60-minute cassettes, you might have a problem.

Three methods are possible for dealing with the time issue. One solution is to split the movie into two pieces and burn them on separate CDs. To do that, you can split the DV files before running transcode and process them in two batches. This is the method I prefer. The second solution is to generate nonstandard SVCDs by reducing the video bitrate. Simply uncomment the other parameters in the conv-svcd script (User-rate instead of Standard). Image quality decreases dramatically, however, and the SVCD may be less compatible with some standalone DVD players. In the third method, you still would generate standard SVCD. Instead of reducing the bitrate, though, you would use the auto-split capabilities of mpeg2enc and mplex to generate multiple SVCDs from one 60-minute cassette. See the documentation; I won't discuss this method here.

Be aware; the SVCD disks are written in a way that is different from the classic ISO9660 CDs-the disk sector is larger. So a 700MB blank CD can accept up to 793MB when written in SVCD format, the size of the videocd.bin file created by vcdimager.

conv-svcd generates interlaced SVCD material, which means the movie will look funny when watched on a computer (rapidly moving objects will "grow hair" horizontally). But if you watch the movie on a TV, the way the SVCDs should be watched, it actually will look better if you leave it interlaced. TV displays, as opposed to computers, already are interlaced and display interlaced movies better.

In theory, this script should work without changes for NTSC material (North America) and PAL (Europe), but it was tested mainly with NTSC. If there are any problems with PAL, go to, and click on VCD/(S)VCD/DVD under Examples.

Transcode to DivX

If you plan to watch movies mostly on a computer display, use DivX as a destination format. This format has the advantage of better image quality at the same file size. However, you are not able to play these movies on classic standalone DVD players. See Listing 4 for the conv-divx script. There are a few differences from Listing 2.

Listing 4. conv-divx transcodes to DiVX.

if [ ! $1 ]; then
  echo "Usage: $0 dirname"
################### NTSC ###################
#### 700MB / 30min, 720x480 --> 640x480 ####
bitrate="2900"; rescale="0,5,16"
#### 700MB / 60min, 720x480 --> 448x336 ####
# bitrate="1400"; rescale="9,17,16"
#################### PAL ###################
#### 700MB / 30min, 720x576 --> 640x480 ####
# bitrate="2900"; rescale="6,5,16"
#### 700MB / 60min, 720x576 --> 448x336 ####
# bitrate="1400"; rescale="15,17,16"
pushd ${name}
mkdir -v divx || exit
pushd divx
transcode -i ../dv \
  -w ${bitrate} -k -z -B ${rescale} -R 1 \
  -J smartdeinter=diffmode=2:highq=1:cubic=1 \
  -y divx5,null -o /dev/null \
  --print_status 10
transcode -i ../dv \
  -w ${bitrate} -k -z -B ${rescale} -R 2 \
  -J smartdeinter=diffmode=2:highq=1:cubic=1 \
  -b 128,0,0 \
  -y divx5 -o ${name}.avi \
  --print_status 10

Transcoding the video is performed in two steps. In the first step, the video codec (DivX) makes some notes in a temporary file. The actual video stream is generated during the second step, based on the notes made previously. The audio stream is transcoded only during the second step. The two-step technique is used to improve image quality.

The image then is de-interlaced using the smartdeinter filter. However, this really slows down the transcoding process. If you think it's too slow, and you can live with a small decrease in quality, use -J smartdeinter (no diffmode or other subparameters) and see what happens.

The -k and -z parameters are required for my camcorder, but they may not be the right thing for yours. Consult man transcode, and read about -l in case you need it.

The bitrate (2,900kbps) and image size are fine-tuned to fill a 700MB CD with a 30-minute movie, while yielding a near-DVD quality file. This is what I prefer when using DivX.

If you use 60-minute cassettes, you can split the final AVI (see below) and burn it onto two CDs. Or, you can use the commented $bitrate and $rescale values, which lower the video bitrate and also reduce the final image size. If you don't reduce the image size when you reduce the bitrate significantly, your movie becomes bit-deprived and looks smudged and foggy. Those of you using the PAL format should enable the other parameters in the script (the PAL group).

If you want to edit, split or process the DivX AVI afterwards, you can do so with Avidemux. The application is quite easy to use. One thing to remember: if you split an AVI into multiple pieces, each piece from the second to the last must begin at a keyframe; otherwise the quality of the image will suffer. Avidemux provides an easy way to find and mark keyframes. Also, see the avisplit and avimerge utilities in the transcode package.

After everything's finished, you can burn your DivX AVIs onto normal CDs. To create an ISO9660 image, write it onto a blank CD. This is common knowledge, so I won't provide the details.

What, No DVD?

Although transcode can create DVD-compliant MPEG-2, and although some Linux applications can use some DVD writers, the free DVD tools for Linux are not quite mature yet. It's doable, and you can generate some simple DVD content, but there are no bells and whistles. If you want to experiment, see and


Avidemux-graphical video processing application (can process DivX AVI files):

Binary-Only DivX Codec (not needed for SVCD):

cdrecord-prodvd-another DVD recording tool:

dvdrtools-create and write DVDs on Linux:

Image Aspect Ratio Quick Guide:

Information about various image sizes:

Lame-MP3 codec and tools (required for DivX only):

libdv-digital8/DV library (required by transcode):

MAD-MP3 decoder (required by Avidemux):

mjpegtools-powerful tools to process MPEG-2 and other media formats (required for SVCD only):

Open-source DivX codec (not needed for SVCD):

The Ultimate Resource for IEEE1394 on Linux:

transcode-complex and powerful multimedia processing application:

vcdimager-create and analyze VCD and SVCD disk images (use v0.7.12 or later):

xine-feature-rich multimedia player:

Florin Andrei is a senior network analyst with the network security team at SGI (Silicon Graphics). He lives with his wife and son in Mountain View, California. He's been a Linux enthusiast since the days when all the Linux install kits came on floppies.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Making Digital Movies on Linux

Anonymous's picture

To round this off nicely there are DivX playing DVD players available. I have two, one is an XMS-888, the other is a Trio DS-628. Both available @ Strathfield (Brisbane Car Sound) in Australia and both under A$200 - The play my mencoder encoded DivXs perfectly. They also have updateable firmware (you will have to do this at least on the XMS for better codec support and sub 128kbps sound support)

So now you can make your movies, DivX encode them, and then play them on you new DVD player !

. . . Sweet !

LiVES - Linux Video Editing System

Anonymous's picture

Sorry, I posted this as a reply to another message by mistake.
Anyway, just a plug for LiVES, the Linux Video Editing System.

Please check it out !

Distro that includes these applications: BLAG

Anonymous's picture

The BLAG Linux And GNU distribution has the applications listed in this article, if you don't want to compile them yourself. It's all on one CD too.

ISOs are available a long with a list of included audio/video applications.

The RPMs will also work on top of RedHat 9, if you're running that.

Some additional links...

Anonymous's picture

If your working with video on Linux, you may also want to consider:

Kino - GUI tool for dv capture and transcoding, with some simple editing capibility. Kino is from the same folks who brought us dvgrab (mentioned in the article)

Cinelerra - mentioned in an above comment. Advanced video editing tool, but not very intuitive. There's a steep learning curve with Cinelerra, but it is free software.

Main Actor - also a video editor. This a popular and easy to use alternative to Cinelerra. Main Actor isn't free as in freedom, but it does have a free beer Linux preview release. You just need to download and install the RPM to install it. There are also instructions on how to get it running on Debian.

Linux Video Editing tutorials - contains tutorials on how to get up and running with Kino and Cinelerra to capture, encode, and edit video from a Digital Video camera. Very good resource!

Re: Some additional links...

Anonymous's picture

Here's another link:

LiVES - the Linux Video Editing System

The best video editor for Linux !!

Corrections/additions to the article

florin's picture

Hi, this is the author. :-)
While the article was fairly up-to-date at the time when it was written, that actually happened a while ago. So some of the things mentioned are slightly outdated now.

The applications evolved, so the optimal parameters are slightly different here and there. The indicated parameters still work, however some apps figured out ways to do things a little bit better.

The transcode main website changed address, it's now at But the old site is still up and running.

The biggest change since the time the article was written is that now Linux is ready for DVD authoring. There is a complete set of tools to process video material to make it compliant with the DVD standards, then author the actual DVD structure, create chapters, titles, menus, etc., then burn it into a recordable DVD. There's no GUI yet, but there's at least one project in a pre-alpha state that aims to bolt a nice interface onto the whole process.
Perhaps Video-to-DVD would be the theme of a future article. :-)

Re: Corrections/additions to the article

Anonymous's picture

Hi Florin,

as pointed out by others, you missed lot of applications that do the job such as: K3b (to burn), Mencoder (to encode), Kino (to edit DV) & Cinerella (the latest seems to be able to edit MPEG2).

Once thing I discovered lately is that there's a project called KVCD ( The site says:
1) KVCD is a modification to the standard MPEG-1 and MPEG-2 GOP structure and Quantization Matrix. It enables you to create over 120 minutes of near DVD quality video, depending on your material, on a single 80 minute CD-R/CD-RW.
2)The mpeg files created will play back in most modern standalone DVD players. You must burn the KVCD MPEG files as non-standard VCD or non-standard SVCD (depends on your player)

It's originally designed for Windows but Mencoder can do the job (see

The big advantage over MPEG4 related formats is that the burned VCD can be played on most DVD players. The drawback is the encoding time which is very long.

Please, try yourself.

Re: Making Digital Movies on Linux

Anonymous's picture

I'm doing a degree in computer animation at university, and we use Linux for just about everything. Almost all of what's been written here relates really well to what we do.

However, two other applications that I'd recommend instead of those mentioned here: firstly, as a media player, I'd suggest users look into a package called MPlayer ( . It's a media player that can handle just about any major codec in existence using Windows DLLs, and can be run from the command line or with a graphical interface. However, it's neatest feature is a tool called mencoder that comes with the main media player, which lets you encode your videos in a variety of formats (we tend to use DivX though).

The second tool I'd recommend is called Cinelerra. It's not for the faint of heart; the interface takes some getting used to. But it's the most fully featured video editor that you can find for Linux, period (the ability to be able to use our network here at the university as a renderfarm isn't without it's advantages either - what was that the author wrote about never being able to have a fast enough processor? ;-) )

Re: Making Digital Movies on Linux

Anonymous's picture

I too use mencoder to capture, but then I don't have a digital video camera yet, only a HI-8. You mention Cinelerra, but I haven't figured out how to convert the AVI (divX4) to something that Cinelerra can read to edit. How do you do that?

Re: Making Digital Movies on Linux

Anonymous's picture

Cinelerra works with Quicktime4Linux .mov's. I haven't tested this myself, but something like the following should work:

transcode -i mydivx4avi.avi -o -y mov

Re: Making Digital Movies on Linux

Anonymous's picture

I can't believe there's no mention of Kino in this article. I found all this stuff a bit tricky to use and co-ordinate, until I moved to Gentoo. Kino is great for capturing video, scene editing, simple effects and then exporting.

I gave up trying to get DV to work in Windows 98 when I realised it was faster, simpler and more stable in Gentoo. Kino hasn't been updated for a while, but the latest (0.6.4) works great for me.

Kino is at

read the article again

Anonymous's picture

Actually, Kino really is mentioned, at the end of the dvgrab section.

Re: Making Digital Movies on Linux

florin's picture

Well, there was only so much space in the article... :-/
I choose to talk about lower-level tools on purpose, the goal of the article being to teach people as much as possible about "what happens under the hood".
But yes, there's Kino, and Cinelerra, and Avidemux, etc.

Re: Making Digital Movies on Linux

Anonymous's picture

The annoying thing is that FIRST you capture the contents with DVGRAB, and then you have the TRANSCODE phase to compress the AVI file with your favourite code (mine is xvid).
If I understood well, with DVGRAB 1.3 you can pipe the results out to transcode, so in a single pass you might capture and encode, which would so much easier .....
Btw, I am doing this (and not only: I also SEE what I am recording), with Win2000 from Hauppage when I record using WinTv (ok, not DV but still...)

Re: Making Digital Movies on Linux

florin's picture

Sure, if the duration of the process is a concern, then by all means, pipe the output all you want.
The problem is, if you make a mistake, it's a lot harder to correct it. That's why usually video processing is done in successive steps - you can go back and fix issues if something goes wrong. And often it does... :-/

Re: Making Digital Movies on Linux

Anonymous's picture

I'd like to point out that k3b is a great GUI tool that will burn SVCDs (using most of the tools above) AND DVDs (using the dvd+rw tools). I suggest that you look at their requirements page before you use it though to make sure you have all the tools installed to get the full use out of it.

Even though k3b is designed to be a KDE app, it is so useful and full featured that it's worth looking at regardless of your desktop preference. For anyone out there stuck on Easy CD Creator or Nero, k3b will blow you away.

Re: Making Digital Movies on Linux

Anonymous's picture

Well and good, but.....

If we are going to make inroads, like all linux software, it truly has to be more user friendly.

It's a start, but a slooooow one at that.

Re: Making Digital Movies on Linux

Anonymous's picture

GAH! SHUT UP! WE ALWAYS HEAR THIS CRAP FROM PEOPLE LIKE YOU!!! It's not the intent of the article!

Re: Making Digital Movies on Linux

Anonymous's picture

Please speak nice on this website

Re: Making Digital Movies on Linux

florin's picture

Well, the interface is quite good, actually.
What bites the newbie is installing applications and drivers. If that's what your complaint is, have a look at PlanetCCRMA - it's a project to make it easier for beginners to install multimedia software on Linux. It's pretty good.