Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th January 2013, 05:25   #1  |  Link
xekon
Registered User
 
Join Date: Jul 2011
Posts: 224
Guide Correcting audio delay for Anime that has an Audio Delay issue, ie Dragonball Z

Guide Correcting audio delay for Anime that has an Audio Delay issue, ie Dragonball Z

I hope this guide saves some people some time when they are trying to correct an audio delay issue caused by the production studio.

The issue was a combination of open gops and authoring errors by the production studio.
The combination of the two and me being new to ripping dvds in general had me pulling my hair out. (thanks neuron2 & manono for all your help)

Before you invest the time to follow this guide, the audio correction are not automatic, you still have to listen to and line up the audio, but with the method I am using, you only have to do it to one episode, and then you can use it as a basis for audio alignment in all the remaining episodes, for a show like DBZ with 291 episodes, that is a lot of time saved!

Before I was doing something incorrectly in my ripping/decrypting/demuxing process that caused open gops throughout the episode, so if I lined up one spot in the episode, other spots would be off by as much as 300+ ms(the open gops were between individual cells for the given vob ID), once correctly ripped, you can apply a single delay to the entire episode to bring it back into alignment. (to fix the alignment issue the production studio made.)

There may be other workflows that work, possibly with even less steps, this is just what has been working reliably for me.

1. AnyDVD HD 7.1.2.0 installed and enabled, default settings.

2. Set DVD Decrypter to the following settings: http://adubvideo.net/how-to/anydvd-dvd-decrypter
In addition to this guide, set these settings on the file mode tab:


3. With AnyDVD in system tray and active/enabled, insert DVD
If your working with ISO/image files then install virtual clonedrive: http://www.slysoft.com/en/virtual-clonedrive.html
and mount your image, was using Daemon Tools lite, but virtual clonedrive is by the same company as AnyDVD and is supposed to work more efficiently with virtual clonedrive, or so im told.

4. Load RipIt4Me, I am using 1-Click Mode.

Above is my settings. Make sure to set your "Base path for target rips"
I click 1 click mode and then next.
It then goes to work with dvd decrypter, ifo/vob cleanup

5. Load PgcDemux, Load the input IFO created from the previous step(largest size),
select an output folder.
check "Create a PGC VPOB", have all the other options unchecked.
click "by VOB id" for the Mode, Select the First VID in the drop down menu that is over 10 minutes. (First episode)
click Process, as you do this its a good idea to rename the vobs to the episode number
process all vids in the drop down menu over 10 minutes.


6. Load DGIndex, set Video > Field Operation > "Force Film"
Open 001.VOB that you created in the previous PgcDemux step, click ok.
from the menu select Audio -> Output Method -> Demux All Tracks.
and goto File -> Save Project, which will generate a .d2v, and audio files.

7. Load AvsPmod, use the following test.avs:

Code:
LoadPlugin("F:\AviSynth\plugins\audgraph.dll")
LoadPlugin("F:\AviSynth\plugins\DGDecode.dll")
LoadPlugin("F:\AviSynth\plugins\NicAudio.dll")
A = NicAC3Source("F:\dbz_s1d1\001 T81 2_0ch 192Kbps DELAY -213ms.ac3")
V = MPEG2Source("F:\dbz_s1d1\001.d2v")
AudioDub(V, A)
DelayAudio(-0.246)
ConvertToRGB()
AudioGraph(1)
You want to find the eyecatch, and go 3 frames into the eyecatch:


As you can see for Season 1 episode 1 (remastered orange bricks), If you look at the file DGIndex demuxed The reported delay is -213ms or DelayAudio(-0.213).
This delay is incorrect, and the reason is not that DGIndex demuxed the audio incorrectly, it is because the production studio did not have the audio alignment correct.
As you can see in my script I am using a delay of -246ms or DelayAudio(-0.246).
I came to this value by carefully listening to several places within the episode, making small adjustments, playing it back again, and also inspecting the audio graph.(hours worth of checking)

If you have properly ripped your dvd/image and followed my guide, your audiograph alignment for episode 1 should look like this at the different frame numbers.
If your audiograph is way off on some of the frame numbers then you may still have some open gops, and need to make sure you are ripping it correctly.


So If you have your episode1 finished and it is in sync you are now ready to rip other episodes and get them into the same sync.
Follow the same procedure and get your second episode loaded into AvsPmod

Now to line up the second episode you dont have to torture yourself listening to it over and over trying to line it up.
Just find the eyecatch for episode2 and go to the third frame into the eyecatch just like in episode 1.

In AvsPmod I keep episode1 open, and open a new tab to work on additional episodes as you can see in this screenshot.
in AvsPmod if you hold down control and press tab, it will cycle through the tabs, so can do that back to back to quickly compare the audio graph between the two episodes.
on your episode2, 3rd frame into the eyecatch, you want to adjust the DelayAudio() until it is close to lining up with episode1.
You can see in the screenshot where I zoomed it in and drew a yellow line across the audio graph. I adjusted all the other episodes so that they are at that yellow line or just 1ms past it.
So all you have to do now is keep a .avs file per episode with correct audio delay, or if your doing your encodes through a batch file then take note of the delay on each episode.

If the audiograph is so far off that you dont even see the same section of graph, you can change AudioGraph(1) to AudioGraph(5), that will make it display more frames worth of audio at once, then once your close set it back to AudioGraph(1) so you can fine tune more easily.

Then just continue to line up each episode using the audio graph.

Now this covers the alignment of the Bruce Faulconer track on the orange bricks.
If you were using the other tracks that had the original japanesse music, you use the same idea.
Instead of 3 frames into the eyecatch go 5 frames into it, also you may have noticed the audiograph is rather flat, you can apply AmplifydB(10) right before the AudioGraph() call to make the graph more visible.
Also the audiograph was displaying oddly for the 6channel track, so I downmixed it to 2 channel, just for alignment purposes, make sure you remove it before encoding, unless all you want is 2 channel audio of coarse.


I am still not finished encoding the entire series, if I find anywhere that this method does not hold up, I will post about it.
I have been doing my ripping/correcting/encoding by series, dont have enough hard drive space to do the entire show at once.

I am assuming that anyone reading this has a basic idea of how to encode the audio & video using a .avs file, and then mux them into an mkv using mkvtoolnix.
This guide was just meant to cover my approach to correcting the audio alignment of the Dragonball Z series.
This method could be applied to other Anime too (ones with an eyecatch that has audio), but hopefully you wont run into to many other titles that have audio sync issues.

Now as you have noticed, using PgcDemux like this gets you just the episode, you dont get the opening or closing song, or NEP.
I actually prefer to encode them seperately instead of having the opening song on all 291 episodes, for one it will save some file space, it also makes it easier to watch the series marathon style.
you can process them seperately and combine them: http://forum.videohelp.com/threads/344103-Avisynth-Script-Help-Trimming-and-Joining
or you can even skip using PgcDemux, and use DGIndex on the entire episode without creating the PGCvob.
If you want to skip using PgcDemux you can use IfoEdit to strip one of the two angle. (PgcDemux automatically keeps angle1 only)

Last edited by xekon; 26th January 2013 at 20:33.
xekon is offline   Reply With Quote
Old 26th January 2013, 15:45   #2  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
While the guide is specific to DBZ, I think it illustrates a lot of techniques that can be generally applied. Thanks for posting it.
Guest is offline   Reply With Quote
Old 26th January 2013, 17:12   #3  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
why not simply use IFO mode in dvd decryter, and in the setting make IFO mode split file by chapter? Works all the time and no audio delay.
lansing is offline   Reply With Quote
Old 26th January 2013, 18:23   #4  |  Link
xekon
Registered User
 
Join Date: Jul 2011
Posts: 224
Quote:
Originally Posted by lansing View Post
why not simply use IFO mode in dvd decryter, and in the setting make IFO mode split file by chapter? Works all the time and no audio delay.
you would get a reported delay of 0, but there are audio delay issues in dragonball z caused by the production studio: http://www.kanzenshuu.com/forum/view...hp?f=7&t=16542

so you would still need to apply some delay, sometimes the amount of correction needed is as little as 30ms, so for some it can go unnoticed, there are some episodes where it gets off enough that my eyes easily pick it up. (both the sound effects, music, and voices are off by an amount of delay in the same direction)

Thanks for sharing the idea of using dvd decryoter split by chapter though, as I said toward the start I am sure there is a lot of different variations you could take in your workflow, and somebody will probably find that very useful.

Last edited by xekon; 26th January 2013 at 18:30.
xekon is offline   Reply With Quote
Old 26th January 2013, 19:57   #5  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by xekon View Post
you would get a reported delay of 0, but there are audio delay issues in dragonball z caused by the production studio: http://www.kanzenshuu.com/forum/view...hp?f=7&t=16542
what you are doing here has nothing to do with problem issued on that thread. They were talking about the sound effect and music not lining up correctly, which was a problem from the audio remastering stage, and we can't do anything about it without getting our hands on the original music and sound effect tracks.

All you were doing were syncing the video and audio to your personal liking, which can be done completely by ear. Get media player classic, turn on the status bar at the bottom, play the video, find a syncing spot in the video, like a door knock or a clap. And then simply tap on the + and - sign on the number pad to sync it manually. And to me, it only takes about 6 or 7 tries at most, which is, less than 20 seconds. And the delay value will be show on the status bar.
lansing is offline   Reply With Quote
Old 26th January 2013, 20:19   #6  |  Link
xekon
Registered User
 
Join Date: Jul 2011
Posts: 224
ah, ok. Well the orange bricks have spots where both voices and effects are off in the same direction. When I was syncing it to my 'personal liking', I certainly spent more than 20 seconds, as you were saying.

I didn't just pick what sounded good alone, I tried to take a technical approach to it. (because finding the correct delay can be subjective when trying to go by the way it sounds alone.)

Using the audio graph gives major insight into just how far off sound events are.(and it can be difficult when going down to a single millisecond)
I also made use of this for slow motion playback: http://avisynth.org/mediawiki/FindAudioSyncScript

another trick you can use is to trim() a duration of 10-20 frames, a few frames or so prior to when something is supposed to happen, like you said a door knock or a clap.

like lets say a knock sound is supposed to start at frame 25, so you do trim (1,23) Then play it back.

You heard the knock sound, but why? it wasnt supposed to even start until frame 25. So then you apply a delay to correct it.

I didn't mean to start a debate on whether or not the Orange Bricks set has sloppy audio alignment or not, I have already determined that it does, but feel free to check for yourself,
and if you don't have a problem with the sync that's great

Also, if you use the reported delay, and compare 10+ episodes at the eyecatch:



They will not line up the same, the amount of correction I use varies per episode, even though I am lining up the same sound event in every episode from the eyecatch.
ep1: 33ms
ep2: 31ms
ep3: 51ms

and thats only 3 episodes. If the reported delays were correct, and I was just adjusting it for my liking then all I would have to do is take the reported delay and add or subtract the same amount of delay to all episodes, this however is not the case.

EDIT, thread where I was figuring these issues out: http://forum.doom9.org/showthread.php?t=166700

Last edited by xekon; 27th January 2013 at 03:22.
xekon is offline   Reply With Quote
Old 26th January 2013, 23:38   #7  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
xekon, give lansing a link to the original thread here where this derived from. Or did you do that and I missed it?
Guest is offline   Reply With Quote
Old 27th January 2013, 06:31   #8  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
that thread was just a result of not using a software properly, that is using ifo mode and split by chapter in dvd decryter, instead of the file mode and split by cell, which is not the correct way to rip an anime dvd. Do it right and you'll get something like this:
(see image)


after that you just append the require chapter files into dgindex and generate the d2v and audio file with no delay in the middle.

And lining up the audio along side per frame does not mean the video and audio will be in sync, the video would've been out of sync originally when it was made. And adjusting audio delay in the singles of a millisecond is not necessary. There are 24 frames per second in anime, which mean every frame last around 1000ms/24 = 40ms, that means 40ms is the most precise audio delay adjustment you would do per adjust. Anything less than that is just a waste of time.
Attached Images
 
lansing is offline   Reply With Quote
Old 27th January 2013, 07:44   #9  |  Link
xekon
Registered User
 
Join Date: Jul 2011
Posts: 224
On most episode the amount of delay required is tiny like you said < 42ms, on a handful of episodes it as much as 200ms though and those are very noticeable. (to me)

I think you are totally right that the production studio got it close and said 'meh, good enough' This is important to me though, and I think the time spent is worth it.
xekon is offline   Reply With Quote
Reply

Tags
audio, audiodelay, correct, delay, dragonball

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:08.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.