PDA

View Full Version : Add two crops


koszopal
6th February 2004, 11:14
hi
its possible to crop from a part of frame ..hmm for example
from top a 100 pixels then crop from 2nd frame same( from top 100 pixels )
and as a return create frame with this crops but one up and below ?
koszopal
PS i hope someone unders. what i mean and i apologize for my poor english

Kintaro
6th February 2004, 11:32
I think your looking for this
crop(0,100,0,0).addborders(0,50,0,50)
its also in the manual :D

koszopal
6th February 2004, 13:05
hehe i know :)
but i want take to crop a part of frame 1st,then crop frame 2nd it could be 1st half a frame 1st from top (and same 2nd crop )
and just add this 2 crops to 1 result frame (1 below 2nd for example)
koszopal

Leak
6th February 2004, 13:26
Originally posted by koszopal
hehe i know :)
but i want take to crop a part of frame 1st,then crop frame 2nd it could be 1st half a frame 1st from top (and same 2nd crop )
and just add this 2 crops to 1 result frame (1 below 2nd for example)
koszopal

You mean something like this?


source=...

even=source.SelectEven() # All frames with even frame number
odd=source.SelectOdd() # All frames with odd frame number

even=even.Crop(...) # Crop even frames
odd=odd.Crop(...) # Crop odd frames

StackVertical(even,odd) # Stack what's left of the odd and even frames


np: Mos Def And Diverse - Wylin Out (Urban Renewal Program comp.)

Ingolf
7th February 2004, 16:26
I need to do something similar..
I am about to make a somewhat smooth slowmotion clip of an interlaced source videoclip.
So i take an interlaced video and double the number of frames, by extracting each field, and save them sequentially. To do this:

AviSource("e:\myavi.avi")
ComplementParity
SeparateFields

Ok... but unfortunately 'Separatefields' shifts every odd frame 1 scanline up.. so the ending video will jump 1 scanline up/down for each frame :( Not something general divx/xvid likes, and me neither.

So to fix this, i tried your code, and i can crop my way out of it, but i need to know how to set the fields together again, sequentially. This is the script i have so far:

AviSource("e:\myavi.avi")
ComplementParity
SeparateFields
even=SelectEven
odd=SelectOdd
even=even.Crop(0,0,768,286)
odd=odd.Crop(0,1,768,287)
#StackVertical(even,odd)

Now.. i need to set the ending clip together like this:
frame0=even.index0
frame1=odd.index0
frame2=even.index1
frame3=odd.index1
...
..

How can i do that?

Leak
7th February 2004, 16:47
Originally posted by Ingolf
Now.. i need to set the ending clip together like this:
frame0=even.index0
frame1=odd.index0
frame2=even.index1
frame3=odd.index1
...
..

How can i do that? [/B]

I guess you're looking for


Interleave(even,odd)


but I'm still wondering why you don't use a smart bob like DGBob or KernelBob, which would give you full-height images with double the framerate of the original and probably better quality?

np: Alias - Am I Cool Now? (Muted)

Ingolf
7th February 2004, 17:06
Thanks for a quick answer!

The Interleave(even,odd) trick did'nt work. Avisynth keeps complaining that the framesizes are different. Bug?

Anyway, DgBob worked exactly as i needed. Thanks for that one.

Wilbert
7th February 2004, 17:12
Your framesizes _are_ different. Try

even=even.Crop(0,0,768,286)
odd=odd.Crop(0,1,768,286)
Interleave(even,odd)

Leak
7th February 2004, 17:16
Originally posted by Ingolf
Thanks for a quick answer!

The Interleave(even,odd) trick did'nt work. Avisynth keeps complaining that the framesizes are different. Bug?


Yes, it's a bug, but in your code - Crop takes a height argument as 4th parameter and you used 286 for one and 287 for the other, as Wilbert wrote seconds before me. ;)

clip.Info is your friend... :)


Anyway, DgBob worked exactly as i needed. Thanks for that one.

I was wondering anyway why this thread seems to be about reinventing smart bobbing... :)

np: Alias - Lost Friend Advice (Muted)

Ingolf
7th February 2004, 17:20
@Wilbert
Yes you are right..that works.
Thou it does'nt seem logic :confused:

EDIT: Just read reply "Crop takes a height argument as 4th parameter.. " - DOH .. now it makes sense. My mistake.. i better go read the docs again :D