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 Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd March 2012, 01:13   #1  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,681
FrameSelect/FrameReplace LAST VERSION

Code:
FrameSelect() Plugin for Avisynth v2.5+ by StainlessS.


LAST VERSION FRAMESELECT()
http://www.mediafire.com/download/15...30516_LAST.zip

FrameSelect() is a simple plugin to select individual frames from a clip.

Can select frames numbers by direct arguments to filter, or in a string, or in a command file.


Video:- Planar, YUY2, RGB32, RGB24.

Audio:- Returns NO AUDIO (Does not really make sense for individual frames).


FrameSelect(Clip, int F1, ... , int Fn, string 'SCmd',string 'Cmd', bool 'Show', bool 'Ver',bool "Reject")

Compulsory args:

        Clip,   No Default, source clip.


Optional args:  (at least one of the frame select options must be supplied).

    F1...Fn Un-named. Zero or more frame numbers.

        SCmd,   string, Default= "", Not set.
                Command String, frame numbers supplied in a string.

        Cmd,    string, Default= "", Not set.
                Command file, frame numbers supplied in a file. Use eg "Select.txt" for command file in your script directory.

        Show    bool, Default= false.
                true = Show info.

        ver     bool, Default=false.
                true = Show version.

        Reject  bool, Default False. If true then selects frames NOT selected rather than selected frames. New, v1.03.


Either the direct frame numbers, Command string (SCmd), or command file (Cmd) must be supplied.
*** NOTE ***,  if more than one supplied, the commands in the Command File are processed
first followed by those in the SCmd String, and finally the directly supplied frame numbers.


NOTE, v1.01 Adds frame ranges to both command file and command string (not possible for directly supplied frame number args).


The 'Cmd' Command file allows one command per line and can contain comments eg:

#------------- # below contents of a text file.
100       # This is a comment
200       # and so is this
300,400   # This is a frame range, specifies all 101 frames between 300 and 400 inclusive.
500,-2    # Specifies 2 frames starting at frame 500, ie 500 and 501.
600,0     # Specifies ALL frames from frame 600 to the end of the source clip.

#-------------

The "SCmd" string accepts more than 1 command per line, but MUST be separated by a semi colon (;).
The Semi colon is processed as a sort of soft newline and will terminate a comment, so you CANNOT
have a semi colon in a comment. eg

SCMD = "
       1000  # This is a comment ; 2000 # the 2nd arg is 2000; 3000 # the third arg on a single line.
       4000 ; 5000 ; 6000
       7000,8000 ; 9000,-2 ; 10000,0  # Frames 7000-8000, 2 frames starting at 9000, and frame 10000 to end of clip.
"

example commands:

FrameSelect(clip, 1,2,3,4,5)
FrameSelect(clip,"100,110;200,-2;300,0")
FrameSelect(clip, 1,2,3,4,5,"100;200;300","Select.txt")
FrameSelect(clip, 1,2,3,4,5,"100;200;300")
FrameSelect(clip, 1,2,3,4,5,"","Select.txt")
FrameSelect(clip,"100;200;300","Select.txt")
FrameSelect(clip,"","Select.txt")

--------------------------------------
v1.02, added:

FrameReplace(Clip,clip, int F1, ... , int Fn, string 'SCmd',string 'Cmd', bool 'Show', bool 'Ver')

Args identical to FrameSelect, with exception of the 2nd clip arg which is a clip of frames to replace into the 1st clip arg.
The other args must be identical to the script that originally extracted the frames.
Replaces frames extracted with FrameSelect(), back into the original clip.
Use the same command args that were used to extract the clip.
--------------------------------------
StainlessS.
For audio support with fade in/out see trim/splice plugin Prune().
http://forum.doom9.org/showthread.php?t=162446
For frame range replacement see ClipClop().
http://forum.doom9.org/showthread.php?t=162266

v2.58 & v2.6 dll's with source, LAST VERSION here until attachment clears
http://www.mediafire.com/download/15...30516_LAST.zip

New Thread for FrameSel/FrameRep here:-
http://forum.doom9.org/showthread.php?t=167971
Attached Files
File Type: zip FrameSelect_25&26_dll_v1-03_20130516_LAST.zip (118.7 KB, 34 views)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 5th June 2013 at 04:30. Reason: Update
StainlessS is offline   Reply With Quote
Old 24th December 2012, 11:36   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,681
FrameSelect() Plugin v1.01 - 24 Dec 2012

v1.01 Adds frame ranges to both command file and command string (not possible for directly supplied frame number args).

See 1st post.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 27th April 2013, 23:51   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,681
New version FrameSelect v1.02.

Added filter:
FrameReplace(clip,clip, int F1, ... , int Fn, string 'SCmd',string 'Cmd', bool 'Show', bool 'Ver')

Args identical to FrameSelect, with exception of the 2nd clip arg which is a clip of frames to replace into the 1st clip arg.
The other args must be identical to the script that originally extracted the frames.

FrameReplace() prompted by this thread:
http://forum.doom9.org/showthread.ph...75#post1625975
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 28th April 2013 at 01:44.
StainlessS is offline   Reply With Quote
Old 8th May 2013, 16:14   #4  |  Link
Akai-Shuichi
n00biest n00b
 
Join Date: Jul 2007
Posts: 37
I'm terrible with documentation. Would you be able to supply an example with before and after screenshots?

I'm quite interested in this filter :P
Akai-Shuichi is offline   Reply With Quote
Old 8th May 2013, 18:44   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,681
Quote:
Originally Posted by Akai-Shuichi View Post
an example with before and after screenshots?
Screenshots of what?

You supply the clip, and select a number of frames from your clip.

Code:
myclip=AviSource("D:\avs\avi\1.avi") # Your clip
Sel=FrameSelect(myclip,10,20,30) # select frames 10 and 20 and 30 from your clip
return Sel # return frames 10 and 20 and 30 from your clip
what is there to explain, or require screenshots.

EDIT: Or,

Code:
myclip=AviSource("D:\avs\avi\1.avi") # Your clip

SCMD="10;20;30"

Sel=FrameSelect(myclip,scmd=SCMD) # select frames 10 and 20 and 30 from your clip using command string
return Sel # return frames 10 and 20 and 30 from your clip

Or

------------- below contents of "cmd.txt" file.
10
20
30
-------------
Code:
myclip=AviSource("D:\avs\avi\1.avi") # Your clip
Sel=FrameSelect(myclip,cmd="cmd.txt") # select frames 10 and 20 and 30 from your clip using command file
return Sel # return frames 10 and 20 and 30 from your clip
Might be useful to say what it is you want to do.

EDIT: Also example usage of FrameReplace()

Code:
myclip=AviSource("D:\avs\avi\1.avi") # Your original clip
Sel=AviSource("D:\avs\avi\Sel.avi") # Clip extracted via any of above code snippets, and perhaps edited in paint program

Fixed=FrameReplace(myclip,Sel,10,20,30) # replace 3 frames from Sel clip back into source clip frames 10 and 20 and 30.
return Fixed # return original clip with fixed frames replaced back into source
Can also use command string or command file to match the other FrameSelect snippits, in this case they are ALL equivalent (ie 10,20,30).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 8th May 2013 at 19:26.
StainlessS is offline   Reply With Quote
Old 8th May 2013, 20:42   #6  |  Link
Akai-Shuichi
n00biest n00b
 
Join Date: Jul 2007
Posts: 37
I was thinking that this could be used to remove frames with frame burn/crud on scene changes. Like select the ones with the burn/crud on them and then replace with the neighboring frames that don't have them. Although, now that I think about it, screenshots can't really show that lol.
Akai-Shuichi is offline   Reply With Quote
Old 8th May 2013, 22:11   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,681
OK, well in brief, look at post linked in post#3.

Use the first script to generate command files with "EXTRA=true" to generate PrePre.txt as well as Pre.txt command file.
Pre.txt would be a list of frames before scene changes, PrePre.txt are the frames before those.

What you could then do is to pull out the PrePre frames (two before scene change) and shove them back into where
the Pre frames are (one before scene change).

eg

Code:
C=AVISource("D:\avs\Source.avi")
PRE=FrameSelect(C,cmd="PrePre.txt",show=false) # pull out frames 2 before scene change
FIXED=FrameReplace(C,PRE,"Pre.txt",show=false) # shove frames 2 before scene change back into frame immediately before scene change
return FIXED
You could also do similar with frames following scene change using same method (using Post.txt & PostPost.txt).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 9th May 2013 at 09:31.
StainlessS is offline   Reply With Quote
Old 16th May 2013, 15:10   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,681
New version FrameSelect v1.03.

Added filter arg, Reject:

Code:
    FrameSelect(clip,int F1, ... , int Fn, string 'SCmd',string 'Cmd', bool 'Show', bool 'Ver',bool "Reject"=False)

    Reject  bool, Default False. If true then selects frames NOT selected rather than selected frames. New, v1.03.
See 1st post.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 17th May 2013, 10:18   #9  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: Waterloo, WI - USA
Posts: 650
This would be better served if it came with a GUI for marking frames to be acted upon and built the "cmd.txt" files by parsing those values. Otherwise this can already be accomplished with Avisynth and arguably, with a similar level of work..

On the other hand, its nice to see people still developing filters that actually do something new
osgZach is offline   Reply With Quote
Old 17th May 2013, 11:09   #10  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 182
Hello,
Have you tried AvsPmod Macro ConditionalReaderFile from Bookmarks ?
A big part of job can be made with it. You have after to adjust the file text to Stainless plugin with a text editor.
Bernardd is offline   Reply With Quote
Old 26th May 2013, 00:15   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,681
@Bernardd

What format does AvsPmod Macro use ?

@osgZach
I'm not a Windows Programmer, anyone is free to write such a GUI (even you).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 26th May 2013, 01:27   #12  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 182
Stainless,

AvsPmod Macro use python.

Thus, ConditionalReader file from bookmarks macro is act in ConditionalReader file from bookmarks.py file
Down the ConditionalReader file from bookmarks.py script

Begin

# Write the ConditionalReader file
value_default = value.strip()
text = ['Type {0}\n'.format(type)]
if default: text.append(u'Default {0}\n'.format(default.strip()))
if bm_meaning == _('Single frames'):
for frame, title in bmlist:
text.append(u'{0} {1}\n'.format(frame,
title.strip() if use_title and title else value_default))
else:
if len(bmlist) % 2 and not avsp.MsgBox(_('Odd number of bookmarks'),
title=_('Warning'), cancel=True):
return
prefix = 'R' if bm_meaning == _('Ranges of frames') else 'I'
for i, bm in enumerate(bmlist):
if i%2:
value = None
if use_title:
if bmlist[i-1][1]:
value = bmlist[i-1][1].strip()
if bm[1]:
if value and bm_meaning != _('Ranges of frames'):
value += ' ' + bm[1].strip()
else:
value = bm[1].strip()
if not value:
value = value_default
else:
value = value_default
text.append(u'{0} {1} {2} {3}\n'.format(
prefix, bmlist[i-1][0], bm[0], value))
text = [line.encode(sys.getfilesystemencoding()) for line in text]
with open(filename, 'w') as file:
file.writelines(text)
if insert_path:
avsp.InsertText(u'"{0}"'.format(filename), pos=None)

End

I am not able to write a AvsPmod macro.
The ConditionalReader file from bookmarks macro product a txt file with header in accordance with ConditionalReader file.

I hope my answer solve your interrogation.
Bernardd is offline   Reply With Quote
Old 26th May 2013, 03:30   #13  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,681
Sorry Bernardd, I was a little unclear, I was referring to this line

Quote:
You have after to adjust the file text to Stainless plugin with a text editor
ie format of macro output text file.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 26th May 2013, 10:53   #14  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 182
For me, AvsPmod is a smart and wonderful Gui in purpose to write and param adjust in Avisynth's scripts. I thanks his authors.

With AvsPmod Bookmarks function is easy to fixe video frames of interest. The ConditionalReader file from bookmarks macro give the list of frame numbers in one txt file. With text editor and or csv editor, it is easy to modify header of text file and or attribute for framenumber.

Today the macro output format is in accordance with Avisynth Conditional Reader help documentation. For example

Type Bool
Default False
25 True
27 True
34 True
40 True
49 True
57 True
58 True
59 True
70 True
80 True
89 True

The big job is to write one by one the frame number. I thinks, sometimes modify a text file is more faster.
Bernardd is offline   Reply With Quote
Old 26th May 2013, 13:18   #15  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,681
Thank you Bernardd.

It should be pretty straightforward to script a conversion avs using RT_Stats to read either one line at a time or whole file into a string,
and process them (skipping first two lines) and use Value to get line number, and output result to new file Append=true.
Finally when done, return some kind of MessageClip.

Would require GScript().

Does AvsPMod have anything that allows setting of clip Ranges rather than single frames ?

EDIT: No need to answer last question, I've just looked up ConditionalReader, some time since I last looked at it.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 26th May 2013 at 13:30.
StainlessS is offline   Reply With Quote
Old 26th May 2013, 18:13   #16  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,681
Bernardd, would you like to give this a bit of a try out.

Code:
Function CondReader2FrameSelect(String Ifn,String "Ofn") {
# CondReader2FrameSelect.avs v0.02, By StainlessS
# Convert Conditional Reader command file to FrameSelect Command file.
# Type can ONLY be Bool
# DEFAULT MUST be specified
# Frames and Ranges MUST be Opposite of DEFAULT, ie if DEFAULT is False then all frames/ranges MUST be True
# Returns DEFAULT, If True, FrameSelect(Reject) should be set True, else False (Reject in FS selects All frames NOT selected in FS, sequentially)
# Interpolate NOT supported (Conditional Reader Specific)
    DEBUG=True
    myName="CondReader2FrameSelect: "
    Assert(Exist(Ifn),"Cannot Open File "+Ifn)
    Str=RT_ReadTxtFromFile(Ifn)
    NLines=RT_TxtQueryLines(Str)
    Offset=0
    Def=0
    GScript("""
        if(!Defined(Ofn)) {
            ext=RT_FilenameSplit(ifn,get=8)
            ofn=RT_FilenameSplit(ifn,get=15-8)+"_NEW"+ext
        }
        (Exist(ofn)) ? RT_FileDelete(ofn) : NOP
        GotT=False  GotD=False
        For(i=0,NLines-1) {
            S=RT_TxtGetLine(Str,i)
            ES=" $='"+S+"'"
            off=1
            WR_S="" CMT=""
            while(RT_Ord(S,off)==32 || RT_Ord(S,off)==9) {off=off+1} ch=UCase(Chr(RT_Ord(S,off)))   # Eat White
            if(ch=="") {
                (DEBUG) ? RT_Debug(myName,String(i+1)+")","BLANK LINE",ES,false) : NOP
            } else if (ch=="#") {
                (DEBUG) ? RT_Debug(myName,String(i+1)+")","COMMENT ONLY",ES,false) : NOP # Dont think comment valid in file but we ignore anyway
                CMT=MidStr(S,off)
                while(RT_Ord(S,off)!=0) {off=off+1}                                     # Eat Till EOL
            } else if (ch=="O") {
                if(RT_FindStr(S,"OffSet ",Sig=False,pos=off)==off) {
                    off=off+6                                                           # Skip "Offset"
                    while(RT_Ord(S,off)==32 || RT_Ord(S,off)==9) {off=off+1} ch=UCase(Chr(RT_Ord(S,off)))   # Eat White
                    Assert(ch>="0" && ch<="9",myName+"Offset # NOT Found @ Line "+String(i+1)+Chr(10)+ES)
                    Offset=RT_NumberValue(S,pos=off)
                    (DEBUG) ? RT_Debug(myName,String(i+1)+")","Offset =",String(Offset,"%.0f"),ES,false) : NOP
                    while(ch>="0" && ch<="9") {off=off+1 ch=Chr(RT_Ord(S,off))}         # Eat Digs
                }
            } else if(GotT==False) {
                Assert(RT_FindStr(S,"Type",Sig=False,pos=off)==off,myName+String(i+1)+") Type Must Be Specified first")
                off=off+4                                                               # Skip "Type"
                while(RT_Ord(S,off)==32 || RT_Ord(S,off)==9) {off=off+1} ch=UCase(Chr(RT_Ord(S,off)))   # Eat White
                Assert(RT_FindStr(S,"Bool",Sig=False,pos=off)==off,myName+String(i+1)+") Type == Bool ONLY Supported")
                (DEBUG) ? RT_Debug(myName,String(i+1)+") Got TYPE Line "+ES,false) : NOP
                off=off+4                                                               # Skip "Bool"
                GotT=True
            } else if(GotD==False) {
                Assert(RT_FindStr(S,"Default",Sig=False,pos=off)==off,myName+String(i+1)+") Default MUST Be Specified")
                off=off+7                                                               # Skip "Default"
                while(RT_Ord(S,off)==32 || RT_Ord(S,off)==9) {off=off+1} ch=UCase(Chr(RT_Ord(S,off)))   # Eat White
                Def=(ch == "T" || ch=="Y") ? True : (ch == "F" || ch=="N") ? False : 0
                Assert(IsBool(Def),myName+String(i+1)+") Default Type NOT specified")
                (DEBUG) ? RT_Debug(myName,String(i+1)+") Got DEFAULT Line "+ES,false) : NOP
                While(ch>="A"&&ch<="Z") {off=off+1 ch=UCase(Chr(RT_Ord(S,off)))}        # Eat Alpha
                DefS1=(Def==False)  ? "False"   : "True"
                DefS2=(Def==False)  ? "F"       : "T"
                DefS3=(Def==False)  ? "No"      : "Yes"
                NDefS1=(Def==False) ? "True"    : "False"
                NDefS2=(Def==False) ? "T"       : "F"
                NDefS3=(Def==False) ? "Yes"     : "No"
                (DEBUG && Def==True) ? RT_Debug(myName,"WARN Default=True, will Require FrameSelect(Reject=True)",false) : NOP
                GotD=True
            } else if (ch=="R") {
                off=off+1                                                               # skip "R"
                while(RT_Ord(S,off)==32 || RT_Ord(S,off)==9) {off=off+1} ch=UCase(Chr(RT_Ord(S,off)))   # Eat White
                Assert(ch>="0" && ch<="9",myName+"Range Start NOT Found @ Line "+String(i+1)+Chr(10)+ES)
                R1=RT_NumberValue(S,pos=off) + Offset
                while(ch>="0" && ch<="9") {off=off+1 ch=Chr(RT_Ord(S,off))}             # Eat Digs
                while(RT_Ord(S,off)==32 || RT_Ord(S,off)==9) {off=off+1} ch=UCase(Chr(RT_Ord(S,off)))   # Eat White
                Assert(ch>="0" && ch<="9",myName+"Range End NOT Found @ Line "+String(i+1)+Chr(10)+ES)
                R2=RT_NumberValue(S,pos=off) + Offset
                Assert(R2>=R1,myName+"Range End Before Range Start @ Line "+String(i+1)+Chr(10)+ES)
                if(R1==R2) {    # Single frame range, convert to single frame, avoid eg (0,0) meaning whole clip
                    WR_S=String(R1,"%.0f")
                } else {
                    WR_S=String(R1,"%.0f")+","+ String(R2,"%.0f")
                }
                while(ch>="0" && ch<="9") {off=off+1 ch=Chr(RT_Ord(S,off))}             # Eat Digs
                while(RT_Ord(S,off)==32 || RT_Ord(S,off)==9) {off=off+1} ch=UCase(Chr(RT_Ord(S,off)))   # Eat White
                Assert((Def==False && (ch=="T"||ch=="Y")) || (Def==True && (ch=="F"||ch=="N")), \
                    myName+"Default value in file NOT supported @ Line "+String(i+1)+Chr(10)+ES)
                (DEBUG) ? RT_Debug(myname,String(i+1)+")",WR_S,ES,false) : NOP
                While(ch>="A"&&ch<="Z") {off=off+1 ch=UCase(Chr(RT_Ord(S,off)))}        # Eat Alpha
            } else if (ch>="0" && ch<="9") {
                R1=RT_NumberValue(S,pos=off) + Offset
                WR_S=String(R1,"%.0f")
                while(ch>="0" && ch<="9") {off=off+1 ch=Chr(RT_Ord(S,off))}             # Eat Digs
                while(RT_Ord(S,off)==32 || RT_Ord(S,off)==9) {off=off+1} ch=UCase(Chr(RT_Ord(S,off)))   # Eat White
                Assert((Def==False && (ch=="T"||ch=="Y")) || (Def==True && (ch=="F"||ch=="N")), \
                   myName+"Default value in file NOT supported @ Line "+String(i+1)+Chr(10)+ES)
                (DEBUG) ? RT_Debug(myname,String(i+1)+")",WR_S,ES,false) : NOP
                While(ch>="A"&&ch<="Z") {off=off+1 ch=UCase(Chr(RT_Ord(S,off)))}        # Eat Alpha
            } else if(ch=="I") {
                Assert(False,myName+"Interpolate NOT Supported @ Line "+String(i+1)+Chr(10)+ES)
            }
            while(RT_Ord(S,off)==32 || RT_Ord(S,off)==9) {off=off+1} ch=UCase(Chr(RT_Ord(S,off)))   # Eat White
            if(ch=="#") {
               CMT=MidStr(S,off)
              (DEBUG) ? RT_Debug(myName,String(i+1)+")","Eating trailing COMMENT '"+MidStr(S,off)+"'",false) : NOP
              while(RT_Ord(S,off)!=0) {off=off+1}                                       # Eat Till EOL
              ch=""
            }
            # MUST have parsed to EOL else ERROR
            Assert(ch=="", \
                    myName+"Non Parse @ Line " + String(i+1)+ " Col "+String(off) + Chr(10) + \
                    "Ord="+String(RT_Ord(ch))+" Char='"+ch+"'"+ Chr(10) + \
                   +ES)
            if(WR_S!="" || CMT!="") {
                RT_TxtWriteFile(WR_S+((WR_S!="" && CMT!="")?Chr(9):"")+CMT,ofn,append=true)
            }
        }
    """)
    Assert(IsBool(Def),myName+"Bad Header")
    Return Def
}

Function CondReader2FrameSelectMsg(String Ifn,String "Ofn") {
    # Return message clip instead of Bool
    b=CondReader2FrameSelect(Ifn,Ofn)
    Return MessageClip("CondReader2FrameSelect: All Done"+((b)?Chr(10)+"Use Reject=True in FrameSelect":""))
}

IFN="CR.TXT"
OFN="FS.TXT"
return CondReader2FrameSelectMsg(IFN,OFN)     # Returns MessageClip

AVISource("D:\AVS\Test.avi")
REJECT=CondReader2FrameSelect(IFN,OFN)
FrameSelect(cmd=OFN,reject=REJECT,Show=True)
Test File: "CR.TXT"

Code:
Type Bool
Default False
# Dont know if Comments valid, this is a test
25 True
27 T

34 True
            # Another comment
40 True
49 True
Offset 100
57 True
58 t
59 True     # Additional Comment test
70 YES
Offset  0

80 yes
89 True
R 100 200 true
R 400 500 true     # Range Comment test
300 True
Ouput FS.TXT
Code:
# Dont know if Comments valid, this is a test
25
27
34
# Another comment
40
49
157
158
159	# Additional Comment test
170
80
89
100,200
400,500	# Range Comment test
300
Debugview log
Code:
00000005	1.29902506	[3608] CondReader2FrameSelect: 1) Got TYPE Line  $='Type Bool'
00000006	1.30856156	[3608] CondReader2FrameSelect: 2) Got DEFAULT Line  $='Default False'	
00000007	1.32179034	[3608] CondReader2FrameSelect: 3) COMMENT ONLY  $='# Dont know if Comments valid, this is a test'	
00000008	1.33403933	[3608] CondReader2FrameSelect: 4) 25  $='25 True'	
00000009	1.34664965	[3608] CondReader2FrameSelect: 5) 27  $='27 T'	
00000010	1.35276651	[3608] CondReader2FrameSelect: 6) BLANK LINE  $=''	
00000011	1.36185002	[3608] CondReader2FrameSelect: 7) 34  $='34 True'	
00000012	1.37056422	[3608] CondReader2FrameSelect: 8) COMMENT ONLY  $='            # Another comment'	
00000013	1.38138473	[3608] CondReader2FrameSelect: 9) 40  $='40 True'	
00000014	1.39403093	[3608] CondReader2FrameSelect: 10) 49  $='49 True'	
00000015	1.40505445	[3608] CondReader2FrameSelect: 11) Offset = 100  $='Offset 100'	
00000016	1.41523278	[3608] CondReader2FrameSelect: 12) 157  $='57 True'	
00000017	1.42785954	[3608] CondReader2FrameSelect: 13) 158  $='58 t'	
00000018	1.43853021	[3608] CondReader2FrameSelect: 14) 159  $='59 True     # Additional Comment test'	
00000019	1.44401228	[3608] CondReader2FrameSelect: 14) Eating trailing COMMENT '# Additional Comment test'	
00000020	1.45429206	[3608] CondReader2FrameSelect: 15) 170  $='70 YES'	
00000021	1.46463823	[3608] CondReader2FrameSelect: 16) Offset = 0  $='Offset  0'	
00000022	1.46965158	[3608] CondReader2FrameSelect: 17) BLANK LINE  $=''	
00000023	1.47869956	[3608] CondReader2FrameSelect: 18) 80  $='80 yes'	
00000024	1.49056959	[3608] CondReader2FrameSelect: 19) 89  $='89 True'	
00000025	1.50995982	[3608] CondReader2FrameSelect: 20) 100,200  $='R 100 200 true'	
00000026	1.52935898	[3608] CondReader2FrameSelect: 21) 400,500  $='R 400 500 true     # Range Comment test'	
00000027	1.53484905	[3608] CondReader2FrameSelect: 21) Eating trailing COMMENT '# Range Comment test'	
00000028	1.54537678	[3608] CondReader2FrameSelect: 22) 300  $='300 True'
Not had a lot of testing, I'll probably do a plug conversion.

EDITED:
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 28th May 2013 at 13:21.
StainlessS is offline   Reply With Quote
Old 26th May 2013, 21:57   #17  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 182
OK, i try. But debrieffing only to-morrow
Bernardd is offline   Reply With Quote
Old 27th May 2013, 09:18   #18  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 182
Hello Stainless,

I understand that script target is to convert ConditionalReader file in FrameSelect file. This files are not video file. But the script is avs script.
So i undrestand the firt input must be anybody video file. When in running, the script must say error, if no Conditional Reader file is given.

Now, the script is not ok for me. I have not error message if i forget to indicate Conditional reader file to convert.

I believe, it is quote marks problem in Gscript function, too more or too few. I have tried to change some quote marks without success.

Sorry
Bernardd is offline   Reply With Quote
Old 27th May 2013, 22:32   #19  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,681
Ahr, previous try had a few problems not least of which was that FrameSelect does not allow SPACE
separator for a range (ClipClop and Prune do [I forgot], next version FS will do, already fixed but not released).

This version a bit more robust, I hope.

Previous post #16 updated.

EDIT: The script is in AVS, simply because it might take me a few hours to get back "in-to" VB or whatever,
and it also might be advantageous to be able to convert in-situ, 'on-the-fly'. (as in new 1st code snippet) Eventually will be plugin.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 28th May 2013 at 00:33.
StainlessS is offline   Reply With Quote
Old 28th May 2013, 09:36   #20  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 182
Hello,
I apologize. In previous post #18, i have not understood this particular avs file use, thus i have found quote mark problem.
To day, is ok.
The previous post #16 updated script is good, no problem. Whole item, framenumber only, framenumber range, offset are well translated. Blank line and comments are not processed (like in conditional reader file after a little test).
I have tried the last lines (frameselect) on a personal clip, with personal conditional reader file. The test was success.
Well done.
Bernardd is offline   Reply With Quote
Reply

Tags
edit, frames, join, select, trim

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 04:34.


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