Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st January 2010, 18:01   #1  |  Link
wonkey_monkey
Formerly davidh*****
 
Join Date: Jan 2004
Posts: 1,570
ApplyRange range in filter

I'm writing a few plugins and using applyrange to only apply them to certain sections of video. This all works fine until I try to use a filter that needs to know how far into the section it is being applied (such as when applying a moving mask from another file).

Code:
PVideoFrame __stdcall selectivecolour::GetFrame(int n, IScriptEnvironment* env) {
My problem is that the variable n gives the frame number of the video, not of the section selected with ApplyRange. Is there a way of getting that information within the filter, or will I have to pass it in some other way?

I've previously made wrapper functions in AVS to actually split the video, but is there an easier way?

David
wonkey_monkey is offline   Reply With Quote
Old 1st January 2010, 22:54   #2  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
If you use the Trim/Splice model instead of ApplyRange, you will get the segment frame number.
Code:
...
A=Trim(0, 123)
B=Trim(124, 567).selectivecolour(...  # global frame 124 will be local frame 0
C=Trim(568, 0)

A + B + C
...
The ApplyRange implementation is :-
Code:
...
X=Last
Y=selectivecolour(... # global frame n will be local frame n

A=X.Trim(0, 123)
B=Y.Trim(124, 567)
C=X.Trim(568, 0)

A + B + C
...
The other option is to pass an offset parameter like is done for ShowTime/ShowSMPTE/ShowFrameNumber
IanB is offline   Reply With Quote
Old 1st January 2010, 23:02   #3  |  Link
wonkey_monkey
Formerly davidh*****
 
Join Date: Jan 2004
Posts: 1,570
I think I'll go with an offset parameter, otherwise I'll be writing wrappers for every function and some of them have 18 parameters...

Thanks for the info.

David
wonkey_monkey is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:26.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.