PDA

View Full Version : changing the duration of a clip


audyovydeo
7th May 2008, 15:58
Is it possible to change a clip (or a single frame's) duration in avisynth ?

I work with DV/PAL footage as input, and routinely need to slow clips down to 1/10th of the speed, sometimes even 1 frame = 1 second.

Note that I don't want to change the framerate of my clip, merely extend each frame's duration, but still outputting 25fps video.

thanks
audyovydeo

neuron2
7th May 2008, 16:13
Do ChangeFPS() first to add duplicate frames. Then use AssumeFPS() to set the frame rate back to 25fps.

audyovydeo
7th May 2008, 18:11
ChangeFPS() ... then use AssumeFPS() ...

thanks, I'll try that

cheers
a/v

thetoof
7th May 2008, 19:44
This (http://forum.doom9.org/showthread.php?t=137515) thread could help you too. Also, for more duplicates of a single frame, you can use the loop() function by selecting only 1 frame and make it loop x times (and the duration of the clip will change).

audyovydeo
7th May 2008, 20:26
This (http://forum.doom9.org/showthread.php?t=137515) thread could help you too. Also, for more duplicates of a single frame, you can use the loop() function by selecting only 1 frame and make it loop x times (and the duration of the clip will change).


Thanks. Actually I want to make slow motion of sports shoots.
I may want to slow a certain sequence to 50%, another to 10% of the speed, etcetera.

I'm used to doing it in Premiere, but was wondering if there was an easy way in avisynth.


neuron : your suggestion - predictably - works flawlessly, but I have to come to grips with the logic of those two commands.

thanks
a/v

neuron2
7th May 2008, 21:00
neuron : your suggestion - predictably - works flawlessly, but I have to come to grips with the logic of those two commands. It's simple. When you do ChangeFPS(50) on a clip that starts as 25fps, then each frame gets doubled so that the length of the clip remains the same when it is played back at 50fps. Then when you do AssumeFPS(25), the play rate is set back to 25fps and the number of frames is not changed. The end result is each frame is doubled but the clip plays at the same rate so it appears to be half speed. You could also do half-speed by:

vid=AviSource()
interleave(vid,vid)

That is a more direct way to double the frames. The solution I gave allows for abitrary slow-downs.

For 50% when you have interlaced video, it's better to bob and then set the frame rate back. You retain all the temporal resolution of the clip.

thetoof
7th May 2008, 21:08
For an even better motion compensation when adding a lot of frames to display some movement, mvflowfps is quite useful (mvtools' documentation explains well how to do this)
If you want to apply this slowdown to small parts of your clip, you can do this (be aware that I actually never tried it & I can't test it atm, but from what I know, it should work):
a=source.trim(2344,9834) # beginning of "normal speed" sequence to the frame right before "slow motion" sequence
b=source.trim(start of slow-mo,end of slow-mo).mvflowfps(some settings).assumefps(25)
c=source.trim(frame after slow-mo, frame before next slow-mo)
#repeat every time you want to slow down your clip
a++b++c # ++e++f++g++h etc etc etc
To ajust audio:
audioforb=sourcewithaudio.trim(same values of "b=".assumefps(new framerate for "b" before assumefps, true)
# add the following to the "b=" line
.audiodub(audioforb)