PDA

View Full Version : Framerate conversion keeping audio in sync?


dwallersv
15th April 2006, 23:42
Very simply, how?

I have some source material that I imported with my capture card in 24fps (stupidly), and want to put it on a DVD for mom and dad. However, I have to convert it to 29.97 to do that.

I've tried DGPulldown, avisynth with ConvertFPS, and always end up with areas of the video that are out of sync with the audio -- no doubt because of the added frames.

Any tools to do this easily? Isn't PCM audio timecoded (as are the frames in Xvid and other compressed video formats like MPEG2) so that it can be "resync'd" by adjusting the video?

setarip_old
16th April 2006, 02:39
Is the video in .AVI format? If so, load the file into VirtualDub, VirtualDubMod, or NanDub.
Set BOTH "Video"(VirtualDub, VirtualDubMod and NanDub) and "Audio"
(VirtualDub and NanDub - VirtualDubMOD>"Streams>"Stream list") to "Direct Stream Copy".

A) If the difference between audio and video is constant throughout the

video:

From the "Audio" dropdown menu, select "Interleaving" (For

VirtualDubMOD, rightclick on the listed audiostream and then select

"Interleaving")
Under "Audio skew correction", set an appropriate number of

milliseconds (positive or negative) in the box labelled "Delay audio track

by"
Save with a new filename


B) If the difference increases as the movie plays:

From under the "Video" dropdown menu, select "Framerate" - and

select "Change so video and audio durations match"
Save with a new filename

Let us know of your success ;>}

dwallersv
16th April 2006, 17:08
Some more "investigation" has uncovered that the problem is a straight linear difference -- the WAVs produced by BeSweet are always a tad longer than the transcoded video, by usually 3-15 seconds. By simply adjusting the audio with the rate stretch tool in Adobe Premiere Pro to match the length of the video, everything syncs up nicely, and the change in rate (say, 10 seconds change on a 30 minute video) is imperceptible from a pitch standpoint.

So now the real question :) I have a VBScript driver that I've written to automate converting all these home movie AVIs to NTSC MPEG via HC and WAV via BeSweet. The million dollar Q: How do I programatically determine the exact time length of the M2V, then pass this in to BeSweet to do the stretch (in this case "unstretch") of the WAV when extracting it?

The two things I need help on:

How do I extract the exact time of the video in a script? Is there a tool that will do this and return it as standard out or something that I can grab in VBScript?
once I have this datum, what are the right command line switches for BeSweet to perform an overall stretch/compress of the audio to fit this precise timescale?

I've been all over the forum searching, looked through what BeSweet documentation I can find (there isn't much), and frankly, I'm really confused by BeSweet. It's an awesome tool, and I thank DSPGuru profusely, but I am quite a dufus at figuring out how to use its more powerful capabilities. Heck, I basically stumble around with the GUI most of the time and just barely know what I'm doing.

Thanks in advance for any help, gang!

manono
17th April 2006, 14:56
Hi-

The only way I know to get the correct length from an M2V is to make a D2V project file from it in DGIndex, use it in an AviSynth script file, and then open it in VDubMod. Maybe there are other ways as well.

However, I question the need to stretch the audio. The original captured AVI (or whatever it is) was in synch, right? You say you didn't have any luck using DGPulldown. Did you use a custom setting of 24->29.97fps? And how did you encode it to MPV in the first place? Using CCE? And using a 24fps framerate? In any event, if you got the same length out of your encoder as the original, then a proper use of DGPulldown won't change that length.

And if you want to stretch the audio, use the GUI to do it. I've done it quite a bit for AVI where I've changed the framerare. It has a box for "Change Framerate From xxxx To xxxx." Someone else will have to help with the command line. I purposely don't know the first thing about them.