Log in

View Full Version : Audio Synch Issues


ChrisF
13th July 2003, 20:21
In a nutshell I have consistent audio synch problems - if someone can take a look at this and let me know what I might be doing wrong I'd be very greatful. I've searched and tried to implement the solutions I've found but they seem to reproduce the same issues.

So I am fairly new to Gordian Knot and divx encoding in general. I am pleased with the overall quality and have encoded a fair number of movies. However, some movies have been causing me audio synch problems and my last 3 movies all gave me issues. I have been using the AC3 soundtrack and selecting 'Just Mux' in an effort to follow the tutorials and keep it as simple as possible - file size isn't a big concern. I previously tried a single MP3 encoding within GKnot and got synch issues so I've just been using AC3.

What makes it worse is that I seem to be unable to fix it. On a particular video I utilized BeSweet separately to convert the audio into a virtual dub compatible wav file. After the AC3 synch error I tried removing the unsynched stream and reinserting a new audio stream (first WAV from BeSweet and then the original AC3 again) both times producing synch problems. I tried both VirtualDubMod and Nandub using direct stream processing - no success with any file or program combination. Interestingly the next time I encoded it GKnot did it flawlessly with the same settings I used previously. Using Ben Hur as an example the exact process that produced a flawless side 1 gave me audio synch problems with side 2 (what could have changed? The same people made both sides of the DVD).

So below is my GKnot log from my attempt at Beverly Hills Cop (not the same as the above example but consistent synch problems). I have tried to verify the 4ms delay on the AC3 has been incorporated every time I try to encode it but I keep getting the synch problems.

Any suggestions are appreciated as I am somewhat lost as to what I am doing wrong here and why I keep getting these inconsistent problems.

Thanks, Chris



7/12/2003 4:17:34 PM: Job " 1" started.

o DivX3-First Pass: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.avs
o DivX3-Second Pass: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.avs
o Mux Audio.
End of Job 1 ( 1).
_______________________________________________________________________________________________________________________

Gordian Knot -
Encoding Job Data:

Type: EncD3_Both
Number: 1
Name: 1
Platform: WinXP (5.1.2600).2

Files:
VirtualDubModExe: C:\PROGRA~1\GORDIA~1\VirtualDubMod\VirtualDubMod.exe
NandubExe: C:\PROGRA~1\GORDIA~1\nandub\Nandub.exe
AviFinal: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.avi
AviMovie: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop_Movie.avi
AviCredits: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop_Credits.avi
MovieFS: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.avs
CreditsFS:
Log : G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.log
Stats: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.stats
Ecf : G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.ecf

Options:
Quality/DRF: 0
CreditsStart: 0
UseEcf: 1
CreditsIVTC: 0
CreditsAppend: 0
DeleteInterm.: 0
EnforceBitrate: 0
AntiShit: 0

Calculator:
VideoSize: 825336 kbyte.
Audio1Size: 345131 kbyte.
Audio2Size: 0 kbyte.
Overhead: 7132 kbyte.
AviSize: 1177600 kbyte (1150 mbyte).
FilesSize: 0 kbyte.
TotalSize: 1177600 kbyte (1150 mbyte).
Interleaving: 1stream
Bitrate: 1046 k(=1024)Bits/s
Frames: 151308
FPS: 23.976
Duration: 145:11
Quality: 0.242 bits/(pixel*frame).
CompCheck3: 0.466 bits/(pixel*frame).
CompCheck5: 0.000 bits/(pixel*frame).
Resolution: 576 x 320

Audio 1:
Mode: Just Mux Source File.
SourceFile: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop AC3 T01 3_2ch 448Kbps DELAY 4ms.ac3
WavFile: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop AC3 T01 3_2ch 448Kbps DELAY 4ms.wav
Mp3File: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop AC3 T01 3_2ch 448Kbps DELAY 4ms.mp3
Azid:
Lame:
Delay: 4
Interval: 1
Preload: 500
Mux: 1
Recalc: 1
DeleteWav: 1

Audio 2:
none.

4:17:34 PM: Audio 1, determined: 345131 kb
4:17:34 PM: Audio 1, calc: 345131 kb
4:17:34 PM: New Bitrate for Movie = 1046 k(=1024)Bits/s

Adding this script to C:\PROGRA~1\GORDIA~1\nandub\LastJob.vcf :

// $job "DivX3-First Pass"
// $input "G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.avs"
// $output "G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop_Movie.avi"
// $state 0
// $start_time 0 0
// $end_time 0 0
// $script

VirtualDub.Open("G:\\BEVCOP1\\VIDEO_TS\\Beverly Hills Cop.avs",0,0);
VirtualDub.audio.SetSource(0);
VirtualDub.audio.SetMode(0);
VirtualDub.audio.SetInterleave(1,0,0,0,0);
VirtualDub.audio.SetClipMode(1,1);
VirtualDub.audio.SetConversion(0,0,0,0,0);
VirtualDub.audio.SetVolume();
VirtualDub.audio.SetCompression();
VirtualDub.audio2.SetSource(0);
VirtualDub.audio2.SetMode(0);
VirtualDub.audio2.SetInterleave(1,0,0,0,0);
VirtualDub.audio2.SetClipMode(1,1);
VirtualDub.audio2.SetConversion(0,0,0,0,0);
VirtualDub.audio2.SetVolume();
VirtualDub.audio2.SetCompression();
VirtualDub.video.SetDepth(24,24);
VirtualDub.video.SetMode(1);
VirtualDub.video.SetFrameRate(0,1);
VirtualDub.video.SetIVTC(0,0,-1,0);
VirtualDub.video.SetRange(0,0);
VirtualDub.video.SetDivX(6000,9999);
VirtualDub.video.SetQualityControl(0,0,0,0);
VirtualDub.video.SetMotionDetection(8,10,300,300);
VirtualDub.video.SetCrispness(0,0);
VirtualDub.video.SpaceKF(24);
VirtualDub.video.InternalSCD(100);
VirtualDub.video.SetMinKBPS(270);
VirtualDub.video.SetCurveFile("");
VirtualDub.video.SetCurveMcFactor(0);
VirtualDub.video.SetCurveCompression(0,0);
VirtualDub.video.SetCurveFilter(0,9999);
VirtualDub.video.SetCurveCredits(0,350);
VirtualDub.video.SetLumaCorrectionAmp(0,10,30);
VirtualDub.video.SetCurveRedist(0);
VirtualDub.video.SetCompLevelsMain(2,2);
VirtualDub.video.SetCompLevelsA(300,2,16);
VirtualDub.video.SetCompLevelsB(300,2,16);
VirtualDub.video.SetCompLevelsC(300,2,16);
VirtualDub.video.SetCompLevelsD(300,2,16);
VirtualDub.video.SetCompLevelsE(300,2,16);
VirtualDub.video.SetCompLevelK(2,4);
VirtualDub.video.SetBitsReservoir(0,100,0,100,45,100);
VirtualDub.video.SetLowBrCorrection(0,0);
VirtualDub.video.NoAVIOutput(1);
VirtualDub.video.GenStats("G:\\BEVCOP1\\VIDEO_TS\\Beverly Hills Cop.stats",1);
VirtualDub.video.SetEncodingControl("");
VirtualDub.video.filters.Clear();
VirtualDub.subset.Delete();
VirtualDub.SaveAVI("G:\\BEVCOP1\\VIDEO_TS\\Beverly Hills Cop_Movie.avi");
VirtualDub.Close();

// $endjob
//
//--------------------------------------------------
// $done

4:17:34 PM: Started DivX3-First Pass: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.avs
6:22:55 PM: Finished DivX3-First Pass: Duration: 2 hours, 5 minutes, 20 seconds.
6:22:56 PM: Speed: 20.120 Frames per Second.
6:22:58 PM: Created new stats-file: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop_1046_kbps.stats
6:22:58 PM: Created ecf: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.ecf

Adding this script to C:\PROGRA~1\GORDIA~1\nandub\LastJob.vcf :

// $job "DivX3-Second Pass"
// $input "G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.avs"
// $output "G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop_Movie.avi"
// $state 0
// $start_time 0 0
// $end_time 0 0
// $script

VirtualDub.Open("G:\\BEVCOP1\\VIDEO_TS\\Beverly Hills Cop.avs",0,0);
VirtualDub.audio.SetSource(0);
VirtualDub.audio.SetMode(0);
VirtualDub.audio.SetInterleave(1,0,0,0,0);
VirtualDub.audio.SetClipMode(1,1);
VirtualDub.audio.SetConversion(0,0,0,0,0);
VirtualDub.audio.SetVolume();
VirtualDub.audio.SetCompression();
VirtualDub.audio2.SetSource(0);
VirtualDub.audio2.SetMode(0);
VirtualDub.audio2.SetInterleave(1,0,0,0,0);
VirtualDub.audio2.SetClipMode(1,1);
VirtualDub.audio2.SetConversion(0,0,0,0,0);
VirtualDub.audio2.SetVolume();
VirtualDub.audio2.SetCompression();
VirtualDub.video.SetDepth(24,24);
VirtualDub.video.SetMode(1);
VirtualDub.video.SetFrameRate(0,1);
VirtualDub.video.SetIVTC(0,0,-1,0);
VirtualDub.video.SetRange(0,0);
VirtualDub.video.SetDivX(1046,12);
VirtualDub.video.SetQualityControl(0,0,0,0);
VirtualDub.video.SetMotionDetection(8,10,300,300);
VirtualDub.video.SetCrispness(100,0);
VirtualDub.video.SpaceKF(24);
VirtualDub.video.InternalSCD(100);
VirtualDub.video.SetMinKBPS(270);
VirtualDub.video.SetCurveFile("G:\\BEVCOP1\\VIDEO_TS\\Beverly Hills Cop_1046_kbps.stats");
VirtualDub.video.SetCurveMcFactor(0);
VirtualDub.video.SetCurveCompression(0,0);
VirtualDub.video.SetCurveFilter(0,9999);
VirtualDub.video.SetCurveCredits(0,350);
VirtualDub.video.SetLumaCorrectionAmp(0,10,30);
VirtualDub.video.SetCurveRedist(0);
VirtualDub.video.SetCompLevelsMain(2,16);
VirtualDub.video.SetCompLevelsA(300,2,16);
VirtualDub.video.SetCompLevelsB(300,2,16);
VirtualDub.video.SetCompLevelsC(300,2,16);
VirtualDub.video.SetCompLevelsD(300,2,16);
VirtualDub.video.SetCompLevelsE(300,2,16);
VirtualDub.video.SetCompLevelK(2,4);
VirtualDub.video.SetBitsReservoir(0,35,30,70,10,0);
VirtualDub.video.SetLowBrCorrection(0,0);
VirtualDub.video.NoAVIOutput(0);
VirtualDub.video.GenStats("",1);
VirtualDub.video.SetEncodingControl("G:\\BEVCOP1\\VIDEO_TS\\Beverly Hills Cop.ecf");
VirtualDub.video.filters.Clear();
VirtualDub.subset.Delete();
VirtualDub.SaveAVI("G:\\BEVCOP1\\VIDEO_TS\\Beverly Hills Cop_Movie.avi");
VirtualDub.Close();

// $endjob
//
//--------------------------------------------------
// $done

6:22:58 PM: Started DivX3-Second Pass: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.avs
8:20:09 PM: Finished DivX3-Second Pass: Duration: 1 hour, 57 minutes, 10 seconds.
8:20:10 PM: Speed: 21.521 Frames per Second.

Adding this script to C:\PROGRA~1\GORDIA~1\VirtualDubMod\LastJob.vcf :

// $job "DivX5 Append"
// $input "G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop_Movie.avi"
// $output "G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.avi"
// $state 0
// $start_time 0 0
// $end_time 0 0
// $script

VirtualDub.Open("G:\\BEVCOP1\\VIDEO_TS\\Beverly Hills Cop_Movie.avi",0,0);
VirtualDub.RemoveInputStreams();
VirtualDub.stream[0].SetSource("G:\\BEVCOP1\\VIDEO_TS\\Beverly Hills Cop AC3 T01 3_2ch 448Kbps DELAY 4ms.ac3",0x00000203,0);
VirtualDub.stream[0].SetMode(0);
VirtualDub.stream[0].SetInterleave(1,500,1,0,4);
VirtualDub.stream[0].SetClipMode(1,1);
VirtualDub.stream[0].SetConversion(0,0,0,0,0);
VirtualDub.stream[0].SetVolume();
VirtualDub.stream[0].SetCompression();
VirtualDub.video.SetDepth(24,24);
VirtualDub.video.SetMode(0);
VirtualDub.video.SetFrameRate(0,1);
VirtualDub.video.SetIVTC(0,0,-1,0);
VirtualDub.video.SetRange(0,0);
VirtualDub.video.SetCompression();
VirtualDub.video.filters.Clear();
VirtualDub.subset.Delete();
VirtualDub.SaveAVI("G:\\BEVCOP1\\VIDEO_TS\\Beverly Hills Cop.avi");
VirtualDub.Close();

// $endjob
//
//--------------------------------------------------
// $done

8:20:10 PM: Started Muxing Audio.: G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop_Movie.avi
8:23:58 PM: Finished Muxing Audio.: Duration: 3 minutes, 48 seconds.

8:23:58 PM: Done.
8:23:58 PM: Movie = G:\BEVCOP1\VIDEO_TS\Beverly Hills Cop.avi
Total Encoding Time: 4 hours, 6 minutes, 24 seconds.
7/12/2003 8:23:58 PM: Job " 1" finished.
_______________________________________________________________________________________________________________________

ChrisF
13th July 2003, 23:01
FYI - I am watching the other similar thread ' Newbie Synch Issues ' as it looks like we may have a similar problem. Still, I am careful to watch that GKnot picks up the appropriate delay from the AC3 file name. Not sure what is causing our problems here.

manono
14th July 2003, 04:23
Hi ChrisF and welcome to the forum.

The delay isn't the problem. 4 ms is only 1/250th of a second, and the ears can't usually pick up asynch unless it's around 100 ms, or a tenth of a second.

Those preload and interleaving defaults won't work well for AC3 audio. I always mux mine outside of GKnot, and the closest equivalent in GKnot is 3 frames and 96 ms (I think). To fix the one you already have, open it in Nandub, set Video to Direct Stream Copy. Then go Audio-Interleaving and set both Preload and Interleaving to 96ms and enter the delay. Then Save As AVI under a different name. Then you should be all set (I hope).

There's more information in the AC3 Q&A (http://forum.doom9.org/showthread.php?s=&threadid=18318) which will tell you, among other things, how to mux using AVIMux GUI (Question 7).

ChrisF
14th July 2003, 13:00
Thanks for the reply - didn't work though.

I used the left over X_Movie.avi without the audio and utilized Nandub. Direct Stream on Video. Loaded the AC3 sound setting 96ms as both the preload and Interleave. Entered 4ms for the delay as the AC3 file says.

Sound is way off from video. The video looks good and the sound file 'sounds good' but this is happening on over 50% of my rips now - I feel lucky if I even get one that goes right.

I'm going to read AVIMux GUI next but is there anything in the settings that you think is causing this? I'm not using 48to44.1 in DVD to AVI (I think this is a good thing). Bitrates seem reasonable - I'm only muxing the basic audio track with no reediting (if I can't get this to work why mess with it). Using forcefilm as it is progressive/film >95% and if I don't I get the 29 fps speed when I open the DVDtoAVI file in GKnot. I guess with all these errors I wish I was doing something blatantly wrong with an easy fix. Could it possibly be the speed of my machine causing issues (Cel 1.4Ghz - 256MB PC100).

BTW - noticed you're from Hawaii. Don't happen to surf do you? You guys had an excellent winter and pics from Ala Moana on that big south looked impressive. Unfortunately I am stuck in Pittsburgh for grad school right now.

manono
14th July 2003, 14:26
Hi-

OK, so it is the delay. Because you were using the default Preload and Interleaving settings, I figured it was because of that (although you still shouldn't use them for AC3). Those default settings are liable to leave you with stuttering, jerky play. But they're fine for MP3.

We might have to go back to the beginning then. When decrypting the vob files to the hard drive, you use Movie Mode in SmartRipper, or IFO Mode in DVDDecrypter. You want only the main movie files, and not any of the extra stuff, such as the FBI Warning or any other pre-movie junk. If you have gotten any of that, then that would account for the audio asynch.

In any event, it's still easy to fix, assuming the amount of asynch is the same all the way through the movie. First you have to figure roughly how much it's off. If, for example, the sound comes out about 1 second before the lips move, then you need to adjust the delay by 1000 ms. So, follow the instructions in my previous post, but adjust the delay. It might take 3 or 4 tries to get it right. One way to get a good idea of the delay you need to use is to open the AC3 in HeadAC3he (in the Audio portion of the Downloads area). It'll tell you exactly how long the audio is. Ordinarily it's the same length as the movie (and you can get its length by opening it in Nandub and going to the end). You seem to be saying that the audio is of a different length than the movie, and that shouldn't be.

This doesn't explain why so many of your movies have asynch audio, but it should fix up the ones you've done already. But everything you mentioned is OK. The sample rate is OK, Force Film is OK. The CPU speed has nothing to do with it (it only affects the encoding speed). But I expect it's something really basic as most people don't have asynch on 50% of their movies. I see it only once in a blue moon.

I'm on the Big Island, and saw nothing of Ala Moana this past winter. I don't surf anyway. I like to stay dry on my boat these days, rather than getting wet. :)

len0x
14th July 2003, 18:06
Originally posted by manono
Those preload and interleaving defaults won't work well for AC3 audio.

I just wonder why? Coz I never had any problems within GK (all I do is AC3 sound...). May be it's playback problem ?

*Edit* if you play it on comp...

manono
15th July 2003, 03:30
Hi len0x-

Beats me. You'd have to ask someone that knows about audio. I've read it, and sometimes when I leave it at default 1/500 by mistake, it doesn't play well, whereas 96/96 always works for me. In the AC3 Q&A they used to have a big section about why the defaults don't work with Nandub, and suggested settings for different bitrates. But they took that out since they switched to AVIMux GUI. I'm sure there's someone around here that knows the reason.

ChrisF
15th July 2003, 12:11
So are there varying settings for muxing correct sound. I also leave the defaults at 1/500 (I was thinking about this yesterday). Is this the best way to do it?

FYI - I had some success with another movie but have yet to fix BHsCop yet. Too busy to mess with it today.

manono
15th July 2003, 13:46
Hi-

Yeah, when using Nandub for muxing, they used to have a bunch of different settings to try for different bitrate AC3 audio. But 96/96 has always worked for me. If you use the defaults, go find a panning scene in the movie (camera movement from left to right or right to left), and if it plays jerky, it's almost certainly because of the audio interleaving/preload. You can compare the same scene in the movie without the audio, and it'll play smoothly.

Evidently AVIMux GUI works well at the default settings, but I've been too lazy to switch.

len0x
15th July 2003, 13:48
Originally posted by manono
Evidently AVIMux GUI works well at the default settings, but I've been too lazy to switch.

what about current VDubMod ?

manono
15th July 2003, 14:03
Hi len0x-

VDubMod for muxing AC3? I don't know, as I've never tried it. I'll try it next time with the defaults. I don't use it for muxing because it always gives out with that nasty message whenever I try to mux VBR MP3 with it. Like I'm doing something wrong or something. :)

len0x
15th July 2003, 16:06
Originally posted by manono
Hi len0x-

VDubMod for muxing AC3? I don't know, as I've never tried it. I'll try it next time with the defaults. I don't use it for muxing because it always gives out with that nasty message whenever I try to mux VBR MP3 with it. Like I'm doing something wrong or something. :)

GK uses VDubMod for muxing for a while now... I think all the issues from NanDub were fixed there...

P.S. message doesn't harm anybody :)

ChrisF
15th July 2003, 18:52
FYI - the movie "The Natural" just came out botched too. Muxing within Gknot at the default 1/500ms was way out of synch. Remuxing again with Nandub outside of Gkit using 96/96 also resulted in the sound several seconds ahead.

I am definitely in IFO mode with DVD Decrypter.

I'm currently trying to convert the AC3 track to 128KB MP3 with BeSweet GUI and remux again. If that fails I'll use the MP3 sound within GKot and do a complete reencoding. Last night I used MP3 (from BeSweet) to make Cider House Rules and it came out perfect the first time.

I still have no idea what is going on with this thing. I have read and re-read every tutorial and 50% of the movies turn out while 50% don't. My process is identical each time. Very frustrating.

Brother John
15th July 2003, 21:14
Originally posted by len0x
what about current VDubMod ?
When I remember the big AC3 muxing thread: It depends. For some people it's ok, for some it's not.
Personally I still have that jerky playback problem, though much less than with Nandub. My only definitely working solution for muxing AC3 into AVI is AVIMux GUI (some people even had problems with AVIMux).

Iirc there also were issues with VDubMod splitting AC3 frames in half while splitting a movie. That caused problems on the 2nd CD starting with a broken audio frame. Though I never could verify that.

Conclusion: Apparently there's no working-perfectly-on-every-machine solution for muxing AC3 into AVI.

ChrisF
16th July 2003, 04:02
PROBLEM SOLVED!!!

After working through the file 'The Natural 9' (I reset once on 5 - not joking sadly), I couldn't get the audio right. It seemed to move disproportionately to my adjustments when I remuxed using Nandub after adjusting the delay each time.

Then in the middle of playing Natural 9 I moved forward to my second check point and then back to the first. I noticed that the first played at a different lag than what I had just witnessed a few moments ago. Messed with it some more and convinced myself it might be playback on my PC as LenOx suggested before.

I can also play the videos over my network on my Xbox downstairs so I shared the working folders of the Natural and Beverly Hills Cop (never even tried to fix BHC). Damned if the first versions didn't work perfectly streaming down. What an unbelievable PITA but better that I know not to trust my PC playback now.

Thank you all for your help and insight. I knew it had to be something stupid but I never thought that it was the PC messing up since I can routinely play other files perfectly. Oh well - I can move on with my life and encoding now.

ChrisF

EDIT - BenHur was still messed up but I used the delay method to fix it this morning. Seems to be working smoothly now that I check my results without Windows Media Player.

maf
17th October 2003, 05:49
I like happy endings :)