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 > VirtualDub, VDubMod & AviDemux

Thread Tools Search this Thread Display Modes
Old 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:

declare infil;
declare stretchfil;
declare outfil;
declare ratio;
declare fps;
declare audiosrate;

fps = 25;
audiosrate = 44100;




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.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);

vemon is offline   Reply With Quote
Old 25th September 2008, 00:50   #2  |  Link
Registered User
setarip_old's Avatar
Join Date: Aug 2005
Posts: 16,274

Looks like more work than may be necessary.

1) Set VirtualDub's "Video" to "Direct Stream Copy"

2) Set "Framerate" function (From "Video" dropdown menu) to "Change so video and audio durations match" and then,

3) Use VirtualDub's "Job control" function (From "File" dropdown menu) to select all of the files you want to process...
setarip_old is offline   Reply With Quote
Old 25th September 2008, 10:50   #3  |  Link
Registered User
Join Date: Jul 2008
Posts: 2
I also thought it was possible to just adjust the video framerate to achieve this but it seems to do nothing at all. That's why I created my script in the first place.

Although I think I used "Full processing mode" when adjusting the framerate. Could this prevent it from working?

Just tested with "Direct Stream Copy" and still no effect when adjusting the source framerate.

Last edited by vemon; 25th September 2008 at 11:13.
vemon is offline   Reply With Quote

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 04:45.

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