Apply Filters to Only a Certain Part of a Video

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
Locked
User avatar
LittleAtari
Call Me Moneybagz
Joined: Sun May 22, 2005 10:23 pm
Org Profile

Apply Filters to Only a Certain Part of a Video

Post by LittleAtari » Thu Mar 12, 2009 2:52 am

I'm cleaning up a video after it's been edited and found that some filters really benefit certain parts of the video, but really harm other parts. So how do I apply filters for only certain parts of a video?

I managed to find this on a message board somewhere, but I don't completely understand it:

Code: Select all

avisource("X:/stuff/example.avi")

function filterchain1(clip c) {
    c
    # do some filtering here
    return last
}

function filterchain2(clip c) {
    c
    # NASTY EVIL BLUR OR SOMETHING HERE
    return last
}

trim(0,500).filterchain1()+trim(501,550).filterchain2()+trim(551,0).filterchain1()
I've tried messing around with it and I get lost. I understand that I need to make clips out of my video, so I do this:

Code: Select all

beginning = DirectShowSource("ComeAlive06  (windows playback).mov")
clip1 = beginning.trim(0, 183)
So far AVIsynth doesnt complain, so i go and make my filterchain:

Code: Select all

function filterchain1(clip1) {
    c
   sangnom(2)
    return last
}
trim(0,183).filterchain1()
Here I get an error saying that trim has invalid arguments and it's referring to the last trim and not the one I used on clip1.

Also, before anyone says anything about mov. I made the video in FCP on OS X and have tried numerous export methods, so please don't complain about it unless it has anything to do with how this script is working.

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Re: Apply Filters to Only a Certain Part of a Video

Post by Scintilla » Thu Mar 12, 2009 6:17 am

Look up the ApplyRange() function in the AVISynth documentation.

I think there may also be, included with the AMVapp, a script function called SceneAdjust() that does something similar (and if you don't have it, you can find the function here).
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

User avatar
LittleAtari
Call Me Moneybagz
Joined: Sun May 22, 2005 10:23 pm
Org Profile

Re: Apply Filters to Only a Certain Part of a Video

Post by LittleAtari » Thu Mar 12, 2009 11:27 pm

Scintilla wrote:Look up the ApplyRange() function in the AVISynth documentation.

I think there may also be, included with the AMVapp, a script function called SceneAdjust() that does something similar (and if you don't have it, you can find the function here).
Thanks a lot. I went with applyrange since I seemed to pick up on that first. It's amazing. Thank you.

Locked

Return to “AviSynth Help”