Avidemux is a relatively simple to use video editor. It is cross-platform, free open source software (FOSS), so you can use it on Linux, Windows or a MAC box.
Illustrations in this post are from Avidemux running on Lubuntu Linux.
Before we start, there are a few points which need clarification.
Video Formats, Codecs and other mysteries
Video terminology can sound complicated, and is often rather confusing. There seems to be widespread confusion concerning video formats and codecs. Basically, a video format specifies the composition and arrangement of data in a video file. While a codec (enCOder-DECoder) is a tool set used to code or decode data.
This is an important distinction, because a video file can be coded using one CODEC and then decoded (played back) using another, just so long as they both comply with the same format standard. (e.g. you could encode a video using DivX Codec, and I could decode it with Xvid).
To further confuse the issue, some codecs are not codecs! The x264 encoder cannot decode (i.e. its all "CO" no "DEC").
It gets worse. There are video formats, audio formats and container formats. So your RaspberryPi + RaspiCam may be generating .h264 files, which are purely video files to the MPEG-4 Part 10 standard, also known as MPEG-4 Advanced Video Coding (AVC) or simply H264. Many media players will not play these (VLC is one exception) because they have not been wrapped up in a Container format.
A video or media container format can synchronise the data that it contains (e.g. video, audio, subtitles & so on). A container format such as .AVI seems to support most video and audio formats, while others may be more restrictive. There is a useful Container Format chart here: http://en.wikipedia.org/wiki/Comparison_of_container_formats
On Avidemux, you choose video, audio & container using the 3 drop-down boxes on the left (Video, Audio & Format).
Editing Video Clips
The selection markers A & B are generally used to remove the unwanted sections from your video. Let's suppose that the bit you want to keep is a middle section of your video. Open the video file in Avidemux, and either play the video or use the slider to move to the point where the good bit starts. Now click on the B marker so that the unwanted section is contained between the A & B markers. Select Edit > Cut to remove this section.
Now move to the end of the section that you want to keep and select the A marker. Move the slider to the end of the video and select the B marker. Once again select Edit > Cut to remove this unwanted section.
It is now advisable to encode your selected video clip rather than save in copy mode. This is to avoid problems with special key frames that may now be in the wrong position. So I suggest you select:-
Audio: (if applicable) AAC (faac)
Append the .mp4 extension to your file name when saving.
To get the best quality from your new video at a suitable file size, select Video > Configure > Bitrate > Encoding Mode: Two Pass - Video Size
Setting the file size to (say) 10MB is a reasonable choice for short video clips that you want to upload to the web, but you probably need to experiment with this setting to suit your own requirements.
Avidemux does not have an "undo" list, only a "reset edits" feature. So I find it is better to make short edits and save to new files, rather than risk something going wrong and having to start all over again. Here is my suggested work flow.
As an example, lets say we have 3 video clips, and we'ed like to take the best bits from each and link them together to create one good video.
- Open the first video file, edit and save to a new file name, as described above.
- Repeat this for the remaining files.
Note: Each video must have the same frame rate, so select Video > Frame Rate to confirm this. For any that do not have the required frame rate, select Video > Filters > Resample FPS, add this filter and set the frame rate as required.
- Open the new first video in the sequence.
- Now use File > Append to add the second video in this sequence, and repeat for each additional video.
- Set the encoder settings and save as detailed above.
There are other video filters which you may find useful. To see the result of any added filters, switch from "input" to "output" from the main Avidemux window.
To get your video to fade in at the beginning and out at the end, use the Fade in/out video filter. You need to add the filter twice, once for Fade in and once for Fade out.
Simply set the start & end frames as required.
Use the crop filter to remove unwanted detail from the edges.
I always set the trim values to multiples of 8 to avoid problems with some container formats.
You can add simple subtitles by creating a .srt text file. Here is an example:-
00:00:45,000 --> 00:00:48,000
later that day...
00:01:13,000 --> 00:01:17,000
...then they were gone!
Each section is numbered in sequence. In section 1 the display start time is set to 45s in the format hh:mm:ss,msec, and the subtitle "later that day..." is removed after 3 seconds.
Add your subtitle file to your video project using the subtitler filter: Video >Filters > Subtitles > Subtitler
In the Subtitler dialog select your subtitle (.srt) file and a suitable font. (On Linux this may be something like: /usr/share/fonts/truetype/freefont/FreeSerif.ttf)
Add a Sound Track
Very simple. Edit an audio file in an editor like Audacity, so that is has a suitable duration. Save the file as an MP3.
In Avidemux select Audio > Main Track
Set Audio Source: External MP3
External File: browse to locate you audio file
Encode and save as before, but set Audio to MP3 (lame).