Log in

View Full Version : Using a filter for a specific range


kakomu
19th June 2006, 23:35
I'm encoding a TV show that has telecine artifacts during the creits that must be smoothed over. However, the rest of the TV show looks bad if I used a smoothing filter then.

The episode in question is Home Movies season 3, episode 11.

Anyways, how would I apply a smoothing filter during a specific sequence but not to the whole episode using Avisynth?

unskinnyboy
20th June 2006, 00:42
:search:

Search the forum for "JDL_ApplyRange".

dosdan
20th June 2006, 00:44
movie=Avisource("test.avi")
openingcredits=trim(movie,0,1234).someprocessing() #example of first 1235 frames
main=trim(movie,1235,10000).somedifferentprocessing() # main body of movie
closingcredits=trim(movie,10001,0).someprocessingagain() # from frame 10001 to the end
return openingcredits+main+closingcredits

stickboy
20th June 2006, 05:25
Or read the documentation for the built-in ApplyRange function.

kakomu
20th June 2006, 05:40
Or read the documentation for the built-in ApplyRange function.
I did and the documentation is downright confusing

movie=Avisource("test.avi")
openingcredits=trim(movie,0,1234).someprocessing() #example of first 1235 frames
main=trim(movie,1235,10000).somedifferentprocessing() # main body of movie
closingcredits=trim(movie,10001,0).someprocessingagain() # from frame 10001 to the end
return openingcredits+main+closingcredits
how exactly do I apply multiple settings to those ranges? What does the return do? (last I checked, an avisynth script really wasn't C++ and didn't require a return). What is with all of the variables. A little description would be nice.

EDIT: Never mind, I managed to figure it out after playing with it for an hour.

stickboy
20th June 2006, 09:30
I did and the documentation is downright confusingHeh. The documentation does have examples. I agree that the explanation makes it more confusing than it is. Just go by the signature:
ApplyRange (clip, int start_frame, int end_frame, string filtername, args)
how exactly do I apply multiple settings to those ranges?The same way you'd chain filters to a clip normally:
clip.Foo().Bar().Baz().Qux()
What does the return do? (last I checked, an avisynth script really wasn't C++ and didn't require a return). What is with all of the variables. A little description would be nice."return" does what you expect it to do. It's usually unnecessary since if there's no explicit "return" statement, there's basically an implicit "return last" statement.

Wilbert
20th June 2006, 09:37
Heh. The documentation does have examples. I agree that the explanation makes it more confusing than it is.
Do you have any suggestions to improve it?

foxyshadis
20th June 2006, 10:54
ApplyRange is useless for anything that needs (or prefers) named arguments, such as tritical filters and a lot of script functions. Building it out of Animate probably wasn't a good idea, even if it was easier. JDL_ApplyRange is simpler to work with as well, you just pass in two clips instead of having to entirely rewrite the syntax of one. (Animate would also be much more useful if you could pass in your own expression(s) for variable change rates, ah well.)

Wilbert, I'd put a subheading for ApplyRange after the explanation of Animate instead of slipping it into the main explanation. This sound good?

==== ApplyRange ====
ApplyRange is a special case of Animate with constant filtering, present in v2.51. It can be used when you just want to apply a certain filter on a range of frames of a clip, so all it needs is one set of arguments.

stickboy
21st June 2006, 02:07
Do you have any suggestions to improve it?For starters, don't even bother explaining its relation to Animate. Who cares?