Hack 67. Edit Video
Cut and edit video from a number of formats with avidemux.
Like with other multimedia editing, video-editing tools usually fall into either the consumer or the professional user category. There are a number of video-editing tools under Linux, both command line or graphical, and consumer or professional.This hacks covers avidemux, a video-editing tool that is aimed at the consumer level and has plenty of features. I describe how to use this tool to perform basic video editing.
The first step is to download and install the avidemux software. This step varies based on your distribution, but visit the avidemux download page at http://fixounet.free.fr/avidemux/download.html and find the precompiled package for your distribution. If there is no precompiled version, then download the .tar.gz source from the site and follow the installation documentation at http://fixounet.free.fr/avidemux/doc/en/install.xml.html to install the software.
There are very few required libraries for avidemux: it requires GTK+ and glib2.x, libmad, libxml2, and nasmall software that should be readily available on any major Linux distribution. Apart from that, other libraries are optional and only serve to increase avidemux's support for various video and audio formats. [Hack #53] explains how to find and install various extra codecs and libraries for your computer.
Once avidemux is installed, launch it from a menu or type avidemux from a console. The default interface has a lot of widgets, but for general video editing we only need a few of them. First, click File Open and choose the video you wish to edit from the dialog box. The first time you open an MPEG file, you might be prompted to index the file so that avidemux can keep track of where it is. Say yes to create an .idx file avidemux can use while editing.
The first time you open an MPEG file, you might be prompted to index the file so that avidemux can keep track of where it is. Say yes to create an .idx file avidemux can use while editing.
With the file open, now is the time to start editing. Editing in avidemux involves finding a frame you want to cut, copy, or delete using the slider or frame skipping buttons, and then setting the beginning (Marker A) or ending (Marker B) editing point. Click Edit Set Marker A to set the starting edit point, move to the end of the section you want to edit, and then click Edit Set Marker B. Once youve set the A and B markers, you need to tell avidemux what you want to do with that selection. All of the editing controls are under the Edit menu, so you can cut, copy, paste, and delete all from this menu. You also can set markers in reverse: just move to the end of a section of video to set marker B first, then move to the beginning and set marker A.
avidemux supports editing only a single track of video at a time, so if you want to add sections from another video, click File Append Video and choose the video from the dialog box. That video will be appended to the current one, and you can then cut and paste from the combined video. You can, however, add a second audio track (so you could, for instance, add a sound track to a home movie). To add a second audio track, click Audio Second Audio Track MP3 File or choose AC3 file if you have audio in that format. Alternatively, you can use audio from a different file to replace the current audio track from the video. Click Audio Source External MPEG (MP2/MP3) to choose a different audio track. You can also choose the audio track from WAV or AC3 files.
To start playback of the current video, click Play Play Video (or the Play button in the main window). You cant skip around in the video while in playback mode, so be sure to move where you want to play beforehand.
When you are ready to save the finished product, it is time to configure the final output. If you are fine with the avidemux's defaults, just click File Save Save Video and choose a filename for the output video. Otherwise, you can edit the output video and audio formats from the sidebar in the main window. Save Save Video to start the video conversion process. If you want to save your work as a project that you can open up later, click File Project Save Project and choose a filename for your project. To open that project later, start Project Open Project.