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 23rd June 2015, 16:36   #1  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
VapourSynth equivalent for SelectRangeEvery

I have some code to perform a compressibility check:

SelectRangeEvery(x, 14)

Is this the correct VapourSynth equivalent:

clip = core.std.SelectEvery(clip = clip, cycle = x, offsets = [0,1,2,3,4,5,6,7,8,9,10,11,12,13])

maybe the array/list can be expressed shorter? I'm clearly not a Python programmer.
stax76 is offline   Reply With Quote
Old 23rd June 2015, 19:20   #2  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,574
Quote:
Originally Posted by stax76 View Post
I have some code to perform a compressibility check:

SelectRangeEvery(x, 14)

Is this the correct VapourSynth equivalent:

clip = core.std.SelectEvery(clip = clip, cycle = x, offsets = [0,1,2,3,4,5,6,7,8,9,10,11,12,13])

maybe the array/list can be expressed shorter? I'm clearly not a Python programmer.
If you just want one frame per cycle you can simply do clip[offset::cycle]

And any iterable is fine so you can write:
clip = core.std.SelectEvery(clip = clip, cycle = x, offsets = range(14))
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 23rd June 2015, 20:17   #3  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Quote:
Originally Posted by HolyWu View Post
Yes, it is. You can use list(range(0, 14)) to conveniently generate a list for offsets in your example.
Quote:
Originally Posted by Myrsloik View Post
If you just want one frame per cycle you can simply do clip[offset::cycle]

And any iterable is fine so you can write:
clip = core.std.SelectEvery(clip = clip, cycle = x, offsets = range(14))
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 10:04.


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