View Full Version : Conditional cropping
chaynik
9th September 2009, 13:21
I need some help applying conditional cropping to a clip. Basically, I need an "If... then" statement that check to see if clip height is >480 and applies cropping. If clip height is <480, no cropping is applied. I've been reading the ConditionalFilter page on the Wiki but have trouble understanding it unfortunately.
Thank you in advance!
Gavino
9th September 2009, 13:49
ConditionalFilter is for cases where the condition you are testing varies from frame to frame (eg depending on average luma).
For the more normal case where the condition depends only on clip-level properties, the simpler conditional operator (http://avisynth.org/mediawiki/Operators) is used.
clip = clip.height > 480 ? clip.Crop(...) : clip
chaynik
11th September 2009, 03:20
Thank you! This was exactly what I was looking for.
chaynik
11th September 2009, 03:23
On another note, are there any command-line tools that can pull basic info from an evaluated AVISynth script (such as frame size, frame rate and color space), so I could do these calculations outside of AVISynth (to make them the .avs files smaller, cleaner and more human-readable), for example in VBscript?
stickboy
11th September 2009, 03:59
Pull basic info from an AviSynth script? And then what would you do with that information?
foxyshadis
11th September 2009, 04:49
You could easily perform the heavy lifting in an .avsi/.avs, so that the whole thing boils down to a single function call in the main script and a few lines in the external. Or you can write 50 lines of vbscript and test a dozen interface programs for a few hours of toil (though MediaInfo is likely the best bet), then have some ugly lines that'll be searched for and replaced by that parser. :p
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.