View Full Version : Trim video sections with slow motion
sekininsha
25th August 2009, 02:01
Hi,..
attempt to recode a video of 4 minutes approximately with 6000 frame, but to apply slow motion in three parts,
I tried this script for example, but I am not clear..
DirectShowSource("C:\....\test .avi")
vid1=trim(0,975)
vid2=trim(976,1911)
SeparateFields()
LanczosResize(624,344)
AssumeFPS(23.976)
vid3=trim(1912,0)
vid1++vid2++vid3
get this error:
Splice: Frame sizes don't match
(C:\.......................\test.avs, line 8)
is this possible ? :(
thanks ..
thewebchat
25th August 2009, 02:16
AviSynth works with frames and not timecodes, so to make a part of the video run slower (increase the length), what you should do is first ChangeFPS(original_framerate*slowdown) and then do AssumeFPS(original_framerate). I am also going to assume that you do not want to run SeparateFields/LanczosResize on only vid3, but rather on the entire source. See this example:
DirectShowSource("C:\....\test .avi")
SeparateFields()
LanczosResize(624,344)
AssumeFrameBased()
original_framerate = last.framerate
vid1 = Trim(0,1950)
vid2 = Trim(1952,3822)
Trim(3824,0)
ChangeFPS(original_framerate*original_framerate/23.976)
AssumeFPS(original_framerate)
vid3 = last
vid1 ++ vid2 ++ vid3
Gavino
25th August 2009, 09:49
vid1 = Trim(0,1950)
vid2 = Trim(1952,3822)
Should be 1951 in vid1 and 3823 in vid2.
Actually, it's not clear why vid1 and vid2 exist separately in the original script since they are consecutive, they are split out and joined back together without any processing. Makes me wonder if the idea was to apply slow motion only to vid2 and not vid3.
sekininsha
25th August 2009, 14:30
thewebchat , Gavino , thanks for your answers ..
The idea is to slow motion by three small parts of the video, for example, from 1951 to 2100, From 3000 to 3200, from 4000 to 4300 .. and the rest in normal video and all together.
normal-slow-normal-slow-normal-slow-normal. (video to 23.976 fps)
I will try the script, ... ok
sekininsha
26th August 2009, 18:57
Hi ,..
well, I've tried and can not load the file .avs, get the following error :
Splice: Video framerate doesn't match
C:\....................\Escritorio\avstest.avs, line 12)
thanks for you help ..
Gavino
26th August 2009, 19:42
Please :script:
sekininsha
26th August 2009, 23:42
thanks Gavino,...
the script is the recommended by thewebchat
DirectShowSource("C:\....\test .avi")
SeparateFields()
LanczosResize(624,344)
AssumeFrameBased()
original_framerate = last.framerate
vid1 = Trim(0,1950)
vid2 = Trim(1952,3822)
Trim(3824,0)
ChangeFPS(original_framerate*original_framerate/23.976)
AssumeFPS(original_framerate)
vid3 = last
vid1 ++ vid2 ++ vid3
and then with the change recommended by you, in ..
vid1 = Trim(0,1950)
vid2 = Trim(1952,3822)
but do not understand, do not load VDM or my MPC, always shows the same error in the line 12 ..
:thanks:
thewebchat
26th August 2009, 23:59
I'm not sure what you're doing, but the script I posted works when I load one of the files I have lying around and run AVISource() on it.
Gavino
27th August 2009, 00:05
In principal, that script should work since vid1, vid2 and vid3 all have the same framerate given by 'original_framerate'. However, it is possible that they do not match exactly because of rounding approximations. Try this
DirectShowSource("C:\....\test .avi")
SeparateFields()
LanczosResize(624,344)
AssumeFrameBased()
original_framerate = last.framerate
original_numerator = last.framerateNumerator
original_denominator = last.framerateDenominator
vid1 = Trim(0,1951)
vid2 = Trim(1952,3823)
Trim(3824,0)
ChangeFPS(original_framerate*original_framerate/23.976)
AssumeFPS(original_numerator, original_denominator)
vid3 = last
vid1 ++ vid2 ++ vid3
kemuri-_9
27th August 2009, 00:20
why don't you just do an AssumeFPS(vid1) there instead of actually figuring out the exact framerate?
sekininsha
28th August 2009, 06:22
Hi, .. thanks
Yes, Gavino script now loads, but does the slow motion, start in the frame 729 (keyframe) until the end ..
DirectShowSource("C:\....\test .avi")
SeparateFields()
LanczosResize(624,344)
AssumeFrameBased()
original_framerate = last.framerate
original_numerator = last.framerateNumerator
original_denominator = last.framerateDenominator
vid1 = Trim(0,1951)
vid2 = Trim(1952,3823)
Trim(3824,0)
ChangeFPS(original_framerate*original_framerate/23.976)
AssumeFPS(original_numerator, original_denominator)
vid3 = last
vid1 ++ vid2 ++ vid3
I'll try some changes, but I want the video sequence: normal-slow-normal-slow-normal ...
thank all ,.. I really do appreciate it.
ありがとう
Gavino
28th August 2009, 09:18
It wasn't clear from your original script which parts you wanted to slow down, so the solutions posted earlier did not match your expectations. Here's a revised version, changing the method slightly and incorporating kemuri-_9's suggestion.
DirectShowSource("C:\....\test .avi")
SeparateFields()
LanczosResize(624,344)
AssumeFrameBased()
original = last
vid1 = Trim(0,1951)
vid2 = Trim(1952,3823).AssumeFPS(23.976).ChangeFPS(original)
vid3 = Trim(3824, ...)
vid4 = Trim(...,...).AssumeFPS(23.976).ChangeFPS(original)
vid5 = Trim(..., 0)
vid1 ++ vid2 ++ vid3 ++ vid4 ++ vid5
You will have to fill in the frame numbers for vid3, vid4 and vid5.
I hope you can see the pattern and how to change it to add more sections as you want.
JohannesL
29th August 2009, 13:29
I made a function for this. Search for RangeFPS.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.