tags:

views:

6

answers:

1

I need to read pairs of frames with avisynth and process them.

eg
frame1 + frame2 => result1    
frame2 + frame3 => result2
frame3 + frame4 => result3

I know the selecteven() and selectodd() commands but they give me frame1 and 2 then frame3 and 4.
There is no way of doing an "if()" to work out which step I'm on or pushing back a grabbed frame.

Any idea how to implement this?

A: 
//assuming video is the input

even = SelectEven(video)     
odd = SelectOdd(video)    

// should produce 0,1 1,2 2,3 ....
// seems bad to have to split into odd and even then interleave them back together 
//  but Select only works with interleaved sources

interleave(even,odd)    
SelectEvery(2,0,-1,0,1)    
trim(2,0)    

right = SelectEven()   
left = SelectOdd()   

will give 0,1 1,2 2,3 3,4 4,5 5,6 etc

ps comments in avisynth are # not // but it breaks the SO formatting.
pps don't know why it is syntax highlighting some bits or how it has guessed which language.

Martin Beckett