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 > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 24th June 2015, 20:16   #1  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: Germany
Posts: 5,760
AviSynth to VapourSynth code translation

is there a better, possibly shorter way to achieve SelectEven and SelectOdd?

Code:
Select Even 

	fpsnum = clip.fps_num
	fpsden = clip.fps_den
	clip = core.std.SelectEvery(clip = clip, cycle = 2, offsets = 0)
	clip = core.std.AssumeFPS(clip = clip, fpsnum = fpsnum, fpsden = fpsden * 2)

Select Odd

	fpsnum = clip.fps_num
	fpsden = clip.fps_den
	clip = core.std.SelectEvery(clip = clip, cycle = 2, offsets = 1)
	clip = core.std.AssumeFPS(clip = clip, fpsnum = fpsnum, fpsden = fpsden * 2)
stax76 is offline   Reply With Quote
Old 24th June 2015, 20:23   #2  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 279
From the docs:

Code:
# Select even numbered frames
ret = clip[::2]
# Select odd numbered frames
ret = clip[1::2]
Are_ is online now   Reply With Quote
Old 24th June 2015, 20:47   #3  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: Germany
Posts: 5,760
works
stax76 is offline   Reply With Quote
Old 24th June 2015, 21:32   #4  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 723
Also, SelectEvery will adjust the frame rate and frame durations for you.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 24th June 2015, 21:45   #5  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: Germany
Posts: 5,760
Yes, somehow I missed it and made it much more complicated than it is.
stax76 is offline   Reply With Quote
Reply

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 17:13.


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