Sign In

ADigitalMan's Guide to MPEG2/AC3 Editing

ADigitalMan's Guide to MPEG2/AC3 Editing
Version 1.1
April 18, 2008
(c) ADigitalMan, all rights reserved
Reprinting allowed so long as author and copyright info remain intact
Link back to for updates
This guide assumes you are working in a Microsoft Windows environment. Be sure you have plenty of RAM and a large hard drive with a good 40 MB free. An external Firewire drive has proven to be much faster than an internal IDE drive in my experience.

Recommended software (info on obtaining these is available through

* PowerDVD
* DVD Decrypter
* Gordian Knot
-> DGIndex
-> VirtualDubMod
* TMPGEnc Encoder
* Womble MPEG Video Wizard
* Hypercube Transcoder
* Px3Convert
* Vegas
* DVD-Lab Pro
30-day demos are available for most of the products above. Gordian Knot, Hypercube and Px3Convert are freeware.

Step 1: Get the Elements
* Open DVD Decrypter
* Under Tools/Settings/IFO Mode, set the "File Splitting" option to "none." OK the settings menu to save the change.
* Under the "Mode" menu, switch to "IFO"
* Determine the video you want to extract. This sometimes takes trial and error to find all of the supplements, but you can ususally open the disc in Power DVD, note the running time of each segment, and then find the corresponding segment in DVD Decrypter. I recommend renaming the folder after each extraction so that you don't overwrite what you've extracted with a subsequent extraction.
* Under the "Input" tab, click on the PGC for the element you want.
* Then, under the "stream processing" tab, check "Enable Stream Processing"
* Uncheck the streams you DONT want. Usually this is all but the video stream and a particular audio stream. The audio streams correspond in order to the number of streams you can select with the "audio" button on your DVD player. Note: Womble currently doesn't support DTS editing, so you may wish to ignore any DTS files for now, even though they are superior to AC3 files
* Click on the video element you DO want, then click on the "demux" radio button below. Repeat for the audio element(s) you DO want.
* Set the destination folder to the fastest drive with the most space
* Click on the decrypt button and go ride a bike while it rips.

Step 2: Correct the MPV Video stream
For reasons I haven't bothered to research, the video stream is always riddled with timecode errors. Fortunately Womble includes a tool to fix these.
* Open Womble MPEG Video Wizard
* Under the "tools" menu (indicated by a button with a wrench on it) select MPEG GOP Fixer
* point the "input" file to the first video file in your collection. You may need to change your file types to "all files" to see the MPV files.
* Point the "output" file to the designated directory. By default, Womble will name this file the same as your original stream, and add prepend "fix_" to it.
* Select the radio button for "Fix GOP Time Code Errors and PTS Errors (Read + Write)"
* Click the Start button and let it create the corrected file.
* Repeat all these steps for every video stream you ripped.

At this point, it is important to note whether or not all of your video sources are the same type. Specifically, if the video is 16x9 vs 4x3, and whether or not they are all progressive or interlaced. If they are all the same, then skip to step 4. If, for example, you're using deleted scenes that don't match, we will need to convert them to the same format in Step 3.

Step 3 (if needed): Converting 4x3 interlaced video to 16x9 anamorphic video.
Gordian Knot installs several utilities with AVISynth that help you perform some basic video conversion functions. Essentially we will take the M2V/MPV files you have fixed, create a script based on their basic info for AVISynth, modify that script, generate and uncompressed AVI of the manipulation, then re-encode back to M2V. It's a tedious process, but one well worth it.

* Under the Gordian Knot suite of additional apps, launch DGIndex.
* Open the M2V file. Open only one at a time if you're doing multiple videos.
* Save this D2V project with a unique name.
* Launch Gordian Knot and open the .D2V file you just created
* This will launch a second window, with the video actually in it.
* Click "Save & Encode." This will open another window.
* Just click "Save" in this window. No need to encode yet. This will create an AVS file (just a text script). Give it a unique name. I usually choose the same name as the D2V file and the M2V file to keep them grouped together.
* Open the AVS file in notepad or other text editor of choice.
* Note that the "#" character is used to comment (i.e. render inactive) a particular line.
* If the video is telecined (if it shows scan lines for 2 out of every 5 frames) we need to do an inverse telecine. Uncomment the line: LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\decomb.dll") and uncomment the line Telecide(order=1,guide=1).Decimate() by removing the # character at the start of each of those lines.
* Assuming you're editing NTSC and not PAL:
* Change the cropping command to read: crop(0,60,720,360). This will remove 60 pixels from the top and from the bottom. (PAL should be (0,38,720,404)
* Change the resizing command to read: LanczosResize(720,480). This will stretch the image to anamorphic proportions.
* Uncomment the line: Undot()
* Save the file

* Under the Gordian Knot suite of additional apps, launch VirtualDubMod and preview the video to make sure it looks right.
* Launch TMPGEnc
* Start a project with the setting DVD NTSC 16:9 (or PAL if appropriate).
* In the next window drag your AVS Script into the video source.
* Click next until you get to the Bitrate setting window.
* Make sure the bitrate setting has the average video bitrate setting at 8000. This is the maximum number allowed and will ensure the best possible video quality.
* Click Next and name the output file. The default name may conflict with the original source. Be certain that it doesn't so you don't have to rip from scratch if something goes wrong. I suggest renaming the source file, since most of your work is based off the "fix" file.
* You can check to run the job in batch if you have multiple files.
* Set the conversion to run, go run a marathon and read War and Peace. Take a vacation. Solve world hunger. After all of that, your new M2V files should be ready.

Step 4: Edit your sources.
Womble allows you to edit video with up to two audio tracks. Usually you only want one, but you may occasionally want to offer a second track. Music only, or 2-channel stereo, or commentary, or whatever. Womble makes this pretty easy if you know how to work it.
* Open a new project in Womble
* Drag your fixed video file onto the video timeline.
* Drag your first audio track onto one of the audio timelines. Push it so it is flush-left to guarantee that it lines up with the video track. If a second audio track is desired, do the same in the second audio timeline.
* You can zoom into frame-accuracy on the timeline by hitting the + on the interface, and zoom back out by hitting the - button. You may advance frame-by-frame with the left and right keys on your keyboard, and may drop your cursor anywhere in the timeline.
* TO MAKE AN EDIT: Drop the cursor on the frame where you want to make the cut. Highlight ALL tracks by CTRL-clicking each one. Then hit the scissors button, which will cut all three tracks in the same spot. It is recommended that you do this zoomed-in as far as you can go. I've seen cuts shift a frame sometimes if you are zoomed out. You can always undo if necessary.
* If you're adding a scene in: Drag the fixed video of this new scene onto the video timeline into the split point you created, above. Do the same for the audio file(s). VERY IMPORTANT: Check the end of the split point on the new file. Often the video will be a few frames shorter or longer than the audio file. It is important to trim them to the same length, then re-align your "main" video and audio, or they will go out of sync.
* If you're removing a section: Find the last frame of the video you wish to cut. Then move one frame to the right. Cut all tracks. Delete the parts you wish to remove. Then slide everything to the right of this split as far left as it will go, so it abutts the previous section cleanly.
* SAVE YOUR PROJECT. Remember to save often. Womble tends to crash if you're working with large files but don't have a lot of RAM. It also sucks up a lot of virtual memory, so be patient with it.
* Once all your edits are done, preview each one of them, looking for issues like extra frames flashing at edit points (usually caused by not trimming accurately).


Step 5: Export and check:
Womble exports the streams modifying the GOP structure and not re-compressing unless video or audio was manipulated. If you added no FX to the video, then you will export a video file that is exactly the same quality as the source. If you did add FX, then the areas where FX were applied will be recompressed. With regards to Audio, Womble will actually export AC3 files *IF* all sources contain the same number of channels and bitrate. Otherwise it will recompress the audio to a stereo MPA or WAV file, depending on what you choose.
* If you used more than one audio track, mute one of them now.
* Click on the "export" button (it looks like a cassette).
* Under the "audio" tab, choose AC3 if possible. If not, I recommend WAV, as it will not re-compress the signal and will make it useful for VEGAS, which we'll talk about later.
* Under the "Video" tab, hit the "expert" button and change the algorithm to "Maximum quality." This will ensure that if any segments are reencoded, they will look as good as possible.
* Under the "General" tab, ensure that the video and audio streams are separated and not multiplexed. This will export separate streams. Set the range to "all" by selecting "work area" and then "all."
* Under the "Monitor" tab, click start. The new streams will be generated. This seldom takes more than a half hour if you're using a firewire drive.
* Save your project file when it's done to retain all your export settings.

* Verify the results by loading them into a new project. Many times Womble will drop a frame or add a frame. This sometimes causes the audio to drift out of sync. Re-check your original project, remove any frames if necessary, and re-export. If the end result is still out of sync, note the number of frames off, and we'll correct through some trickiness in Vegas.

Step 6 (if needed): Make surround-sound audio.
If you were unable to make an AC3 file in Womble, or if you didn't like the AC3 file it made due to lack of crossfades, synch issues, or whatever, we can recreate it in Vegas. This is painstakingly time consuming and is not for the faint of heart. But the results are exquisite.
To extract 6-channel AC3 files to WAV:
* Open Hypercube Transcoder
* Change Output Engine to WAV Engine (6 mono files)
* Change processing type to Native Processing
* Ensure your source file is tucked into a subdirectory of its own to prevent accidental overwriting.
* Choose your input file. Output path will be set by default.
* Click Transcode.
* Go watch the complete collection of Gunsmoke ... all 20 seasons. (But seriously, a 2-hour file takes about one hour to process on my system using a firewire drive.)
* Repeat for each file you need to transcode.
The result is six wave files ... one for each channel. C=center, L=left, R=right, LS=left surround (rear) RS=right surround (rear), LFE=subwoofer (low frequency somethingoranother). Hypercube labels these for you. Woo hoo!

* If the AC3 is 2-channel, you can convert it simply to a stereo WAV using Px3Convert.

* If you need to upmix a 2-channel source to include in your 5.1 mix, check out Doom9's Guide: 2- to 5-channel upmix using Dolby Pro Logic II
* The latest versions of Womble will also upmix 2.0 to 5.1. Be sure to set your audio export options to 5.1 AC3. You can re-create each 2.0 source as 5.1 individually, which you can then rip down along with the main 5.1 audio in the manner described below.

* In Vegas, create a "5.1 Surround DVD" project.
* Load the stereo wav you exported in Womble. This will be your reference file and will be muted out of the final mix.
* Drag in each of your six mono files into individual tracks. Label them, so you know which is which. Check the alignment (I usually slam them all as far left as they will go) then GROUP them together so they will be edited and moved together. This is VERY important.
* Set up the correct sound panning for each of these tracks so that they go to the correct channel in the final mix.
* If your export had audio drift issues, here is where you would squeeze your stereo reference file the required number of frames. This method has been quite effective at "re-synching" a file for me. Squeeze the source, then align the "unsqueezed" files at each edit point.
* Using your ears and eyes, align the audio to the reference file.
* Add in new tracks with the deleted audio as necessary. Split the main movie according to the splits your ears tell you, line up a new scene, realign everything afterward. Keep going through this process until all your edits are re-created. Vegas has lots of fading options that can make for smoother transitions than straight cutting. Experiment.
* When you're satisfied, mute out the reference channel, then select "Render as" from the file menu. Be sure you're exporting to a 5.1 DVD.
* Volunteer at a soup kitchen and use the downtime to help out somebody in your community. When you get back the file should be done.
* Load the final video file with your new Audio file into a new (temporary) Womble project to preview how well they synch up. Pay special attention to the places you edited. If necessary, make changes and re-render the AC3 file or, even the Womble project if you notice issues in the video. It takes a lot of finessing.

Step 7: Muxing and Authoring the DVD.
If you have only one audio and no subtitles, you may use either DVD lab or TMPGEnc DVD Author. I recommend the latter if you're muxing a WAV file instead of an AC3 file. I tend only to use WAV if its a concert video where the audio is much more important than the video quality.

Otherwise, load your final streams into DVD Lab (I prefer DVD Lab Pro). Experiment with menu options. Author the final DVD and plant a forest while waiting. Preview it in PowerDVD. If changes are needed, save your project file and you'll only be tweaking and re-rendering.

Recompress to single-layer if necessary. I recommend Nero 6 as the results have been gorgeous.

Preview again and if all is well, burn it. You may wish to burn to DVD+/-RW first to watch it on TV as a last quality control measure. Watch it with a pad and paper in hand and note any trouble spots.

It may take a few weeks to get a good edit at first, but as you get familiar with the tools, you'll get faster and faster and will make fewer mistakes as you learn.

Good luck.

Though much of my understanding comes from trial and error, special thanks go to and a user there by the name of "Manono," who taught me the IVTC and resizing tricks in Gordian Knot. Plus MeBeJedi and Laserman from this site for being great sounding boards as I was learning.
I am fluent in over six million forms of procrastination.
Kudos, DigitalMan! This right here answers most of the usual newcomer's questions.

Episode II: Shroud of the Dark Side

Emperor Jar-Jar
“Back when we made Star Wars, we just couldn’t make Palpatine as evil as we intended. Now, thanks to the miracles of technology, it is finally possible. Finally, I’ve created the movies that I originally imagined.” -George Lucas on the 2007 Extra Extra Special HD-DVD Edition

Great information, thanks!

Is there any way to adjust the brightness and/or speed of a clip without having to re-encode the video? I ask because I am trying to darken the Emperor screen from LD and re-encoded makes it look totally unwatchable.

Well done. I will disengage self-destruct initiative.

Unfortunately, it will involve a recode. However, you can get better (not perfect, but better) re-encoding results in Womble this way:
1) go into the export menu
2) click the "video" tab
3) click the "expert" button
4) change algorithm to "maximum quality"

This takes a LOT longer to process the re-encoded segments, but the results are noticibly better.
I am fluent in over six million forms of procrastination.
Thankyou ADM, so many questions answered in one go, now I can get on with this damned edit.
As does your nickname.
I am fluent in over six million forms of procrastination.
Guide for Mac users:

1) Buy a Windows Machine.
2) Go here.

(For the record, I used Macs for years).
I am fluent in over six million forms of procrastination.
Good Stuff ADM!!!

I really like the Womble MPEG Video Editor. Glad to see I am not alone in using it. I dont use TMPGEnc personally but I know why you would.

When I demultiplex in woble and in DVD lab pro, the audio is always out of sync for ROTS. It gets gradually more and more out of sync as the movie goes on. This is because the audio file is a tad bit longer than the video file. Do you know why this is and how to fix it?? No matter what I do, this always happens when I try to demultiplex and compile to DVD.

Well done. I will disengage self-destruct initiative.

I've never understood what causes this, but I've somehow worked around the issue in the past.

Have you demultiplexed with DVD Decrypter? The results will probably be the same, but it's worth checking out.

If it's still problematic, I've often figured out the number of frames that a film is "off" and then, every X number of minutes, cut or repeated a frame right on a shot change to fix it.

I think it has to do with Womble editing 23.97 fps at 29.97, doing it's own telecine on the fly. But that is only a guess.

I haven't had the problem since I've been generating stereo reference files, then re-creating the surround mix in Vegas, but the source material has remained in sync for me. The sync problems were always with exported content in my system.
I am fluent in over six million forms of procrastination.
In Womble, is there a way to seperate the audio and video tracks from each other for re-synching out of sync audio? I have the 4.5hr workprint of This Is Spinal Tap and the audio is out of sync throughout and Womble seems like it would be an easy fix. Or would I have to demux first?

I used to be very active on this forum. I’m not really anymore. Hi everybody. You’re all awesome. Keep up the good work.

To shift them, you need to demux first. But if the audio is out of sync at a consistent rate throughout, this would be an excellent way to fix it. Just move the audio right or left until it is back in sync, export the audio stream, and re-mux it to the original video stream. Even less HD space to take up.
I am fluent in over six million forms of procrastination.
Has anyone gotten this strange error with Womble? For the first edit I made, everything worked out fine. Unfortunately, for my second, things have gotten rather annoying.

After encoding the new MPEG file, it plays fine on media player, etc. However, when I go to author it, the video and audio go out of sync. I've tried this on TMPGENC DVD Author and DVD-Lab Pro. Both have the same error. I figured there might be a demuxing problem, so I used Womble to demultiplex my MPEG file and the resulting files were still out of sync. Still, the MPEG file plays fine on my computer, it's just during authoring/demuxing that it goes out of sync.
I've had the problem if there are a lot of edits (like in Ep I and II) ... it becomes a long, tedious, mathmatical fix. You can speed it up in vegas by noting how many frames off the resulting audio is, then squeezing/stretching that many frames in Vegas and re-aligning your edits to match. It's not exact, but I haven't noticed anything being off when I do it.
I am fluent in over six million forms of procrastination.
Thanks for the reply. After working on six simultaneous edits of the last two Lord of the Rings flicks, you could imagine how pissed I was after the sync went off just when I thought I was finished.

Fortunately, I was able to solve this problem since my post. I finally thought of going to the Womble site for support and noticed they had a new "Womble Mpeg Video Wizard DVD" which authors the DVD for you. I downloaded the trial and though I didn't like the menu options, I gave it a try. The output files played in PowerDVD in sync. But since the disc was about 4.88GB, I wanted to run it through DVD shrink. Unfortunately, the output files from the "Womble Mpeg Video Wizard DVD" were not recognized by DVDshrink, TMPGENC DVD author, and a few other programs. Luckily though, I downloaded some program which simply processed the files and the resulting ones were finally readable by those aforementioned programs. So now at the very least I have one disc burned. I'll probably tweak some things and it's off to making more changes to the other five.

This editing hobby is much more time consuming than I had expected.
What's the program you downloaded that eventually solved the problem? I may be doing more edits in Womble and this might come in handy for me.

I used to be very active on this forum. I’m not really anymore. Hi everybody. You’re all awesome. Keep up the good work.

"I've had the problem if there are a lot of edits (like in Ep I and II) ... it becomes a long, tedious, mathmatical fix. You can speed it up in vegas by noting how many frames off the resulting audio is, then squeezing/stretching that many frames in Vegas and re-aligning your edits to match. It's not exact, but I haven't noticed anything being off when I do it."

Rikter and I had similar problems, and it turned out that the problem was caused by having loaded one of those codec packs (30-codecs-all-at-once kinda thingie.) I had done his Cure concert LD, and had to go through every few minutes and realign the audio to the video - and I had hardly done any edits to the original video.

I was planning on reinstalling Windows 2000 anyways, and doing so fixed the trick, but the lesson remains - don't load any codecs you don't need.

<span class=“Italics”>MeBeJedi: Sadly, I believe the prequels are beyond repair.
<span class=“Bold”>JediRandy: They’re certainly beyond any repair you’re capable of making.</span></span>

<span class=“Italics”>MeBeJedi: You aren’t one of us.
<span class=“Bold”>Go-Mer-Tonic: I can’t say I find that very disappointing.</span></span>

<span class=“Italics”>JediRandy: I won’t suck as much as a fan edit.</span>

ReverendBeastly, it was a program called VobBlanker.

And I did load one of those codec pack things. So it also seems to be the problem here.
If you can remember which codec pack it was, then you can look at the list of installed codecs that came with it (hopefully) and manually delete them. Don't worry about accidentally deleting one you need - if such happens, then look for it on the Internet and install just that one.

<span class=“Italics”>MeBeJedi: Sadly, I believe the prequels are beyond repair.
<span class=“Bold”>JediRandy: They’re certainly beyond any repair you’re capable of making.</span></span>

<span class=“Italics”>MeBeJedi: You aren’t one of us.
<span class=“Bold”>Go-Mer-Tonic: I can’t say I find that very disappointing.</span></span>

<span class=“Italics”>JediRandy: I won’t suck as much as a fan edit.</span>

Wow, editing 5.1 audio is crazy complicated with Sony Vegas.
It's tempting to do straight cuts and hope it doesn't sound to bad (or use 2.0 audio so you can crossfade.)

Dr. M