Become a digital video editing guru using Linux tools


By Alex Roitman

The process consists of several steps. First, you transfer the video source material to your Linux machine (video grabbing). Next, you edit the video, possibly mixing it with other video and audio material, and then render it into an output video file. If your goal is to upload a file to the Web or share it with your computer-savvy friends, then this is the end. Sometimes, however, you want to create a DVD suitable for conventional DVD players. In those cases the final step is authoring the DVD.

Grabbing the video

Grabbing used to be a problem during the era of analog camcorders. If you are stuck with one of those, you may need to get a special card that can take analog video and digitize it. I’ll assume that you have a regular DV camera supporting the IEEE-1394 (a.k.a. FireWire) standard. Such camcorders take care of digitizing video (and audio) and giving it to you in the raw DV format.

I have had luck using both Kino and dvgrab (developed by the same project) to download video over FireWire. I prefer dvgrab as it CLI-based. The following command starts the capturing, requesting the raw DV format (no compression), auto-splitting on changing scene or reaching the size limit, limiting the file size to 100MB, and using “source_” as the prefix of the captured files.

   # dvgrab --format raw --autosplit --size 100 source_

The files will be named source_001.dv, source_002.dv, and so on. Read the dvgrab(1) man page to learn more. If you have problems, consult the Capturing DV section of the Kino User Guide.

Approaching video editing

Once you have all your source files sitting in the capture folder, what’s next? I use Cinelerra to edit the video material. It is not the most intuitive application to learn, but once you master it it will do wonders. The project provides detailed installation instructions for different distros, and excellent documentation. For a Debian user like me, installation is simple: I add the correct Cinelerra repository for my CPU, along with the Debian Multimedia repository, to my /etc/apt/sources.list file, then update and install Cinelerra.

Here is what I do. First, I start Cinelerra and create a new project (“New…” under File menu). I select the desired parameters (NTSC, but your mileage may vary) and then save this so-far empty project to a file. All your editing will be saved in this file, and none of the original source files will be modified (unless you specifically ask them to be). Cinelerra has crashed on me, but I’ve never had Cinelerra refuse to open the file afterward. Save your work frequently, and you will never lose much after a rare crash.

Next, I load all my source files for the project. In the load dialog, I select all the source files and set the “Create new resources only” option for the Insertion strategy. This will populate the Media section of the Resources window with the icons of your source files. Cinelerra will take some time to index the source files; wait until the status bar shows that this is done. If you plan to mix some additional audio into your project, load those files as well. They should show up as audio icons in your Resources window.

Combining the pieces

Click to enlarge.

Now you should be ready to start editing. The Viewer window is helpful for previewing the sources and deciding what to take. You can either drag a source file from the Resources window onto the Viewer window, or you can right-click on the source and select View from the context menu. The Viewer window has controls that allow you to play, rewind, and so on. Once you decide what are good start and stop points (a.k.a. in and out points), mark them with “[” and “]” buttons, or use keyboard shortcuts with the square brackets. If you press “v” or click the Splice button in the Viewer window now, the portion between in and out points will appear at the insertion point in the Program window, which is probably the most important window in Cinelerra.

Cinelerra offers two main editing modes: drag-and-drop and cut-and-paste (the default). To enter drag-and-drop mode, click the arrow icon on the toolbar. To get back to cut-and-paste mode, click the cursor icon on the toolbar. In cut-and-paste mode, clicking on the time bar will set the insertion point to where you clicked. The insertion point is visualized by a large blinking cursor running across all tracks, perpendicular to the timeline. When you start a new project, the timeline is empty and the insertion point is at zero. If you do not move it manually, every splice operation from the Viewer window will insert the clip and move the insertion point to the end of that clip. You may want to repeat the sequence without explicitly moving the insertion point: view the source, mark in and out points, and splice. Once you have done it a few times you should see your inserted clips on the timeline.

You can press the Home key to reposition the insertion point to the beginning of the timeline. Press the space bar and you should see the preview of your project in the Compositor window. Don’t worry if the playback quality is suboptimal. This preview is assembled on the fly and the eventual output should have much better quality than the preview. As you watch the preview, you may realize that some clips did not have their in/out points set just right. You can adjust that in the timeline by dragging the edges of each fragment.

The Interface tab of the Configuration dialog allows you to set different editing options on different mouse buttons. By default, using the first mouse button (left for the right-handed mouse) will move the in/out point inside the clip and adjust all the subsequent edits accordingly. So if your first fragment runs a bit too long, you point your mouse on it and then approach its right edge from the left. Once you see the pointer change its shape to become a handle, you press the mouse button and drag the mouse a bit to the left. The fragment should become shorter, and all next fragments should shift leftward so that there is no gap. If you see that the second fragment’s in point is too late in its source and you want to show a bit more of the immediately preceding video, approach the beginning of the fragment from the right. Once the pointer changed into the handle, drag it leftward. The fragment should become longer, without changing its starting place on the time line. All subsequent fragments should shift rightward accordingly. Once you practice with different types of such editing it becomes very easy.

Tracks, transitions and effects

A newly created NTSC project has one video and two audio tracks. You can add any number of audio and video tracks to it. Tracks can be armed or disarmed, which determines whether the track is affected by your editing operations. If you have two video tracks and only one of them is armed, any pasting or splicing will take effect only in the armed track. To change the armed status, click on the red dot icon in the control area (patch-bay) of the track.

Click to enlarge.

Separate from arming is the play track property. Tracks without the play status will not appear in the rendered output. Tracks with the play status will all be overlayed during preview and rendering. You can adjust how this is done separately for audio and video tracks. Video tracks behave like layers in the GIMP: the top is seen first, unless it is completely transparent, and so on.

You can insert transitions between your clips by dragging them from the Video Transitions section of the Resources window onto the border between clips. In Cinelerra, the transition starts at the end of the first clip and continues into the second clip. Keeping this in mind, you would probably want to allow for at least one extra second when selecting the out point in each clip. You can adjust the parameters of the transition by right-clicking on the brown transition icon and selecting from the context menu. The most common transition is the Dissolve, whose single parameter is the length.

Finally, you can add effects to your video and audio. Video effects can modify your material or add to it. A good example of an additive effect is a title. To add titles, double-click on the portion of your track that you want to add titles to, or select the desired time portion by clicking, dragging, and releasing the mouse button in the program window. Next, drag the Title icon from the Video Effects section of the Resources window onto your selection. Then click on the magnifying glass on the brown effect icon to set the parameters.

Rendering the result

Once you are happy with your project and its preview, you can get your results rendered into a single output file by using the “Render…” item under the File menu. Depending on your end goal, you may select different parameters. For making an MPEG file for subsequent DVD authoring, I recommend following this recipe. However, if all you want is the video file for watching on the computer, you may render both video and audio into the same file using Ogg Theora, QuickTime for Linux, or Microsoft AVI. Click on the wrench icon to adjust the parameters for both video and audio components. Rendering will take a while; watch the status bar to know when it is done.

Click to watch.

Authoring DVD

If you want to send your video to someone with a slow computer or low-bandwidth network connection, you can send a full-blown DVD. I use DVDStyler for authoring DVDs, which in turn uses dvdauthor. With DVDStyler you get to set up the titles, menus, and buttons for your DVD in a visual way. The result is saved into an XML file, so you can open and change it later. For details, see the project’s operation manual.

I usually use DVDStyler to produce the image of a final DVD. I then use the growisofs program from the dvd+rw-tools package to burn it on the actual disk, as many times as I need it:

   # growisofs -dvd-compat -speed=2 -Z /dev/hdc=result.iso

I tend to be on the conservative side and use 2x speed, just in case my recipient’s player is not top-notch and might have trouble playing a disk burned at higher speed. You may need to substitute your actual DVD writer device in place of /dev/hdc and use the real filename of the DVD image.


The whole process is not quick, and the software puts heavy demands on the CPU, RAM, and disk space. However, none of these problems is specific to Linux.

As far as convenience goes, Linux may present a sharper learning curve, but this learning curve is worth the trouble. Once you find your way around all the steps, you will feel comfortable using the whole chain. The stability and predictability of the free software, as well as the active community of users and developers, is a huge asset.

Alex Roitman is a free software enthusiast and the member of the GRAMPS development team. He has been involved with the GRAMPS project since 2002.