Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

Pages: (2) 1 [2]  ( Go to first unread post )
Speeding Up Sections Of A Video.
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
raffriff42
Posted: Sep 25 2013, 09:23 PM


Advanced Member


Group: Members
Posts: 384
Member No.: 35081
Joined: 25-June 12



QUOTE (Virtualnoob123 @ Sep 25 2013, 09:23 PM)
Ok, this seems to work just fine now:

CODE

#avisynth
## speed change test:
##   half speed from frame 0 to frame 29;
##   130% speed from frame 30 to frame 149
##   normal speed to end of video

V=AviSource ("D:\Movie Folder\Kharg Island\Scout vs stinger noob 45fps.avi")

return UUChangeSpeed(Trim(V, 0, 500), 1)
\    + UUChangeSpeed(Trim(V, 501, 1000), 4)
\    + Trim(V, 1000, 0)

function UUChangeSpeed(clip c, float factor)
{
 oldRate = FrameRate(c)
 newVid = AssumeFPS(c, oldRate * factor)
 return AudioDub(ChangeFPS(newVid, c), c.TimeStretch(tempo=100*factor))
}


But for some reason instead of being 4 speed from 501-1000 frames it goes back to normal at around 600-650 frames.  And stays normal speed to the end of the video.

That's because frames were removed to speed up the video. cool.gif
 
     Top
Virtualnoob123
Posted: Sep 25 2013, 09:26 PM


Member


Group: Members
Posts: 11
Member No.: 37179
Joined: 25-September 13



I added that piece of code to mine like this:

CODE

#avisynth
## speed change test:
##   half speed from frame 0 to frame 29;
##   130% speed from frame 30 to frame 149
##   normal speed to end of video

V=AviSource ("D:\Movie Folder\Kharg Island\Scout vs stinger noob 45fps.avi")

return Trim(V, 0, 500)
\    + UUChangeSpeed(Trim(V, 501, 1000), 4)
\    + Trim(V, 1001, 0)

function UUChangeSpeed(clip c, float factor)
{
 oldRate = FrameRate(c)
 newVid = AssumeFPS(c, oldRate * factor)
 return AudioDub(ChangeFPS(newVid, c), c.TimeStretch(tempo=100*factor))
}


And got the same resaults. Goes back to normal speed at around 600-650!
 
     Top
raffriff42
Posted: Sep 25 2013, 09:33 PM


Advanced Member


Group: Members
Posts: 384
Member No.: 35081
Joined: 25-June 12



OK this change to the code will show what's happening with the source frames.
As mentioned in the comment, when done debugging, add a "#" in front of the "ShowFrameNumber" line to disable it
CODE
#avisynth

V=AviSource ("D:\Movie Folder\Kharg Island\Scout vs stinger noob 45fps.avi")

## debugging: show the original frame number from the source video
## (when done debugging, add a "#" in front of this line to disable it)
V=V.ShowFrameNumber()

return UUChangeSpeed(Trim(V, 0, 500), 1)
\    + UUChangeSpeed(Trim(V, 501, 1000), 4)
\    + Trim(V, 1000, 0)

function UUChangeSpeed(clip c, float factor)
{
oldRate = FrameRate(c)
newVid = AssumeFPS(c, oldRate * factor)
return AudioDub(ChangeFPS(newVid, c), c.TimeStretch(tempo=100*factor))
}
 
     Top
Virtualnoob123
Posted: Sep 25 2013, 09:34 PM


Member


Group: Members
Posts: 11
Member No.: 37179
Joined: 25-September 13



QUOTE (raffriff42 @ Sep 25 2013, 09:23 PM)
QUOTE (Virtualnoob123 @ Sep 25 2013, 09:23 PM)
Ok, this seems to work just fine now:

CODE

#avisynth
## speed change test:
##   half speed from frame 0 to frame 29;
##   130% speed from frame 30 to frame 149
##   normal speed to end of video

V=AviSource ("D:\Movie Folder\Kharg Island\Scout vs stinger noob 45fps.avi")

return UUChangeSpeed(Trim(V, 0, 500), 1)
\    + UUChangeSpeed(Trim(V, 501, 1000), 4)
\    + Trim(V, 1000, 0)

function UUChangeSpeed(clip c, float factor)
{
 oldRate = FrameRate(c)
 newVid = AssumeFPS(c, oldRate * factor)
 return AudioDub(ChangeFPS(newVid, c), c.TimeStretch(tempo=100*factor))
}


But for some reason instead of being 4 speed from 501-1000 frames it goes back to normal at around 600-650 frames.  And stays normal speed to the end of the video.

That's because frames were removed to speed up the video. cool.gif

Well, how do I get the video to speed up from frame 501-1001 and not drop off 400 frames too early?! biggrin.gif
 
     Top
raffriff42
Posted: Sep 25 2013, 09:49 PM


Advanced Member


Group: Members
Posts: 384
Member No.: 35081
Joined: 25-June 12



Just watch the video, it works I promise you. I guess I fail at explaining.
 
     Top
Virtualnoob123
Posted: Sep 25 2013, 09:59 PM


Member


Group: Members
Posts: 11
Member No.: 37179
Joined: 25-September 13



QUOTE (raffriff42 @ Sep 25 2013, 09:49 PM)
Just watch the video, it works I promise you. I guess I fail at explaining.

Yes, you have solved my problem and thanks.

It's just I want to stop the speeded up section on frame 1000, but it drops off at 650. Guess I just add 450 frames to the code.





 
     Top
meowmeow
Posted: Sep 27 2013, 03:17 PM


Advanced Member


Group: Members
Posts: 98
Member No.: 37160
Joined: 21-September 13



Thanks! Nice, nice code works with both video & audio only. And those frames which lost - they're lost while maintaining same FPS at shorter time.
 
     Top
malky
Posted: Sep 28 2013, 10:13 AM


Advanced Member


Group: Members
Posts: 290
Member No.: 22386
Joined: 6-November 07



Great code.Much easier solution than mine.

http://forums.virtualdub.org/index.php?act...4&hl=virtualdub
 
    Top
raffriff42
Posted: Sep 28 2013, 10:43 PM


Advanced Member


Group: Members
Posts: 384
Member No.: 35081
Joined: 25-June 12



Thanks. I should really credit this post (I think it was this one) for the idea.
 
     Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
23 replies since Sep 25 2013, 06:28 PM Track this topic | Email this topic | Print this topic
Pages: (2) 1 [2] 
<< Back to Newbie Questions