November 21, 2006
This article was contributed by Carl Bolduc
Video editing is probably one of the last areas where Linux is
still lagging behind proprietary operating systems.
I have used Linux almost exclusively for the last few years,
except for video editing where I still use Windows.
That is about to change.
My goal was to build a video box that would let me grab video from my
digital video (DV) camera, edit scenes with features such as transitions,
and create full featured DVD recordings.
My hardware is very low end for this kind of task and it has proven to be extremely slow under Microsoft Windows. The test machine featured a 1.3GHz AMD Duron processor, 512 MB of RAM, a 4X single layer DVD burner
and a Pinnacle firewire video capture card.
Due to my low-end hardware, I decided to install the Slackware 11
distribution. Slackware is known for good performance on limited
hardware.
Capturing Video
The initial requirement for a video editing system is
the ability to capture the video data.
Two choices were available:
Kino and dvgrab.
Kino is easy to use and even allows you to control your DV camera from
a nice GUI interface. Kino requires some GNOME libraries, but
Slackware does not provide them out of the box.
I chose to use dvgrab for video capture, it operates with a very simple
to use command line interface.
For installation of dvgrab on Slackware, you will need to install
the following packages
(available here): libiec61883, libraw1394, libavc1394,
libdv, libsamplerate and dvgrab.
Once installed, dvgrab complained about the lack of the IEE1394
interface, /dev/raw1394.
Fixing that problem involved creating two device nodes:
mknod /dev/raw1394 c 171 0
mknod /dev/video1394 c 172 0
Finally, due to a permission issue, I opted to use the root account
for capturing video with the following command:
dvgrab video_file_name
The ownership of the resulting video file was then changed to my
regular user for further processing.
Video Editing
The next step, and the most complex one, is video editing.
The only effective video editor that I found was
Cinelerra CV (community version).
Until recently, Cinelerra was very unstable software and was not an
attractive solution.
You had to save very often because of the high risk of crashing.
With the latest release, I experienced absolutely no crashes,
and I performed some very wacky editing tricks with the software.
The installation process for Cinelerra CV is not trivial if you decide
to compile the source yourself. Luckily, the latest version and its dependencies
are available for Slackware 11. Selected packages include:
faac, faad2, fftw, jack, lame, liba52, libdv, libquicktime, libsndfile,
libx264, mjpegtools, openexr and cinelerra.
The Cinelerra interface can be rough at first, but after a few hours of
editing you will discover that it is rather usable.
Basically, you just import the videos obtained through dvgrab,
create clips from the video files, drag the desired clips to the
various tracks, insert transitions, apply effects, and finally render
your work.
The
Cinelerra wiki offers a clear explanation on how to use the various
components of the software.
You can do tasks such as compositing various video
tracks and using multiple audio tracks for dialogs, music, narration
and more.
Unlike various commercial video editing solutions on the Windows platform,
it is not necessary to pay fees for incremental features,
such as using a second video track.
Rendering the video
Once you are satisfied with your work, it is time to render everything
to a file format that will work with DVD players.
Since this step is a tricky and frustrating one, I provided the
various steps (also available in the Cinelerra CV wiki) that you
need to perform to reach success:
- Create a script ~/cine_render.sh with the following two lines:
#/bin/bash
mpeg2enc -v 0 -K tmpgenc -r 32 -4 1 -2 1 -D 10 -E 10 \
-g 15 -G 15 -q 6 -b 9400 -f 8 -o $1
- Add execute permissions to the script:
chmod +x ~/cine_render.sh
- Open Cinelerra, and select the part of the video you want to render
with the [ and ] points.
- In Cinelerra, press Shift+R to bring up the render menu.
- Select the "YUV4MPEG Stream" file format.
- Deselect "Render audio tracks" and select "Render video tracks".
- Click on the wrench that shows up near the word Video.
- In the newly opened window, indicate the name of the m2v file that
you want to create. The m2v file will contain only the video.
- Click on "Use pipe" and enter the path of the previously created script:
/home/[your username]/cine_render.sh %
- Click OK to close the second window, and OK again to render your m2v file.
- After the m2v file has been rendered, open the rendering window again
and render an ac3 audio file, choose the 224 kbit/sec sampling rate.
- Finally, combine the audio and video tracks with this command:
mplex -f 8 your_video_file.m2v your_audio_file.ac3 \
-o video_audio_file.mpeg
The resulting mpeg file should be compatible with commercial DVD players.
Creating a DVD
You now have the data to create a DVD.
Several tools are available for this task, but
ManDVD
stands out as being very easy to use and full of features.
To use this application, you will need to install the following Slackware
packages:
mplayer, ffmpeg, transcode, libdvdread, dvdauthor, dvd-slideshow and
mandvd.
ManDVD allows you to write DVDs.
It featuring animated menus and can be operated without touching
the command line. ManDVD can burn the final product directly,
or it can use K3b for this task. In my case, K3b failed to create a
working DVD, so I recommend burning directly from ManDVD.
Afterthoughts
Two new
gstreamer-based
video editing solutions are being developed at the moment,
diva and
PiTiVi.
These two projects will eventually provide simple out of the box
solutions for the various steps involved in movie creation.
PiTiVi will also introduce some exciting new features, such as
post-processing of screencasts created with
Istanbul
and collaborative video editing via bittorrent.
The Diva and PiTiVi projects are under heavy development and
would benefit from the help of additional hackers.
Until those new alternatives become usable, you will need to rely on a combination of specialized tools to fulfill your video editing needs.
With a minimum of pain and time, it is now possible to
create professional looking home movies using an entirely free solution
running on the Linux platform.
(
Log in to post comments)