PDA

View Full Version : Make blankclip same length as audio


AlanHK
9th July 2009, 20:46
I have an audio file I want to run through Avisynth.
The tools are happier if there is a matching video.
I can do

BlankClip()
AudioDub(DirectShowSource("audio.mp4"))

But while usable, the video is only 10 seconds long.

Is there a way to make the video the same length as the audio (aside from calculating it by hand for each file)?

I tried
a=DirectShowSource("audio.mp4")
AssumeFPS(a,25)
BlankClip(FrameCount(a),fps=25)
AudioDub(a)

Which gives me a clip 0 frames long.

J_Darnley
9th July 2009, 20:50
BlankClip( length=ceil( your_framerate * (AudioLengthF/AudioRate) ), fps=your_framerate )
Replace (or set) your_framerate with the value you want to use.

AlanHK
10th July 2009, 10:10
Thanks; that works.