PDA

View Full Version : Finding and Correcting Audio Skew


homermaster
5th May 2005, 05:56
I have noticed that there have been a lot of questions regarding asynchronous audio when combining vobs. I have come up with a solution that is possible while using AutoGK.


FINDING AUDIO SKEW VALUES.

1. Rip DVD files with DVD Decrypter in IFO mode. Enable stream processing and deselect audio and subtitle streams that you don't want (this takes up less space on your HD and makes things faster in some following steps). Open the Stream Information.txt file and delete all of the entries of streams you deselected.
2. Open vobs in DGIndex. There is no need to combine the vobs into one folder or concatenate them with VOBEdit Join Clips function. Simply hit F2 to add the vobs. Make sure to get all of them you want in your encoding session and that they are in the right order, then click on OK.
3. Hit F5 and let it analyze the source for a minute or so and hit escape to stop it. There will be an Information window that opens and a subsection Video Type. If this reports FILM at 95% or higher, select Video, Field Operation, Forced FILM. If not make sure None is selected.
4. Hit F4 and save it as "movie." This will create audio tracks and a d2v file for the video.
5. Right Click on the desktop, select New, Text Document, and rename it movie.avs.
6. Open movie.avs with Notepad and add

LoadPlugin("C:\PROGRA~1\AutoGK\DGMPGDec\DGDecode.dll")

mpeg2source("C:\output directory\movie.d2v")

assuming that you installed AutoGK in the default destination and "output directory" is where you saved the output from DGIndex.
7. Convert your ac3 to a wav with BeSweet. http://dspguru.doom9.net/
8. Open VDubMod and drag movie.avs into it.
9. Select Streams, Streams list, navigate to the output directory and select the wav you converted. BEFORE you close the Streams list, right click on the wav listing, select Interleaving, and enter a value in ms that you think the audio is off by, eg 500 ms = .5 sec, in to the Audio skew correction section.
10. Scroll through the movie with the trackbar until you reach the second part where the audio is skewed. Scroll through and listen to different parts and detetermine if you need to add or subtract from your initial value in Audio skew correction. Repeat this process until you are satisfied with the results. I have the easiest time time doing this watching sections of dialog.
11. If you have more than two segments that are asynchronous make a list of the amount of skew for each of the segments.


CORRECTING SKEW

1. Once skew values are known, you have to edit the wav with a wave editor. I have Nero Wave Editor 2 which came bundled with Nero. If this is not available to you here is a freeware one called Wavepad http://www.nch.com.au/wavepad/. These wav files are huge and will take a fair amount of time to load and edit. Be patient.
2. When the file opens, navigate to the beginning of the second part of the movie. Add (or delete) time as required to resynchronize the audio with the video.
3. If you have more than two segments take the previous values and subtract them from the current value, eg for the second section you found a skew value of 356 ms, and for the third section you found a skew value of 421 ms. When you add the 356 ms between the first and second sections, it is already accounted for in the 421 ms so you would subtract 421-356=65 ms. So you would add 65 ms between sections two and three and so on.
4. When all corrections are made save the wav file. Make a backup copy somewhere in case something happens. You don't want do have to do this again.


INSERTING THE CORRECTED WAV INTO THE ENCODING PROCESS

1. Open AutoGK and select the original ripped vobs as input. Choose whatever your heart desires for the other options as long as you have mp3 audio and the output name is movie, (or rename the edited wav so it has the same name as the one AutoGK will decode) add the job and start the encoding process. There will be some steps that scroll through the log window of AutoGK, loading your settings, Demuxing and indexing, and then Decoding Audio.
2. When Decoding audio starts, drag and drop the edited wav into the agk_tmp folder. A dialog box should pop up asking confirm file replace. You can't just click on OK as the file is being used and it will tell you that it isn't allowed. You have to open the DOS window showing the decoding process then drag it so its close button is directly over the OK button of the file replace dialog.
3. The tricky part is that you have to close the DOS window so the wav file isn't used and can be overwritten and click on OK Immediately after the decoding window is closed. If you don't do this fast enough mp3 encoding starts and the file is again being used so you will get the message that it cant be overwritten.

There is a tool called AutoGK Tweaker http://forum.doom9.org/showthread.php?s=&threadid=79227 which allows a break in AutoGK at each VDuBMod instance. If it is possible to modify AutoGK Tweaker or even create something else which will allow a break at the audio steps to make replacing the wav file easier, it would much appreciated.

4. It will most likely take a number of times to get the timing just right. If you don't get it hit Abort and Start again. The main reason I requested Stream processing at the ripping stage was because DGIndex takes a lot more time to demux and index multiple streams. So if this was done it should dramatically decrease time to get to the decoding phase if you have to start over.

Once you have replaced the wav just let AutoGK run as normal.


OTHER OPTIONS?

With some direction from jggimmi I have been doing some research on a few avs commands to make this possible as it is a MUCH simpler solution. The commands are Trim() and DeleteFrame(), both located here http://www.avisynth.org/index.php?page=AviSynthManual
Unless there is something I don't know, I don't think Trim() will work as it cuts the audio as well as the video so it dosen't fix async problems.
DeleteFrame() looks like a better option because it dosen't cut the audio. However, from what I understand, you can only correct in increments of the length of a frame. This means that if you have a frame rate of 23.976 fps, one frame lasts 1/23.976 or about .0417 seconds. This means that with this command, you only have adjustment increments of about 42 ms. An example of how this won't work is LOTR FOTR EE. This comes on two disks and I found that adding 448 ms at the transition of the disks corrects the sync issues. Doing a little math we see that 10 frames is 417 ms and 11 frames is 459 ms. 11 ms async isn't all that much but it is noticable.
Is there anyone out there that could offer any clarification on these commands as I am fairly new to avs scripting and may be mistnterpreting the capabilities of these commands or missing another command that can solve this problem.