0

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?

1 Answers1

0
//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
  • 94,801
  • 28
  • 188
  • 263
  • I'm not sure why `SelectEvery` would "only work with interleaved sources" ... AviSynth doesn't have any notion of interleaved sources, just a sequence of frames (which might be frame-based or field-based). Also, that mostly sounds like a roundabout way of doing `Interleave(video, video)`. – jamesdlin Jul 06 '15 at 08:47
  • @jamesdlin - possibly it has changed over the last 5years but I don't use it anymore. Please edit/provide a better answer if you can - that's the point of SO – Martin Beckett Jul 06 '15 at 15:25