Log in

View Full Version : Auto of sync audio when doing VFR


DarkT
28th February 2007, 14:44
Hi,

I have this anime video which, after I do Tdecimate, loses fluidity.

I tried different modes, I tried adding hybrid, well, let' say that I've tried ~12 different encoding ways :).

The only thing which helps solve the fluidity problem, is doing it with the 2-pass-for-vfr method, BUT that creates an audio problem... The audio becomes auto of sync.

Here is the IVTC related part of the scrypt:

1st pass:

assumetff()
interp = separatefields().SelectEven().eedi2(field=-1,pp=3)
deint = tdeint(mode=0,Order=1,type=1,AP=55,edeint=interp,slow=2)
tfm(d2v=d2vpath,clip2=deint,output="ep1-tfm.txt")
tdecimate(mode=4,denoise=true,output="ep1-tdec.txt")

2nd pass:

interp = separatefields().SelectEven().eedi2(field=-1,pp=3)
deint = tdeint(mode=0,Order=1,type=1,AP=55,edeint=interp,slow=2)
tfm(input="ep1-tfm.txt",d2v=d2vpath,clip2=deint)
tdecimate(mode=5,hybrid=2,denoise=true,input="ep1-tdec.txt",tfmIn="ep1-tfm.txt",mkvOut="ep1-timecodes.txt")

I just noticed that 2nd pass has no assumetff() line, and I'll add it and re-encode, though - I doubt that that's the root of it all...

Please advise.

DarkT
28th February 2007, 16:17
Problem solved...

The way I worked was 1st pass=lagarith(loseless), 2nd pass = lagarith.

I checked with that, and the audio was out of sync... So I tried troubleshooting it on that level.

Here's the thing - I never went forward to the next step, because I figured, what's the point? Mistake... Once I Muxed the timecodes and the 2nd pass .avi file into .mkv file - the audio file was no longer out of sync!

I still don't understand what's up and how things work and why this fixed it, but it certainly is the solution which was prolly always meant to be used... I just wish I understood what the heck is going on :).

foxyshadis
1st March 2007, 08:59
Mmm, you can think of it this way: VFR leaves holes in a stream (or sticks extras in, depending on your perspective). AVI can't handle those irregular missing frames, so it spaces everything evenly apart, while the timecodes keep track of which areas are supposed to have holes. So when you mux them together in mkv, the timecodes are recorded in the stream and the player (the DirectX renderer, actually) will allow an extra span of time to go by at the appropriate places to compensate for the holes.

This more literally applies to frame-skipping, like DeDup and WMV, whereas hybrid vfr is more like adding up small nudges or perturbations to frames; at any point you have enough nudging to add up to all the dropped frames, which is how audio stays in sync.

And anyway, in DirectShow there's no framerate, there's only timecodes, so you can be as wild as you want with the display rate. That gets especially useful with flash-to-mkv conversions.