Adding sound to videos

From LXF Wiki

(Difference between revisions)
Revision as of 13:07, 22 Sep 2007
Guy (Talk | contribs)
added category
← Go to previous diff
Current revision
Guy (Talk | contribs)
Line 117: Line 117:
[[Category:HowTo]] [[Category:HowTo]]
[[category:Sound and audio]] [[category:Sound and audio]]
 +[[Category:LXF Articles]]

Current revision

(Original version written by Andy Channelle for Linux Format magazine issue 80.)

Spruce up your vides with music or voiceovers, using Kino and MainActor.

Table of contents


Audio is one element of home video that is usually forgotten about... until you actually watch ­ and hear ­ the results! If you want to add some music or a voiceover to some home-shot film, it isn't difficult to learn the necessary editing skills using open source software, and you can get some great results.

There are a number of video editing applications available for Linux covering the home and professional markets, although none yet is as ultra-simple as iMovie on the Mac or SonicDVD for Windows. For this project you can use Kino, which is open source and included with most distributions, and/or MainActor, which is proprietary. Version 5.5 has a $199 price tag, but the company also offers a demo version of the app from its website (, which you can use for this tutorial. The latest version of Kino is 0.8.0 and is available ­ usually ­ through your distro's package manager; if not, get it from For this 0.8.0 release, the developers have simplified installation somewhat by including some titling and effects plugins in the main install.

I will make a few assumptions about your computer system: that you have the means of acquiring and capturing digital video (essentially, a digital camcorder and FireWire interface), and that it's all set up and working correctly. Using FireWire devices no longer causes much difficulty on Linux. All modern distros will 'just work' with no user adjustments necessary.

Legal note

There are strict laws preventing you from broadcasting copyrighted music and literature. The Mechanical Copyright Collection Society (, which collects music royalties on behalf of music publishers in the UK, has just set up a scheme specifically for podcasting. They will be able to advise you on whether you need permission from the copyright holder.

Adding a soundtrack with Kino

On SUSE 10.0, Kino recognised my Sony camcorder, a DCR-TRV265E, as soon as it was plugged in, but I needed to change a few settings in the application's preferences (Edit > Preferences), which you could change too.

First, ensure GDK is selected as the display method under the Display tab. Otherwise, the captured footage will be 'deinterlaced' across the preview window ­ that is, two copies of the video will be played. Under the Defaults tab, select 44.1kHz Stereo from the drop-down list. This is the sampling rate at which most digital camcorders work, though check your camera's instructions in case it should be 48kHz. Kino is set up to record audio at 32kHz Stereo, which is a strange default as it causes annoying gaps in the sound. Check the other settings in here, too. In the UK, the Normalisation option should be set to PAL and, unless you have a very fancy camcorder, the Aspect Ratio should be 4:3.

Now everything is set, you can go ahead and capture the video if you don't already have some footage in mind. For some tips, read my LXF65 tutorial on video capture and editing with Kino and FireWire ( begin.pdf).

When it comes to saving your video, Kino works with three formats so your choice should be based on what you intend to do with the footage. The RAW DV format is good if you intend to squirt the video back on to the camcorder over FireWire or burn it to DVD, but it consumes more disk space than both of the AVI formats available and requires a little more 'grunt' to capture. The two flavours of AVI supported by Kino result in smaller file sizes and lower quality, so they're most suitable for Video CDs (VCDs) or web movies.

Get spliced

Once captured, your clips can be sliced, trimmed and reordered until you have a final cut that's ready for a bit of audio work. The project so far is made up of individual clips of video, including the original captured material and transitions ­ the way one clip cuts into another. To do anything useful with the audio you'll have to splice them all into a single section. First, select the Edit tab on the right and make sure you have the first clip selected from the thumbnail list on the left. Now click on the Join Current And Next Scene icon from the toolbar (it has a line in the centre with two arrows pointing inwards) to splice the two clips together. Hit the button again, until the play bar underneath the preview window shows a single, unbroken grey line and the thumbnail list has only one entry (see the before and after images, below).

Kino is a non-destructive editing application, which means that the original footage will remain untouched wherever it was saved to, but once music is added and the file rendered, it's not possible to simply uncouple the music from the video. For this reason, I would recommend selecting Export > Audio and outputting a WAV file of the video's original soundtrack as a backup. You can choose to output other formats, but given that Kino only imports WAVs, I would say that's the best choice. Give the file a name and location, select the sampling rate (stick to the original unless there's a good reason not to) and then hit the Export button.

Music, maestro

Now we can add some musical accompaniment to the video. If you have an MP3 file that you'd like to use, it will need to be converted to a WAV for Kino first. Audacity is, of course, an excellent tool for this job. When your music file is ready, go into the FX section of Kino and ensure the Overwrite tab is set to include all the 'frames' of video (the Limit To: option must not be selected) and that the Advanced Options have not been chosen.

The main work now shifts to the right half of this window. Look under the Audio Transition tab. Now, don't worry about this ­ we're not strictly doing a transition. In the drop-down list at the top of the pane choose Mix. Below this option is a location bar labelled Audio File. This is where you tell Kino which music file to mix with the captured audio. If you wanted to completely replace the video's sound, you would select the Dub option. Just hit the folder icon and navigate your way to the correct WAV file.

Once the music file is in, you can set its volume relative to the video's own audio content (assuming you didn't do Dub and replace it) using the slider below the filename, and also offset the playback by a set number of frames to delay the start of the music. Before hitting Render to apply the audio file to the video, check out the effects of your edits using the Preview button. If the audio file is longer than the video, it will simply be truncated in an abrupt manner. This can only be prevented by editing the music file in Audacity to match the length of the video and adding your own gentle fade.

It is possible to perform this operation without joining all the clips together, but the result is the same ­ a single clip with mixed audio ­ and it's a bit quicker to do some manual splicing at the start. To add audio without joining, simply follow the procedure above, but make sure the Output section of the FX tab is set to Overwrite from the first to the last frame. You can find the numerical value for the latter by selecting the last clip and making a note of the number in the To field.

Bring on the narration!

If you're adding a voiceover as well as a musical soundtrack, you could repeat the Music, Maestro process with the voice track, but this is a sledgehammer approach to audio. The sound would be applied at a set volume throughout, so it could interfere with the other content of your film and would not be editable after it had been applied.

A more subtle approach is to strip out the original audio from the video file using Export, add the voiceover in Audacity, then bring it back into Kino using the Dub option. As we know, this will overwrite any existing sound, as opposed to Mix, which overlays sound. Here's how you do it. I covered ducking, the process of adjusting the volume of one track in relation to another, last issue, but briefly, you import the original audio file into Audacity, record your voiceover on a separate track and then change their relative volumes using the Envelope tool. Once you're happy with how it sounds, export the entire project as a WAV. Now go back to Kino's F/X tab and import the file using Dub, which will as promised overwrite the existing audio. If you have stretched, compressed (time rather than file size) or changed the pitch of the audio file, there is a chance that things will drift out of sync, but as we've only added layers of sound to the original track and adjusted its volume, it should be OK.

While this may seem convoluted, Audacity offers a range of high-quality effects, and it makes it easier to add other tracks ­ such as the voiceover ­ or independently edit left and right channels. This is good when, for example, two people in the video are having a conversation. Move one voice slightly left and the other right to provide a sense of space.

It pays to keep any audio edits in the same folder as the video project ­ especially if you need to come back and readjust volumes after a disastrous test screening.

Audio filters

Both Audacity and MainActor offer tons of effects that you can apply to audio, and some are quite useful for video editing. Audio effects for video are usually broken down into three sections: delay, filter and transition.

  • Delay effects include chorus (which can thicken up sound), echo, reverb and phasing. These are special effects, which you're unlikely to use in the general editing of home video.
  • Filter effects play with the sonic features of an audio file. A filter such as a high- band pass will remove all the frequencies from your sound below a certain range. This is very good for jobs like removing humming noises from videos of your fridge. The low pass, in contrast, will remove all frequencies above a certain range and could be used for removing the vocal from Mariah Carey records (probably).
  • Transition effects take care of the transition from one audio file to another. Really, the only parameter needed in this group is the speed of transition ­ you might want the audio to switch quicker or slower than the video.

As with the use of effects in video or photography, best practice with audio is to make them transparent. If the viewer realises it's an effect, you've gone too far. Of course, that might be the effect you're going for, in which case: fill your boots.

Advanced editing with MainActor

To create more ambitious soundscapes, we can turn to MainActor 5.5 (technically-minded users could also use Cinelerra). MainActor is a proprietary application developed by MainConcept that offers some high-end features and effects, but is also more than capable of working as a home video editing package.

From the screenshots opposite you might notice that MainActor looks a bit like a combination of Kino and Audacity. That's because it separates the audio from the video and puts them on to their own tracks. This might seem incidental, but it can make quite a difference to your final production.

We're going to do two things with MainActor. First, we'll replicate the effect we achieved with Kino and Audacity by adding a score to the footage and then adjusting relative volumes dependent upon the action in the film. Secondly, we'll splice a short, silent scene into a longer one, but keep the audio from the latter running.

Before all that, we need some media to work with. MainActor has its own DV capture utility, but we've already acquired some video with Kino, so we'll just open the Project tab in the application's Browser window and hit the first icon on the toolbar to open the file browser. This provides facilities for bringing in a number of different media formats including photographs and video or audio parts. These will then be accessible under the Project > Media section. When you've imported your files, assemble a rough cut of the video in the Timeline window. To make editing easier, ensure you place clips alternately on video tracks one and two. Once the footage has been trimmed and positioned it's time to move to the audio.

Volume control

By default, MainActor shovels each video clip's audio element on to the same single track, which is labelled Audio 1. This lets the software take care of any 'crossfades' (that is, one sound clip transitioning into another) when the video transitions from one clip to the next. Adjustments made here will only affect the selected clip. To reduce the volume from the video footage by 20%, say, start by right-clicking on a clip and selecting Show Parameters. The Effects window should now have two entries in it corresponding to the video and audio portions of the selected clip. Close the video section. In the section labelled Audio Source is a set of three sliders called Master Volume, Left Volume and Right Volume. These have a value somewhere between 0.00 and 1.00. Moving the small dot to the left on any of these widgets will decrease the volume of the clip; moving them right will increase it. We'd need to set it to .80 to achieve the 20% decrease.

For finer control, use the small disclosure arrow next to the labels to open up a curve editor. In here is a red line with a single dot in the centre, which you can drag up and down to change the volume. To change this over time ­ say, to fade the audio up from 0.00 to 1.00 ­ select the first control point and drag it to the start of the line and to the bottom of the window. Now right-click anywhere on the line and select Add Key. This will put a new control point at the far-right of the window, except you can't see it yet. Use the slider widget above the curve to increase or decrease the volume and the control point will appear. Simply pull this to the top of the window to create a smooth gradient. Hit play in the Preview to see the effect of these changes.

Subsequent control points can be added and edited to change the volume of the sound over the course of a clip. This is how you'd achieve ducking in MainActor.

Duck tapes

To demonstrate this we'll add a second track of music to the Timeline and duck it when there is dialogue in the film. Right- click in the Timeline window and select Add Audio Track. This will create a blank track ready to contain your chosen music file ­again, it's best sticking with WAV, though MainActor can handle various (non-MP3) audio formats. Drag and drop a file from the clips browser on to the track. If the soundtrack is too long for the video, move the play head (shown as a green line) to the end of the last video clip and then, making sure the second audio track is highlighted, hit the K key on the keyboard or use the Make Cut At Current Position icon on the Timeline toolbar. This will split the track in two; dispose of the second half by right-clicking on it and selecting Delete.

As we did with the captured audio track in the Volume Control part of the tutorial, right-click on the track and select Show Parameters to get at the volume controls. Because MainActor's windows are resizable, it's possible to stretch this parameter window right across the screen for finer control over the curve. Editing the red curve as you did before, start the file at 0.00, fade it up to a swell as the film gets going, scale it back to mere 'backing noise', then begin a slow crescendo toward the end before fading it out gently (see the curve in the image above right). Hit the play in the Preview window to hear the effects of the changes live.

Add a video clip

Our second job is to take one section of video (a close-up) and insert it into a longer section (a wide shot), while not changing the audio stream of the latter. Fortunately, MainActor makes this very easy. Start with two clips that have been dragged on to the Timeline. MainActor cuts track two into track one, so we want the wide shot on track one and the close-up on track two. Right-click on the second clip and select Detach Audio From Video. As we won't need it, left-click on the audio track for the second clip and Delete it to make it silent.

You should be left with two video clips and one audio track, with the longer clip on track one and the shorter on track two. In order for this to work correctly, ensure that the second icon on the Timeline toolbar, which is labelled Overwrite Mode, is selected (or just hit the 2 key). Drag the insert along track two until it is positioned somewhere below the wide shot. Now when you play back the preview, the wide shot will jump into the close-up, but the audio will stay the same.

You can place as many inserts into a main shot as you like. For a little more sophistication, you could drag a transition from MainActor's FX palette and drop it on to the start of the close- up so that the jump cut becomes a lovely gentle dissolve, for example. Play around and experiment.

Once the edits are done, the audio polished and the transitions defined, simply hit the Export Timeline icon, which is on the far right of the Timeline toolbar, and select the appropriate format for output. The result should be a single file ready for viewing in your favourite media player or burning to VCD or DVD.

It's commonly noted in film school classes that an audience is more likely to put up with ropey visuals than awful sound, so it makes sense to ensure that your captured memories of a child's birthday party aren't spoiled by one orange squash-frenzied child with the piercing shriek and the background whine of the Crazy Frog. Happy editing!