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. |
|
|
Thread Tools | Search this Thread | Display Modes |
24th September 2008, 22:14 | #1 | Link |
Registered User
Join Date: Jul 2008
Posts: 2
|
Fixing progressive out of sync audio with VirtualDub script
I've managed to record a bunch of video clips using CamStudio + ffdshow (uncompressed video & pcm audio) which all have different length audio and video tracks (audio track is always shorter than video track). I'm not sure what's the source of the problem since uncompressed video shouldn't introduce any compressing overhead.
Anyways... I created a VirtualDub script to fix the problem but it still has some issues. I'm only able to calculate the desired time stretch ratio for the audio track by manually entering the video frame rate and the audio sampling rate. If these could be determined programmatically I would have a completely automatic script for fixing my video clips. My question is: Does anyone know if it's possible to get the video frame rate and the audio sampling rate in a VirtualDub script? At the moment my script looks like this: Code:
declare infil; declare stretchfil; declare outfil; declare ratio; declare fps; declare audiosrate; fps = 25; audiosrate = 44100; VirtualDub.Open(VirtualDub.params[0],0,0); VirtualDub.video.SetMode(0); VirtualDub.audio.SetSource(1); VirtualDub.audio.SetMode(1); VirtualDub.audio.EnableFilterGraph(1); VirtualDub.audio.filters.Clear(); infil = VirtualDub.audio.filters.Add("input"); stretchfil = VirtualDub.audio.filters.Add("time stretch"); ratio = (((double)VirtualDub.video.length / fps) - 1) / ((double)VirtualDub.audio.length / audiosrate); VirtualDub.Log("calculated stretch ratio:"); VirtualDub.Log(Sylia.ToString(ratio)); VirtualDub.audio.filters.instance[stretchfil].SetDouble(0, ratio); VirtualDub.audio.filters.Connect(infil, 0, stretchfil, 0); outfil = VirtualDub.audio.filters.Add("output"); VirtualDub.audio.filters.Connect(stretchfil, 0, outfil, 0); VirtualDub.SaveAVI(VirtualDub.params[1]); |
Thread Tools | Search this Thread |
Display Modes | |
|
|