Editing your video without recompressing it- by Maxwell Adams


1. What's this about?

Normally when you edit a video, you have to re-compress the whole thing afterwards. It is possible to edit videos without recompression, but some limitions apply.

2. Requirements

For .avi files: Virtualdub
For .wmv files: Windows Media Encoder

3. Procedure

First things first - you need to learn about keyframes.

Keyframes are what make video compression work. Basically, the video stream contains a bunch of keyframes, and these particular frames are full pictures of everything going on right then. The frames following the keyframe just describes what has changed since then. It is possible for a video to be chopped apart at those keyframes. Each keyframe is like a potential edit point. The positioning of keyframes depends on the codec used to compress the video.

Editing with VirtualDub

So you've got your avi file you want to edit. Let's go. Load it up in Virtudub.

Right off the bat, you want to go to the Video menu and click 'Direct Stream Copy'. This changes the way VirtulDub will save your file. Now, instead of recompressing the file, it will just copy stuff over from the old file. If you look under the audio menu, you'll see that audio defaults to Direct Stream Copy.

Ready to edit? Let's learn some hotkeys.

spacebar = play, pause
shift + left/right = move over to previous/next keyframe
shift + drag slider with mouse = scroll through video, viewing only keyframes
home/end = set beginning/end of selection
[ and ] = jump to beginning/end of selection

If your video is encoded with xvid, things will be weird. Virtualdub will try to keep up, but it will kind of display the thing it was just supposed to display.

If your video is uncompressed, every single frame will be a keyframe. Some older codecs have a keyframe at regular rates, like one every 3 seconds. Xvid keyframes will mainly be at scene changes, but some others will be scattered around.

Browse through the keyframes and use Home and End to select a chunk of video. Use the [ and ] keys to jump to the beginning and end of the selection and play those parts, so you're sure those are the points where you want to edit. Now you can do something to that selection. You can just delete it if you want to. You can copy+paste it to another point in the video, using a keyframe as an edit point.

Any changes made with effect both the video and audio track.

You can attach another file using the File -> Append AVI Segment option. This will only work if both files are encoded exactly the same way.

Saving is pretty much your basic File -> Save as AVI. Virtualdub will not let you overwrite a file it has open. Basically, it doesn't have "Save", it only has "Save As". If you have anything selected when you go to save, it will only save that selection. You can press control+A to select everything.

*WARNING* - As long as VirtualDub is open, it will remember the edits you are making. For example, if you delete everything between 2:00 and 3:30, it will remember that. Close VirtualDub and re-open it before you start a new editing job.

Editing .wmv Files

Once you've installed Windows Media Encoder, go to the start menu and find Windows Media -> Utilities -> Windows Media File Editor. Open up your .wmv file with it.

Drag either time slider around to your start and end points. Use the Mark In and Mark Out buttons to indicate the portion of the video you want to save. Yeah, that's about it.

Remember how VirtualDub exposed you too all the technical elements of what you were working with and let you do anything? This is the exact opposite. This program will still edit by keyframes because thats how this works. However, at no point will it tell you where the keyframes are. After you save the file you have to watch the file to see if it made the cut anywhere near where you wanted.

Oh yeah, after you use the save funtion, the program has that new file open. So watch out for that. The best strategy is to make wide cuts and then maybe try to narrow in on the edit you want.