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 11th August 2014, 01:09   #61  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
Yep, ran through on a second run just fine. (although as yet, always crashed when using avsmeter).
Right from the get go, Windows writes read-only data to swap file (program code and read-only data eg string literals)
for every program that is run (first thing that it does on execution, does it because you dont need to write back data to swap file
if it is already there and read-only). Linux does it the hard way and only starts using swap file when physical memory is nearly exhausted.
My 1GB P4 is busy at present, I'll try same script on there when free, strange that P4 1GB m/c kept its head above water
despite all 1 - 22 interpolations being tested. Think I'll also try with Avisynth frame Cache disabled, see if that makes a difference.

EDIT: Actually, Jenyok script crashed (for me) after frame 496 (where had only done I1 145, I1 149, I1 195, I2 214, I4 228,
and was about to do I4 497), whereas 1GB m/c did all interpolation tests I1 to I22 without crashing.
__________________
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; 11th August 2014 at 12:09.
StainlessS is offline   Reply With Quote
Old 11th August 2014, 12:05   #62  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
@Groucho or Gavino, or anybody else who is really outstandingly clever, a real benefit to society and all around splendid chap,
I was thinking that maybe if I (within ClipClop) release (nullify) PClip's that are not used via any of the SCMD or CMD commands,
would there be anything in the script (partially) given @ (post #48)
that would prevent the un-used clips and MAnalyse clips from being released ? [would the variables eg 'I22_01' simply hang on to the clip until DoctorFrames() exit (EDIT: or even hang on until Avisynth closure)].
It's not likely to happen often that all 22 interpolation sets would be used at once.
Perhaps I would need to nullify the args[] AVSValues, yes I think that might do it, any thoughts ? (although the MAnalyse clips might still hang around).

EDIT: Might alleviate though not eradicate the prob.

EDIT: Although this should solve the MAnalyse vector prob
Code:
    BAD = 1
    I01_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I01_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I01_01   = I.MFlowInter(sup,I01_bv,I01_fv, time=100.0 * 1.0 / (BAD+1) , ml=100)
    I01_bv = 0
    I01_fv = 0
EDIT: Would nullifying args[] or MAnalyse vectors be necessary at all if PClips were zeroed ?
I'm half unsure, and the other half doesnt have a clue
__________________
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; 11th August 2014 at 16:34.
StainlessS is offline   Reply With Quote
Old 11th August 2014, 16:04   #63  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
Now the absurd.

Tried Jenyok script on P4 1GB m/c and went though it OK, manually stopped at about 56000 frames where last interpolated frame about
frame 54000. At just before pressing ESC, was showing about 120MB free in TaskManager.

reduced AVSMeter log
Code:
[General info]
Log file created with:   AVSMeter 1.7.9 (AVS 2.6, x86)
Avisynth version:        AviSynth 2.60A5 (CVS 20130920, ICL10)


[Clip info]
Number of frames:               154289
Length (hhh:mm:ss.ms):   001:42:51.560
Frame width:                       768
Frame height:                      576
Framerate:                      25.000 (25/1)
Colorspace:                       YUY2
Audio channels:                      2
Audio bits/sample:                   2
Audio sample rate:               44100
Audio samples:               272165796


[Runtime info]
Frames processed:               56810 (0 - 56809)
FPS (min | max | average):      2.615 | 265.3 | 70.34
CPU usage (average):            44%
Thread count:                   4
Physical Memory usage (peak):   660 MB
Virtual Memory usage (peak):    1763 MB
Time (elapsed):                 000:13:27.683

[Performance data]
       Frame interval    Frames/sec   Time/frame(ms)   CPU(%)   Threads   PhysMEM(MB)   VirtMEM(MB)
                  0-9       166.515           6.0055        0         3           274          1589
                10-19       265.321           3.7690        0         3           274          1589
                20-29       254.036           3.9364       50         3           276          1591
                30-39       263.704           3.7921       50         3           276          1591
                40-49       259.698           3.8506       50         3           276          1591
                50-59       158.101           6.3251       88         3           276          1591
                60-69       164.773           6.0689       88         3           276          1591
                70-79       164.902           6.0642       78         3           276          1591
                80-89       178.851           5.5912       78         3           276          1591
                90-99       170.448           5.8669       87         3           276          1591
              100-109       181.701           5.5036       87         3           276          1591
              110-119       178.645           5.5977       64         3           276          1591
              120-129       181.580           5.5072       64         3           276          1591
              130-139       171.584           5.8280       85         3           276          1591
              140-149        22.130          45.1885       70         4           308          1617
              150-159       195.171           5.1237       70         4           308          1617
              160-169       173.570           5.7614       78         4           319          1629
              170-179       174.739           5.7228       78         4           319          1629
              180-189       180.073           5.5533       78         4           332          1642
              190-199        40.889          24.4564       75         4           352          1662
              200-209       173.199           5.7737       75         4           352          1662
              210-219        27.388          36.5120       83         4           384          1687
              220-229        24.148          41.4109       71         4           411          1708
              230-239        84.872          11.7825       50         4           421          1712
              240-249       175.898           5.6851       50         4           421          1712
              250-259       183.199           5.4586       92         4           433          1725
              260-269       141.087           7.0878       92         4           433          1725
              270-279       179.065           5.5846       56         4           446          1737
              280-289       173.449           5.7654       56         4           446          1737
              290-299       182.343           5.4842       85         4           459          1750
              300-309       174.353           5.7355       85         4           459          1750
              310-319       173.612           5.7600       81         4           472          1763
              320-329       187.200           5.3419       81         4           472          1763
              330-339       206.991           4.8311       81         4           472          1763
              340-349       215.780           4.6343       66         4           472          1763
              350-359       223.448           4.4753       66         4           472          1763
              360-369       263.170           3.7998       66         4           472          1763
              370-379       261.471           3.8245       87         4           472          1763
              380-389       194.230           5.1485       87         4           472          1763
              390-399       219.966           4.5462       87         4           472          1763
              400-409       214.192           4.6687       77         4           472          1763
              410-419       199.438           5.0141       77         4           472          1763
              420-429       216.407           4.6209       77         4           472          1763
              430-439       217.987           4.5874       72         4           472          1763
              440-449       194.013           5.1543       72         4           472          1763
              450-459       187.146           5.3434       72         4           472          1763
              460-469       176.779           5.6568       68         4           472          1763
              470-479       217.264           4.6027       68         4           472          1763
              480-489       216.099           4.6275       68         4           472          1763
              490-499        32.940          30.3583       66         4           478          1763
              500-509       123.719           8.0828       66         4           478          1763

###
### size reduction
###

          56000-56009        89.151          11.2169       25         4           558          1763
          56010-56019        83.116          12.0313       64         4           558          1763
          56020-56029        87.050          11.4877       56         4           558          1763
          56030-56039        91.450          10.9350       64         4           558          1763
          56040-56049        87.646          11.4095       28         4           558          1763
          56050-56059        76.705          13.0369       25         4           558          1763
          56060-56069        76.275          13.1105       44         4           558          1763
          56070-56079        93.236          10.7255       28         4           558          1763
          56080-56089        80.485          12.4246       56         4           558          1763
          56090-56099        80.788          12.3781       21         4           558          1763
          56100-56109        75.471          13.2502       27         4           558          1763
          56110-56119        86.931          11.5034       21         4           558          1763
          56120-56129        80.512          12.4205       37         4           558          1763
          56130-56139        77.336          12.9306       31         4           558          1763
          56140-56149        74.630          13.3995       33         4           558          1763
          56150-56159        75.418          13.2594       27         4           558          1763
          56160-56169        90.355          11.0674       50         4           558          1763
          56170-56179        80.744          12.3848       50         4           558          1763
          56180-56189        83.034          12.0433       64         4           558          1763
          56190-56199        83.102          12.0334        0         4           558          1763
          56200-56209        83.458          11.9820       43         4           558          1763
          56210-56219        83.529          11.9718       71         4           558          1763
          56220-56229        83.334          11.9999        0         4           558          1763
          56230-56239        89.835          11.1315       28         4           558          1763
          56240-56249        87.709          11.4013       42         4           558          1763
          56250-56259        83.915          11.9169       12         4           558          1763
          56260-56269        84.398          11.8487       68         4           558          1763
          56270-56279        94.532          10.5785       68         4           558          1763
          56280-56289        81.029          12.3413       10         4           558          1763
          56290-56299        87.249          11.4615       43         4           558          1763
          56300-56309        73.297          13.6431       50         4           558          1763
          56310-56319        82.582          12.1092       25         4           559          1763
          56320-56329        86.476          11.5639       31         4           559          1763
          56330-56339        77.623          12.8828       50         4           559          1763
          56340-56349        81.580          12.2580       50         4           559          1763
          56350-56359        91.147          10.9712       71         4           559          1763
          56360-56369        88.466          11.3038       57         4           559          1763
          56370-56379        90.879          11.0036       57         4           559          1763
          56380-56389        81.302          12.2998       31         4           559          1763
          56390-56399        79.920          12.5126       75         4           559          1763
          56400-56409        77.977          12.8243       12         4           559          1763
          56410-56419        84.004          11.9042       62         4           559          1763
          56420-56429        84.500          11.8344       57         4           559          1763
          56430-56439        83.929          11.9148       37         4           559          1763
          56440-56449        80.884          12.3633       31         4           559          1763
          56450-56459        71.078          14.0691       55         4           559          1763
          56460-56469        86.922          11.5045       42         4           559          1763
          56470-56479        80.312          12.4514       37         4           559          1763
          56480-56489        98.399          10.1627       21         4           559          1763
          56490-56499        90.520          11.0473       35         4           559          1763
          56500-56509        93.880          10.6519       35         4           559          1763
          56510-56519        92.654          10.7928       30         4           559          1763
          56520-56529        90.364          11.0664       30         4           559          1763
          56530-56539        89.948          11.1175       26         4           559          1763
          56540-56549        90.238          11.0818       57         4           559          1763
          56550-56559        93.644          10.6787       57         4           559          1763
          56560-56569        85.880          11.6442       32         4           559          1763
          56570-56579        85.886          11.6434       35         4           559          1763
          56580-56589       100.157           9.9844       50         4           559          1763
          56590-56599       101.054           9.8957       50         4           559          1763
          56600-56609        96.938          10.3159       50         4           559          1763
          56610-56619       102.545           9.7519       50         4           559          1763
          56620-56629        91.412          10.9394       53         4           559          1763
          56630-56639       103.227           9.6874       53         4           559          1763
          56640-56649        90.597          11.0379       34         4           559          1763
          56650-56659        91.895          10.8820       71         4           559          1763
          56660-56669        91.005          10.9884       35         4           559          1763
          56670-56679        92.761          10.7804       71         4           559          1763
          56680-56689        88.985          11.2378       21         4           559          1763
          56690-56699        87.709          11.4013       75         4           559          1763
          56700-56709        60.530          16.5208       15         4           559          1763
          56710-56719        50.319          19.8733       11         4           559          1763
          56720-56729        87.104          11.4805       21         4           559          1763
          56730-56739        80.327          12.4490       75         4           559          1763
          56740-56749        87.359          11.4470       56         4           559          1763
          56750-56759        93.497          10.6956       56         4           559          1763
          56760-56769        96.925          10.3172       15         4           559          1763
          56770-56779        82.269          12.1552       37         4           559          1763
          56780-56789        86.357          11.5798       35         4           559          1763
          56790-56799        82.358          12.1420       50         4           559          1763
          56800-56809        73.991          13.5152       27         4           559          1763


About 2000 frame past last interpolated frames, Pressed ESCAPE to halt.
Note, above was done in Groucho2004 Avisynth 2.6A5 ICL version.

Tried on 3GB Core Duo, with "Function Cache(clip c) { return c}" used
intention to disable Cache, made no difference and crashed, maybe about frame 5000.

Tried "SetMemoryMax(128)", (AVSMeter: Physical Memory Usage (Peak) stable at 627MB)
went A.O.K. untill ESC pressed at about 56000 frames.

Tried again without SetMemoryMax, crash. (AVSMeter: Physical Memory Usage (Peak) HALT at 868MB)

"SetMemoryMax(512)", Crash. (AVSMeter: Physical Memory Usage (Peak) HALT at 868MB)

"SetMemoryMax(256)", Went until about 56000 A.O.K. , (AVSMeter: Physical Memory Usage (Peak) stable at 755MB)

Perhaps crashing at a Cache memory request.

EDIT: Me wonders if could also be reason for the title of this thread, ie "avisynth crashes when using to many input streams",
with accompanying requests for cache causing crash even though physical mem maybe still not exhausted, only pagefile exhausted.
__________________
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; 11th August 2014 at 17:17.
StainlessS is offline   Reply With Quote
Old 11th August 2014, 18:04   #64  |  Link
Jenyok
Warm and fuzzy
 
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 201
StainlessS
.
VirtualDub 1.9.11
.
AviSynth 2.5.8 not mutithread
.
VirtualDub crashes immidiatly from frame 0 .
.
I have real video (54625 frames, 36:25.00) with many broken frames and continiuos broken frames and real script, see upper, which does not works.
.
Hardware - 2xCPU Xeon 3.6 gHz, RAM 8 gB (3 gB in 32 bits mode), Win XP SP3 32 bits, system pagefile 4096-8192 mB.
.
__________________
Warm and fuzzy (white and fluffy)

Last edited by Jenyok; 11th August 2014 at 18:17.
Jenyok is offline   Reply With Quote
Old 11th August 2014, 19:28   #65  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
Can you switch on Show=True,dv=4, and post output from DebugView.
Also try with SetMemoryMax(128).
I'll install v2.58 and check on my system.
(presumably you are using the v2.58 plugin and not v2.6)
could also perhaps try Grouch2004 AvsMeter and see if it shows anything odd.

EDIT: Hang-on a mo, you had an access violation whereas I'm getting out-of-memory, two different errors.
Can you try to change to

SCMD="" # just add it after original SCMD string

so it does not do any interpolation, but still is running through ClipClop.

You could also make sure that it is happening only when Clipclop involved ie comment out clipclop line.

Have Installed both VD 1.9.11 build 32842 and avisynth v2.58 and no different to the symptoms I had before.
__________________
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; 11th August 2014 at 20:35.
StainlessS is offline   Reply With Quote
Old 13th August 2014, 12:58   #66  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
Jenyok, I see you there.
Try the previous plug with a SetMemoryMax(256), that should I think cure the problem.
Have implemented "Purge" arg in ClipClip() which nullifies non used clips, is a bit better but still crashes
(most often if you have more physical memory). Note v2.58 uses 25% of your physical ram whereas
v2.6 limits to at most 500MB, I think that your problem is connected with you having a lot of ram
and v2.5 setting memax to 25%.
I'm not sure if the problem is an XP problem or how Avisynth allocates cache, but I dont think I can do anything about
it apart from SetMemoryMax (could also be the cause of the problem where avisynth crashes when opening many source
clips, ie title of this thread).
I just need to do a little testing and shall up another version ClipClop.

EDIT: SetMemoryMax(256) works fine on my system (3GB), SetMemoryMax(512) crashes it.
On a machine with only 1GB RAM, works fine (but slow), no crashes, same script.
On your Access Violation problem, can only assume that it is the same problem, but has occurred at a point
in program that does not check if frame buffer is NULL, and so causes Exception rather than throwing an error message.
__________________
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; 13th August 2014 at 13:12.
StainlessS is offline   Reply With Quote
Old 17th August 2014, 22:01   #67  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
Jenyok, Can you try out New ClipClop v1.20.
I think your Access violation @ address $00000000 was the same out of memory error, just revealed itself in a slightly different way.
Have included source and new DoctorFrames.avs, with arg bool "Ext22" to select extended interpolation range (up to I22),
by default Ext22==false = up to I11. suggest SetMemoryMax(256) when Ext22=True.

ClipClop thread here:- http://forum.doom9.org/showthread.php?t=162266

EDIT: Implemented as so (only Ext22=False section of script shown):
Code:
Function DoctorFrames(clip c, String "Scmd",String "Cmd",bool "Show",int "dv",Bool "Ext22",
        \ int "pel",int "sharp",int "rfilter",Float "ml") {
# DoctorFrames() by StainlessS.
# Replace damaged frames using commands in a either command string or file.
/*
Commands:-  Eg, "CP  100" CopyFromPrevious ie replace frame 100 with frame 100 - 1.
            Eg, "CN  200" CopyFromNext ie replace frame 200 with frame 200 + 1.
            Eg, "I2  300" Interpolate 2 frames at frames 300 and 301 (using 299 and 302).
            Eg, "I22 400" Interpolate 22 frames at frames 400 to 421 (using 399 and 422).
*/
#########
    Scmd   = Default(Scmd,"")         # User supplied list of newline or semicolon separated commands.
    Cmd    = Default(Cmd,"")          # User supplied Filename containing newline separated commands.
    Show   = Default(Show,false)      # Show Info on frame
    dv     = Default(dv,0)            # ClipClop DebugView level (0 - 4, Need DebugView utility)
    Ext22  = Default(Ext22,False)     # Default False, uses only Interpolate commands up to I11 ie 11 frames, True use all 22 interpolation frames.
                                      # When Ext22 is True, will likely need eg SetMemoryMax(256) to avoid 'Out of Memory' Errors.
    pel    = Default(pel,2)           # Default as for MSuper(), ie 2, range=1 or 2 or 4
    sharp  = Default(sharp,2)         # Default as for MSuper(), ie 2, range=0 -> 2
    rfilter= Default(rfilter,2)       # Default as for MSuper(), ie 2, range=0 -> 4
    ml     = Float(default(ml,100.0)) # Default as for MFlowInter(), ie 100.0, range=greater than 0.0.
    ###
    CP       = c.DeleteFrame(c.Framecount()-1).DuplicateFrame(0)
    CN       = c.DuplicateFrame(c.Framecount()-1).DeleteFrame(0)
    ###
    I        = CP
    sup      = I.MSuper(pel=pel, sharp=sharp, rfilter=rfilter)
    ###
    BAD = 1
    I01_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I01_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I01_01   = I.MFlowInter(sup,I01_bv,I01_fv, time=100.0 * 1 / (BAD+1) , ml=ml)
    BAD = 2
    I02_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I02_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I02_01   = I.MFlowInter(sup,I02_bv,I02_fv, time=100.0 * 1 / (BAD+1), ml=ml)
    I02_02   = I.MFlowInter(sup,I02_bv,I02_fv, time=100.0 * 2 / (BAD+1), ml=ml)
    BAD = 3
    I03_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I03_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I03_01   = I.MFlowInter(sup,I03_bv,I03_fv, time=100.0 * 1 / (BAD+1), ml=ml)
    I03_02   = I.MFlowInter(sup,I03_bv,I03_fv, time=100.0 * 2 / (BAD+1), ml=ml)
    I03_03   = I.MFlowInter(sup,I03_bv,I03_fv, time=100.0 * 3 / (BAD+1), ml=ml)
    BAD = 4
    I04_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I04_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I04_01   = I.MFlowInter(sup,I04_bv,I04_fv, time=100.0 * 1 / (BAD+1), ml=ml)
    I04_02   = I.MFlowInter(sup,I04_bv,I04_fv, time=100.0 * 2 / (BAD+1), ml=ml)
    I04_03   = I.MFlowInter(sup,I04_bv,I04_fv, time=100.0 * 3 / (BAD+1), ml=ml)
    I04_04   = I.MFlowInter(sup,I04_bv,I04_fv, time=100.0 * 4 / (BAD+1), ml=ml)
    BAD = 5
    I05_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I05_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I05_01   = I.MFlowInter(sup,I05_bv,I05_fv, time=100.0 * 1 / (BAD+1), ml=ml)
    I05_02   = I.MFlowInter(sup,I05_bv,I05_fv, time=100.0 * 2 / (BAD+1), ml=ml)
    I05_03   = I.MFlowInter(sup,I05_bv,I05_fv, time=100.0 * 3 / (BAD+1), ml=ml)
    I05_04   = I.MFlowInter(sup,I05_bv,I05_fv, time=100.0 * 4 / (BAD+1), ml=ml)
    I05_05   = I.MFlowInter(sup,I05_bv,I05_fv, time=100.0 * 5 / (BAD+1), ml=ml)
    BAD = 6
    I06_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I06_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I06_01   = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 1 / (BAD+1), ml=ml)
    I06_02   = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 2 / (BAD+1), ml=ml)
    I06_03   = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 3 / (BAD+1), ml=ml)
    I06_04   = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 4 / (BAD+1), ml=ml)
    I06_05   = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 5 / (BAD+1), ml=ml)
    I06_06   = I.MFlowInter(sup,I06_bv,I06_fv, time=100.0 * 6 / (BAD+1), ml=ml)
    BAD = 7
    I07_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I07_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I07_01   = I.MFlowInter(sup,I07_bv,I07_fv, time=100.0 * 1 / (BAD+1), ml=ml)
    I07_02   = I.MFlowInter(sup,I07_bv,I07_fv, time=100.0 * 2 / (BAD+1), ml=ml)
    I07_03   = I.MFlowInter(sup,I07_bv,I07_fv, time=100.0 * 3 / (BAD+1), ml=ml)
    I07_04   = I.MFlowInter(sup,I07_bv,I07_fv, time=100.0 * 4 / (BAD+1), ml=ml)
    I07_05   = I.MFlowInter(sup,I07_bv,I07_fv, time=100.0 * 5 / (BAD+1), ml=ml)
    I07_06   = I.MFlowInter(sup,I07_bv,I07_fv, time=100.0 * 6 / (BAD+1), ml=ml)
    I07_07   = I.MFlowInter(sup,I07_bv,I07_fv, time=100.0 * 7 / (BAD+1), ml=ml)
    BAD = 8
    I08_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I08_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I08_01   = I.MFlowInter(sup,I08_bv,I08_fv, time=100.0 * 1 / (BAD+1), ml=ml)
    I08_02   = I.MFlowInter(sup,I08_bv,I08_fv, time=100.0 * 2 / (BAD+1), ml=ml)
    I08_03   = I.MFlowInter(sup,I08_bv,I08_fv, time=100.0 * 3 / (BAD+1), ml=ml)
    I08_04   = I.MFlowInter(sup,I08_bv,I08_fv, time=100.0 * 4 / (BAD+1), ml=ml)
    I08_05   = I.MFlowInter(sup,I08_bv,I08_fv, time=100.0 * 5 / (BAD+1), ml=ml)
    I08_06   = I.MFlowInter(sup,I08_bv,I08_fv, time=100.0 * 6 / (BAD+1), ml=ml)
    I08_07   = I.MFlowInter(sup,I08_bv,I08_fv, time=100.0 * 7 / (BAD+1), ml=ml)
    I08_08   = I.MFlowInter(sup,I08_bv,I08_fv, time=100.0 * 8 / (BAD+1), ml=ml)
    BAD = 9
    I09_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I09_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I09_01   = I.MFlowInter(sup,I09_bv,I09_fv, time=100.0 * 1 / (BAD+1), ml=ml)
    I09_02   = I.MFlowInter(sup,I09_bv,I09_fv, time=100.0 * 2 / (BAD+1), ml=ml)
    I09_03   = I.MFlowInter(sup,I09_bv,I09_fv, time=100.0 * 3 / (BAD+1), ml=ml)
    I09_04   = I.MFlowInter(sup,I09_bv,I09_fv, time=100.0 * 4 / (BAD+1), ml=ml)
    I09_05   = I.MFlowInter(sup,I09_bv,I09_fv, time=100.0 * 5 / (BAD+1), ml=ml)
    I09_06   = I.MFlowInter(sup,I09_bv,I09_fv, time=100.0 * 6 / (BAD+1), ml=ml)
    I09_07   = I.MFlowInter(sup,I09_bv,I09_fv, time=100.0 * 7 / (BAD+1), ml=ml)
    I09_08   = I.MFlowInter(sup,I09_bv,I09_fv, time=100.0 * 8 / (BAD+1), ml=ml)
    I09_09   = I.MFlowInter(sup,I09_bv,I09_fv, time=100.0 * 9 / (BAD+1), ml=ml)
    BAD = 10
    I10_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I10_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I10_01   = I.MFlowInter(sup,I10_bv,I10_fv, time=100.0 * 1 / (BAD+1), ml=ml)
    I10_02   = I.MFlowInter(sup,I10_bv,I10_fv, time=100.0 * 2 / (BAD+1), ml=ml)
    I10_03   = I.MFlowInter(sup,I10_bv,I10_fv, time=100.0 * 3 / (BAD+1), ml=ml)
    I10_04   = I.MFlowInter(sup,I10_bv,I10_fv, time=100.0 * 4 / (BAD+1), ml=ml)
    I10_05   = I.MFlowInter(sup,I10_bv,I10_fv, time=100.0 * 5 / (BAD+1), ml=ml)
    I10_06   = I.MFlowInter(sup,I10_bv,I10_fv, time=100.0 * 6 / (BAD+1), ml=ml)
    I10_07   = I.MFlowInter(sup,I10_bv,I10_fv, time=100.0 * 7 / (BAD+1), ml=ml)
    I10_08   = I.MFlowInter(sup,I10_bv,I10_fv, time=100.0 * 8 / (BAD+1), ml=ml)
    I10_09   = I.MFlowInter(sup,I10_bv,I10_fv, time=100.0 * 9 / (BAD+1), ml=ml)
    I10_10   = I.MFlowInter(sup,I10_bv,I10_fv, time=100.0 *10 / (BAD+1), ml=ml)
    BAD = 11
    I11_bv   = sup.MAnalyse(isb=true,  delta=BAD+1)
    I11_fv   = sup.MAnalyse(isb=false, delta=BAD+1)
    I11_01   = I.MFlowInter(sup,I11_bv,I11_fv, time=100.0 * 1 / (BAD+1), ml=ml)
    I11_02   = I.MFlowInter(sup,I11_bv,I11_fv, time=100.0 * 2 / (BAD+1), ml=ml)
    I11_03   = I.MFlowInter(sup,I11_bv,I11_fv, time=100.0 * 3 / (BAD+1), ml=ml)
    I11_04   = I.MFlowInter(sup,I11_bv,I11_fv, time=100.0 * 4 / (BAD+1), ml=ml)
    I11_05   = I.MFlowInter(sup,I11_bv,I11_fv, time=100.0 * 5 / (BAD+1), ml=ml)
    I11_06   = I.MFlowInter(sup,I11_bv,I11_fv, time=100.0 * 6 / (BAD+1), ml=ml)
    I11_07   = I.MFlowInter(sup,I11_bv,I11_fv, time=100.0 * 7 / (BAD+1), ml=ml)
    I11_08   = I.MFlowInter(sup,I11_bv,I11_fv, time=100.0 * 8 / (BAD+1), ml=ml)
    I11_09   = I.MFlowInter(sup,I11_bv,I11_fv, time=100.0 * 9 / (BAD+1), ml=ml)
    I11_10   = I.MFlowInter(sup,I11_bv,I11_fv, time=100.0 *10 / (BAD+1), ml=ml)
    I11_11   = I.MFlowInter(sup,I11_bv,I11_fv, time=100.0 *11 / (BAD+1), ml=ml)
    (!Ext22) ? Eval("""
        NICKNAME="  # Define Command mnemonics allowed in command string and file.
        CP =1     # CopyFromPrevious (frame n replaced with frame n-1)
        CN =2     # CopyFromNext     (frame n replaced with frame n+1)
        I1 =3:1   # Interpolate 1
        I2 =4:2   # Interpolate 2
        I3 =6:3   # Interpolate 3
        I4 =9:4   # Etc
        I5 =13:5  #
        I6 =18:6  #
        I7 =24:7  #
        I8 =31:8  #
        I9 =39:9  #
        I10=48:10 #
        I11=58:11 #
        "
        Return c.ClipClop(
        \ CP,
        \ CN,
        \ I01_01,
        \ I02_01,I02_02,
        \ I03_01,I03_02,I03_02,
        \ I04_01,I04_02,I04_03,I04_04,
        \ I05_01,I05_02,I05_03,I05_04,I05_05,
        \ I06_01,I06_02,I06_03,I06_04,I06_05,I06_06,
        \ I07_01,I07_02,I07_03,I07_04,I07_05,I07_06,I07_07,
        \ I08_01,I08_02,I08_03,I08_04,I08_05,I08_06,I08_07,I08_08,
        \ I09_01,I09_02,I09_03,I09_04,I09_05,I09_06,I09_07,I09_08,I09_09,
        \ I10_01,I10_02,I10_03,I10_04,I10_05,I10_06,I10_07,I10_08,I10_09,I10_10,
        \ I11_01,I11_02,I11_03,I11_04,I11_05,I11_06,I11_07,I11_08,I11_09,I11_10,I11_11,
        \ scmd=SCMD,cmd=CMD,nickname=NICKNAME,show=SHOW,dv=DV)
    """) : Eval("""
   ####
   ####
   #### Remainder of the Ext22 script
   ####
   ####
__________________
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; 18th August 2014 at 00:46.
StainlessS is offline   Reply With Quote
Old 19th August 2014, 09:11   #68  |  Link
Jenyok
Warm and fuzzy
 
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 201
StainlessS
.
I could try later (holidays - saturday, sunday).
One question to you.
.
Which version of AviSynth could I use for 32 bits Windows OS ?
.
v.2.5.8 ST, 32-bit at SourceForge
v.2.6.0 ST, 32-bit at SourceForge (still in alpha stage)
v.2.5.8 MT, 32-bit, author SET, discussion at forum.doom9.org
v.2.6.0 MT, 32-bit, author SET at forum.doom9.org
AviSynth+, 32-bit and 64-bit, author ultim at forum.doom9.org. Download avs-plus.net.
.
Thanks mate.
.
__________________
Warm and fuzzy (white and fluffy)
Jenyok is offline   Reply With Quote
Old 19th August 2014, 17:52   #69  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
I've never tried MT versions so cannot comment (I'm rarely in such a hurry that I could be bothered trying to find settings that work for MT,
also, I only have a duel core so dont really need it [I only play with video, dont really need a massively powerful m/c]).

I tried Avisynth+, and tripped over (I think) three problems in 20 minutes, and so quickly reverted to 2.6 official/ICL, dont really
like what has been done (and some of the things that have been removed). However, was quite blown away with the speed
improvements to AverageLuma (official about 5400FPS, RT_Stats about 5800FPS, AVS+ about 30,000FPS via compiler Intrinsics).
Other real time stats eg YPlaneMedian etc are little different to RT_Stats.

I no longer use 2.58 at all, unless for temporary testing. v2.6 is much better, if you dont like the alpha status, then just dont use 2.6
additional colorspaces or functions, 2.58 compatible stuff is considerably more stable.

Suggest v2.6Alpha5 32bit @ Sourceforge, and then download Groucho2004 ICL version, and copy dll to System32 or syswow dir,
(after offical 2.6 install).
Also suggest, get the compressed v2.6+FilterSDK CHM Avisynth docs @ MediaFire in Sig, very handy to have on HotKey.

Have a nice holiday, give it a go when you get time.
__________________
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 11th December 2014, 09:44   #70  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
Quote:
Originally Posted by StainlessS View Post
Quote:
Originally Posted by fvisagie View Post
It seems TWriteAVI() does not support audio .
Oh dear, I'de only used it with an m2v converted to avi, I just assumed it copied the audio.
@StainlessS, just wondering how the audio-also version of TWriteAVI() is coming along?
fvisagie is offline   Reply With Quote
Old 11th December 2014, 16:34   #71  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
Quote:
@StainlessS, just wondering how the audio-also version of TWriteAVI() is coming along?
It aint at the moment, I'm a bit thick and was having trouble figuring out the Vdub source code (+ more advanced CPP stuff, I'm not that good at CPP).
I have not forgotten it though.
Wish the guy that ripped out original VD source would have kept in audio capability, would be snapped up by many other projects, eg
the CamStudio lot have done their best to produce a good screen cap util, but is a bit lacking. I'm guessin if I did get it working that they + others
would immediately snap it up and mod.

EDIT: To compound matters, I dont have or know which version of VDub source the TWriteAVI source came from.
__________________
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; 11th December 2014 at 16:37.
StainlessS is offline   Reply With Quote
Old 11th December 2014, 20:06   #72  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
Thanks. Not to worry on my account, though, I'll find another approach in the meantime.
fvisagie is offline   Reply With Quote
Old 18th October 2015, 22:53   #73  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
DB_SpliceClip.avs, part 1 of two (too big)

Code:
# ############
# DB_SpliceClips.Avs, by StainlessS. RT_Stats DataBase Utility Functions.
# Requires:
#    GScript,  (c) Gavino       http://forum.doom9.org/showthread.php?t=147846
#    RT_Stats, (c) StainlessS   http://forum.doom9.org/showthread.php?t=165479
#    TWriteAVI (c) Kevin Stone, http://forum.doom9.org/showthread.php?t=172761 (other versions may be broken)
# ############


Function DB_SpliceClips(String DB,String OUTAVI,Int "FileNameField",Int "StartFrameField",Int "EndFrameField",Int "ClipDBField",
        \ Int "OpenMAX",Int "Pass1MAX", String "FourCC",
        \ String "Log",Bool "Append",Bool "Debug",Bool "Verbose",String "OpenClip",String "Global_Header") {
/*
    DB_SpliceClips(), Splices a number of video clips together. It is normally difficult/impossible to splice more than about 25
    clips, due to system resource limitations (limit on number of open clips). This function splices them into bigger and bigger
    clips, saving each aggregate clip before re-opening & splicing them together into even bigger ones, until the whole job is done.
    The function needs a DB set up with filenames of the clips to splice, using either DB_AppendFileNamesFromDir() or DB_AppendFileName().
        It is possible to render AVS scripts into lossless AVI, and join together with others, tested up to 1000 input clips.
    You can include a Global header, so as to pass global info to a group of AVS clips, perhaps of use in conversion of clips to all
    be of similar characteristics so that they can be spliced together.
        It is also possible for an AVS file to create its own DBase and pass the filename via a global variable, into the OpenClip() function,
    and have that filename entered into the main DBase so that your private clip DBase can be accessed at any point/frame in the completed
    movie (when playing).

    #################
    DB, Name of the DBase file, already setup containing filenames to splice together, eg *.AVS,*.AVI etc files.
    OUTAVI, Filename of the output AVI file.
    FileNameField, DBase field that holds the filename of an input video clip. Default 0.
    StartFrameField, DBase field that will hold the START frame number of the input clip for current record. (relative to complete spliced movie).
        Default -1, Not used.
    EndFrameField, DBase field that will hold the END frame number of the input clip for current record. (relative to complete spliced movie).
        Default -1, Not used.
    ClipDBField, DBase field that will hold a filename of a personal DBase for the input clip. Default -1, Not used.  See DB_SpliceOpenClip().
    OpenMAX, Maximum number of clips that can be opened at once (due to system resource restrictions), Default 20.
    Pass1MAX, Maximum number of clips that can be opened at once for the original source clips only, default OpenMAX, 1 <= Pass1MAX <= OpenMAX.
        If the source clips are AVS, then they may already have many input clips open, if I/P AVS, suggest Pass1MAX = 1, where the AVS will be
    rendered into lossless AVI on first pass.
    FourCC, Default "ULY0",  Lossless UT Video YV12 rec.601. For Output AVI clip and also temporary aggregate files. (Requires UT Video codec)
    Log, Default "". LogFile Name.
    Append, Default TRUE, Append output to any currently existing log file.
    Debug, Default False. If true then output logging to DebugView window (google).
    Verbose, Default False. If true then output extra info to Log file and Debug window.
    OpenClip, Default "DB_SpliceOpenClip". Name of function to call to open a video clip or import an AVS.
       See args for DB_SpliceOpenClip(), must take identical args, none of which are optional.
    Global_Header, Default "". Filename of AVS file containing Global Variable Initialization, and perhaps LoadPlugins.
       Global args will be available to any AVS files imported in OpenClip() function, See DB_SpliceOpenClip().
    Returns the number of records (clips) in the DBase.
*/
    ### AVS Header file containing only Globals (maybe LoadPlugins too)
    ### Globals initialized and so available during AVS Import.
    Global_Header=Default(Global_Header,"")
    (Global_Header != "") ? Import(Global_Header) : NOP
    ###
    START=RT_TimerHP()
    myName="DB_SpliceClips: "
    Assert(Exist(DB),myName+"'"+DB+"' Does not Exist")
    Assert(OUTAVI!="",myName+"'"+OUTAVI+"' Need OUTAVI Name")
    Ext=RT_GetFileExtension(OUTAVI)
    Assert(Ext==".avi",myName+"'"+OUTAVI+"' Not an AVI")
    records=RT_DBaseRecords(DB)
    Fields=RT_DBaseFields(DB)
    FileNameField=Default(FileNameField,0)
    Assert(FileNameField>=0 && FileNameField<Fields,RT_String("%s FileNameField %d Does NOT Exist",myName,FileNameField))
    Assert(RT_DBaseFieldType(DB,FileNameField)==3,RT_String("%s FileNameField %d is NOT String",myName,FileNameField))
    StartFrameField=Default(StartFrameField,-1)
    Assert(StartFrameField<Fields,RT_String("%s StartFrameField %d Does NOT Exist",myName,StartFrameField))
    Assert(StartFrameField<0 || RT_DBaseFieldType(DB,StartFrameField)==1,RT_String("%s StartFrameField %d is NOT Int",myName,StartFrameField))
    EndFrameField=Default(EndFrameField,-1)
    Assert(EndFrameField<Fields,RT_String("%s EndFrameField %d Does NOT Exist",myName,EndFrameField))
    Assert(EndFrameField <0 || RT_DBaseFieldType(DB,EndFrameField)==1,RT_String("%s EndFrameField %d is NOT Int",myName,EndFrameField))
    ClipDBField=Default(ClipDBField,-1)
    Assert(ClipDBField<Fields,RT_String("%s ClipDBField %d Does NOT Exist",myName,ClipDBField))
    Assert(ClipDBField <0 || RT_DBaseFieldType(DB,ClipDBField)==3,RT_String("%s ClipDBField %d is NOT String",myName,ClipDBField))
    OpenMAX=Default(OpenMAX,20)                                                           # maximum num of clips to join at once
    Assert(OpenMAX>1,RT_String("%s OpenMAX %d MUST be greater than 1",myName,OpenMAX))
    Pass1MAX=Default(Pass1MAX,OpenMAX)                                                    # maximum num of clips to join at once, 1st PASS
    Assert(Pass1MAX>=1 && Pass1MAX <= OpenMAX,RT_String("%s 1 <= Pass1MAX(%d) <= OpenMAX(%d)",myName,Pass1MAX,OpenMAX))
    FourCC=Default(FourCC,"ULY0")                                                         # UT Video YV12 rec.601
    Log=Default(Log,"")
    Log=(Log!="") ? RT_FilenameSplit(Log) : Log                                           # convert to full path name (also convert / to \ )
    Append=Default(Append,True)
    (!Append && Log!="" && Exist(Log)) ? RT_FileDelete(Log) : NOP
    Debug=Default(Debug,False)
    Verbose=Default(Verbose,False)
    dbgS=String(Debug)  VerbS=String(VerBose)
    OpenClip=Default(OpenClip,"DB_SpliceOpenClip")
    Assert(OpenClip != "",myName+"OpenClip cannot be empty string, need a function name")
    FnFMT="""%s("%s",%i,%i,%i,%i,%i,%i,"%s",%s,%s)"""
    CompleteFrames = 0  FrameNo = 0     Pass = 0   NClips = records     TotalFramesR=0  TotalFramesW=0
    PassMAX=Pass1MAX
    GSCript("""
        While (NClips > 0) {
            if(NClips <= OpenMAX && PassMAX==OpenMAX) {
                ODB=""                                                                      # Last Pass, dont need Output DB
            } Else {
                ODB="~TEMP_"+RT_LocalTimeString()+".DB"
                RT_DBaseAlloc(ODB,0,"s1024")
            }
            ACC = 0    JOINED=0     OCNT=0
            for(in_i=0,NClips-1) {
                if(Pass==0) {
                    FN=RT_DBaseGetField(DB,in_i,FileNameField)
                    EVS=RT_String(FnFMT,OpenClip,DB,in_i,FileNameField,StartFrameField,EndFrameField,ClipDBField,FrameNo,Log,DbgS,VerbS)
                    in_c = Eval(EVS)                                                               # Call OpenClip
                    Len = in_c.FrameCount
                    if(Verbose && (Debug || Log!="")) {
                        S=RT_String("%d:%d ] OPENED Len=%d I/P Clip %s",Pass,in_i,Len,FN)
                        (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
                        (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
                    }
                    FrameNo = FrameNo+Len
                } Else {
                    FN=RT_DBaseGetField(DB,in_i,0)                                                  # Field 0 was Filename string in Aggregate DB
                    in_c = AviSource(FN)                                                            # Always AVI
                    Len = in_c.FrameCount
                    if(Verbose && (Debug || Log!="")) {
                        S=RT_String("%d:%d ] Len=%d Aggregate Clip %s",Pass,in_i,Len,FN)
                        (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
                        (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
                    }
                }
                ACC = (ACC.IsClip()) ? ACC ++ in_c  : in_c
                JOINED = JOINED + 1
                if(JOINED>=PassMAX || in_i==NClips-1) {                                    # limit or last input clip ?
                    if(ODB=="") {
                        OFN = OUTAVI                                                       # Very last FINAL OUTPUT file
                    } Else {
                        OFN = "~TEMP_"+RT_LocalTimeString()+".AVI"
                        RT_DBaseAppend(ODB,OFN)                                            # rem aggregate o/p filename
                    }
                    OCNT=OCNT+1
                    out_c=TWriteAVI(ACC,OFN,True,True,FourCC=FourCC)
                    Len = out_c.FrameCount
                    CompleteFrames = (ODB=="") ? Len : 0
                    TotalFramesR=TotalFramesR+Len
                    if(Debug || Log!="") {
                        S=RT_String("%d:%d ] Len = %d WRITING Aggregate Clip %s",Pass,OCNT,Len,OFN)
                        (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
                        (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
                    }
                    out_c.ForceProcessAVI()
                    ACC = 0 in_c = 0 out_c = 0                                              # MAKE SURE each clip closed and destructor called
                    ACC = AviSource(OFN)                                                    # Always AVI
                    TotalFramesW=TotalFramesW+ACC.FrameCount
                    ACC=0                                                                   # Close it again
                    JOINED = 0
                }
            }
            if(Pass != 0 ) {
                if(Verbose && (Debug || Log!="")) {
                    S=RT_String("%d ] Deleting Aggregate Clips and DB %s",Pass,DB)
                    (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
                    (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
                }
                for(deli=0,NClips-1) {RT_FileDelete(RT_DBaseGetField(DB,deli,0))}           # Delete temp aggregate files (DONT DEL ORIGINAL I/P FILES)
                RT_FileDelete(DB)                                                           # Delete aggregate i/p DB
            }
            Pass = Pass + 1
            PassMAX = OpenMAX                                                               # Change to OpenMAX for next PASS != 0
            DB=ODB                                                                          # Next I/P is OLD O/P
            NClips = (DB=="") ? 0 : RT_DBaseRecords(DB)                                     # Last Pass ?
        }
        if(Debug || Log!="") {
            T=RT_TimerHP() - START
            S=RT_String("Output AVI Length = %d Frames",CompleteFrames)
            (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
            (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
            if(TotalFramesR > 0) {
                S=RT_String("Read  %d Frames %f FPS (%f SPF)",TotalFramesR,TotalFramesR/T,T/(TotalFramesR))
                (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
                (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
            }
            if(TotalFramesW > 0) {
                S=RT_String("Write %d Frames %f FPS (%f SPF)",TotalFramesW,TotalFramesW/T,T/(TotalFramesW))
                (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
                (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
            }
            S=RT_String("Time = %f secs (%.2f mins)",T,T/60.0)
            (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
            (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
        }
        return records
    """)
}
You need the TWriteAVI from here, :- http://forum.doom9.org/showthread.php?t=172761
__________________
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; 31st October 2015 at 20:19. Reason: Update
StainlessS is offline   Reply With Quote
Old 18th October 2015, 22:54   #74  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
DB_SpliceClip.avs, part 2 of 2 (too big)

Code:
Function DB_SpliceOpenClip(String DB,Int Record,Int FileNameField,Int StartFrameField,Int EndFrameField,Int ClipDBField,
           \ Int FrameNo, String Log,Bool Debug, Bool Verbose) {
/*
    DB_SpliceOpenClip(), Called by DB_SpliceClips (by default) to Open a video clip, either an AVS or container format.
*/
    myName="DB_SpliceOpenClip: "
    clp = 0                                                                                 # Not yet got a clip
    GSCript("""
        FN=RT_DBaseGetField(DB,Record,FileNameField)                                        # Get clip Filename from DBase record
        Ext=RT_GetFileExtension(FN)                                                         # Open File based on extension
        if(Debug || Log!="") {
            S=RT_String("%d ] Opening as Ext='%s' : '%s'",Record,Ext,FN)
            (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
            (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
        }
        if( Ext==".AVS" )      {
            # The Import on AVS, Allows you to join files of differing characteristics, if you eg resize everything to same size in AVS files.
            # Could eg use in DB_SpliceClips(Global_Header) arg script, intialized to Global Glb_Width=0,
            #   Then in your script set Global Glb_Width = Clip.Width when Glb_Width==0
            #   Then resize to width = Glb_Width.
            #   Or, Set Initial Global Glb_Width = RequiredWidth, and so when resized to Glb_Width, all clips would be resized to RequiredWidth.
            #   Exactly the same with other characterists that need to be identical to splice files.
            #
            # In AVS Script, You could create a clip DBase to hold whatever you want, eg subtitles FileName, original width/height,
            # what frames were trimmed off, data extracted using MediaInfo, your favorite color or anything you like.
            # This clip DBase could be eg based on the ScriptName() + ".DB". So, WhenEver you open the script, it creates its own
            # DBase with its own records and fields, fills them with whatever it wants, and then sets Global GLB_CLIPDBASE = myDBName
            # where myDBName is whatever you decided to call it (best based on script name, with full path). Can use name=RT_FilenameSplit(name)
            # to convert to full path name if not already full path.
            # Below, Eg, Set ClipDBField to hold FileName of client Clip Dbase (holding Whatever Client wants it to hold)
            Global GLB_CLIPDBASE = RT_Undefined                                 # Make Sure we dont use variable set by a different script.
            clp = Import(FN)                                                    # Script should setup its own DBase itself, storing whatever.
            if( RT_VarExist("GLB_CLIPDBASE") && IsString(GLB_CLIPDBASE) && ClipDBField>=0) {
                RT_DBaseSetField(DB,Record,ClipDBField, GLB_CLIPDBASE )
                # Now the client DBase filename is available in ClipDBField field of the clip's record in the main DB.
                if(Debug || Log!="") {
                    S=RT_String("%d ] Client clip DBase Stored '%s'",Record,GLB_CLIPDBASE)
                    (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
                    (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
                }
            }
        } Else {
            # Here, open clip based on filename extension, needs to be expanded for additional source filters.
            if( Ext==".AVI" )  { clp = AviSource(FN) }                                     # Whatever, Select source filter based on Extension
            Else               { clp = DirectShowSource(FN) }
        }
        if(!clp.IsClip()) {
            S=RT_String("%d ] *** Not A Clip *** on %s",Record,FN)
            # Output to Debug even if not required.
            RT_DebugF("%s",S,name=myName)
            (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
            Assert(False,myName+S)
        }
        Len = clp.FrameCount
        if(StartFrameField>=0)  {                                                       # set Start Frame of clip relative to main movie
            if(Debug || Log!="") {
                S=RT_String("%d ] StartFrameField Set to %d",Record,FrameNo)
                (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
                (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
            }
            RT_DBaseSetField(DB,Record,StartFrameField,FrameNo)
        }
        if(EndFrameField>=0)    {                                                       # set End Frame of clip relative to main movie
            if(Debug || Log!="") {
                S=RT_String("%d ] EndFrameField   Set to %d",Record,FrameNo+Len-1)
                (Debug)   ? RT_DebugF("%s",S,name=myName) : NOP
                (Log!="") ? RT_TxtWriteFile(S,Log,Append=True) : NOP
            }
            RT_DBaseSetField(DB,Record,EndFrameField,FrameNo+Len-1)
        }
        return clp
    """)
}
__________________
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; 31st October 2015 at 20:20. Reason: Update
StainlessS is offline   Reply With Quote
Old 18th October 2015, 22:54   #75  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
DB_AppendFileName.Avs
Code:
# ############
# DB_AppendFileName.Avs, by StainlessS. RT_Stats DataBase Utility Functions.
# Requires:
#    GScript,  (c) Gavino      http://forum.doom9.org/showthread.php?t=147846
#    RT_Stats, (c) StainlessS  http://forum.doom9.org/showthread.php?t=165479
# ############
Function DB_AppendFileName(String DB,String FileName,Int "FileNameField",String "Log",Bool "Append",Bool "Debug",Bool "Verbose",Bool "MustExist") {
/*
    DB_AppendFileName(), Given a DB Dbase, appends (ie adds records) and fills one field of each new record with a filename.
        The remainder of the fields receive null data, ie Int=0, Float=0.0, Bool=False, String="", Bin=0.
        The filenames added will be converted to Full Path Filenames if they are not already.
    DB, Name of DBase file.
    FileName, can be a Chr(10) separated list of filenames where each separate filename will be added to the Dbase.
    FileNameField, Default 0. The field number in YOUR DBase that will hold the filenames you will add to the DBase.
    Log, Default "" (not used). If filename given then outputs info to that file.
    Debug, Default False. When True, output info to DebugView Window (Google).
    Verbose, Default False. When True, adds extra info to logs and debug output.
    MustExist, Default True. If True then the filesnames you add must already exist, else will throw an error.
    Returns the number of filenames added to the DBase.

    Example:
        RT_DBaseAlloc(DB,0,"s1024if")  # Allocate DBase file named DB, with 0 records pre-allocated, 3 fields of type String[1024], Int, Float.
        Files = "Text_1.Txt" + Chr(10) + "Text_2.Txt" + Chr(10)         # Two file names we will add to 1st field 0 (string, max len=1024).
        DB_AppendFileName(DB,Files,FileNameField=0,MustExist=False)     # Append two records each with file names that do not have to exist.
*/
    myName = "DB_AppendFileName: "
    Assert(Exist(DB),myName+"'"+DB+"' Does not Exist")
    records=RT_DBaseRecords(DB)     Fields=RT_DBaseFields(DB)
    Log=Default(Log,"")
    Append=Default(Append,True)
    (!Append && Log!="" && Exist(Log)) ? RT_FileDelete(Log) : NOP
    Debug=Default(Debug,False)
    Verbose=Default(Verbose,False)
    MustExist=Default(MustExist,True)
    GSCript("""
        FileNameField=Default(FileNameField,0)
        Assert(FileNameField>=0 && FileNameField<Fields,RT_String("%s FileNameField %d Does NOT Exist",myName,FileNameField))
        Assert(RT_DBaseFieldType(DB,FileNameField)==3,RT_String("%s FileNameField %d is NOT String",myName,FileNameField))
        NFILES=RT_TxtQueryLines(FileName)                                           # Query Number of lines in String ie number of FileNames.
        if(Debug || Log!="") {
            S=RT_String("Writing %d files",NFiles)
            (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
            (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
        }
        Count = 0
        for(i=0,NFILES-1) {
            FN=RT_TxtGetLine(FileName,i)                                            # file name
            if(!Exist(FN)) {
                if(Verbose && (Debug || Log!="")) {
                    S=RT_String("%d/%d ] *** File Does NOT Exist *** '%s'",i+1,NFILES,FN)
                    (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
                    (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
                }
                Assert(!MustExist,myName+String(i)+" ] '"+FN+"' Does not Exist")
            }
            FN=RT_FilenameSplit(FN)                                             # convert to full path name (also convert / to \ )
            if(Verbose && (Debug || Log!="")) {
                S=RT_String("%d/%d ] DBaseAppend(%d) = '%s'",i+1,NFILES,records+i,FN)
                (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
                (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
            }
            RT_DBaseExtend(DB,1)                                                # Add a record with null fields
            RT_DBaseSetField(DB,records+i,FileNameField,FN)                     # Set only the selected FileName string field
            Count = Count + 1
        }
        Return Count
    """)
}


Function DB_AppendFilenamesFromDir(String DB,String "Dir",String "WildCard",Int "FileNameField",
            \ String "Log",Bool "Append",Bool "Debug",Bool "Verbose") {
/*
    DB_AppendFilenamesFromDir(), Given a DB Dbase, appends (ie adds records) and fills one field of each new record with a filename.
        The remainder of the fields receive null data, ie Int=0, Float=0.0, Bool=False, String="", Bin=0.
        The filenames added will be converted to Full Path Filenames if they are not already.
    DB, Name of DBase file.
    Dir, Default "" = Current directory. Dir can be a Chr(10) separated list of directories where filenames from each directory can be
        added to the Dbase. All directories must exist else error.
    WildCard, Default "*.*", matches everything. Used to filter and select files in a directory.
      Eg, "F*d.jpg" or "Fr?d.jp*g". where the '?' character matches any single character and the '*' char matches zero or more characters.
      Can take multiple pipe ('|') separated Wilcards in the extension ONLY, as in "*.BMP|JP*G|PNG"
    FileNameField, Default 0. The field number in YOUR DBase that will hold the filenames you will add to the DBase.
    Log, Default "" (not used). If given filename then outputs info to that file.
    Debug, Default False. When True, output info to DebugView Window (Google).
    Verbose, Default False. When True, adds extra info to logs and debug output.
    Returns the number of filenames added to the DBase.

    Example:
        RT_DBaseAlloc(DB,0,"s1024if")  # Allocate DBase file named DB, with 0 records pre-allocated, 3 fields of type String[1024], Int, Float.
        Dirs = "Dir_1" + Chr(10) + "Dir_2" + Chr(10)                    # Two Directories containing files we will add to the Dbase.
        DB_AppendFileName(DB,Dirs,"*.AVI|AVS",FileNameField=0)          # Append 1 record for each file in the two directories that match wildcard.
*/
    myName = "DB_AppendFileNamesFromDir: "
    STIM = RT_TimerHP()
    Assert(Exist(DB),myName+"'"+DB+"' Does not Exist")
    records=RT_DBaseRecords(DB)     Fields=RT_DBaseFields(DB)
    Directories=Default(Dir,"")                                             # default "" converted to current dir
    WildCard=Default(WildCard,"*.*")                                        # default match everything
    FileNameField=Default(FileNameField,0)
    Log=Default(Log,"")
    Append=Default(Append,True)
    (!Append && Log!="" && Exist(Log)) ? RT_FileDelete(Log) : NOP
    Debug=Default(Debug,False)
    Verbose=Default(Verbose,False)
    GSCript("""
        if(Debug || Log!="") {
            S=RT_String("DB Name      = '%s'",DB)
            (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
            (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
            S=RT_String("Records      = %d",records)
            (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
            (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
            S=RT_String("Fields       = %d",fields)
            (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
            (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
            TYPENAMES=RT_String("Bool\nInt\nFloat\nString\nBin\n")
            for(i=0,Fields - 1) {
                TYPE_S=RT_TxtGetLine(TYPENAMES,RT_DBaseFieldType(DB,i))
                S =RT_String("  %2d ) Type = %d(%6s) Size = %d",i,RT_DBaseFieldType(DB,i),TYPE_S,RT_DBaseFieldSize(DB,i))
                (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
                (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
            }
        }
        Assert(FileNameField>=0 && FileNameField<Fields,RT_String("%s FileNameField %d Does NOT Exist",myName,FileNameField))
        Assert(RT_DBaseFieldType(DB,FileNameField)==3,RT_String("%s FileNameField %d is NOT String",myName,FileNameField))
        Directories = (Directories=="") ? "." : Directories
        DIR=""
        NDIRS=RT_TxtQueryLines(Directories)                                    # Query Number of lines in String ie number of Directories.
        for(i=0,NDIRS-1) {
            DN=RT_TxtGetLine(Directories,i)                                    # Directory name
            DN = (DN=="") ? "." : DN                                           # Current Dir
            DN=RT_FilenameSplit(DN)                                            # convert to full path name (convert / to \ )
            While(RightStr(DN,1)=="\") { LeftStr(DN,Strlen(DN)-1) }            # Strip any trailing slash else Exist fails
            Assert(Exist(DN),myName+String(i)+" ] '"+DN+"' Does not Exist")
            DN = DN + "\"                                                      # Append Backslash
            DIR = RT_TxtAddStr(DIR,DN)
        }
        if(Debug || Log!="") {
            S=RT_String("Searching %d Directories for files matching '%s'",NDIRS,WildCard)
            (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
            (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
        }
        Count = 0
        for(D = 0,NDIRS-1) {
            DN=RT_TxtGetLine(DIR,D)                                                 # Directory name
            TMPLIST = "~TEMP_"+RT_LocalTimeString()+".txt"
            if(Verbose && (Debug || Log!="")) {
                S=RT_String("%d/%d Searching for files in '%s'",D+1,NDIRS,DN)
                (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
                (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
            }
            N=RT_WriteFileList(DN+WILDCARD,TMPLIST)                                 # Create a listing movie files
            if(Debug || Log!="") {
                S=RT_String("%d/%d Found %d Files in %s",D+1,NDIRS,N,DN)
                (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
                (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
            }
            if(N>0) {
                FLIST=RT_ReadTxtFromFile(TMPLIST)                                   # Get list of files
                Count = Count + DB_AppendFileName(DB,FLIST,FileNameField,Log=Log,Append=True,debug=Debug,Verbose=Verbose,MustExist=True)
            }
            if(Verbose && (Debug || Log!="")) {
                S=RT_String("%d/%d Deleting Temp FileList %s",D+1,NDIRS,TMPLIST)
                (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
                (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
            }
            RT_FileDelete(TMPLIST)
        }
        if(Debug || Log!="") {
            S=RT_String("Total Files Added to DBase = %d",Count)
            (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
            (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
            ETIM = RT_TimerHP()
            S=RT_String("Time = %f secs",ETIM-STIM)
            (Debug)     ? RT_DebugF("%s",S,name=myName) : NOP
            (Log!="")   ? RT_TxtWriteFile(myName+S,LOG,Append=True) : NOP
        }
        Return Count
    """)
}
__________________
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; 31st October 2015 at 20:21. Reason: Update
StainlessS is offline   Reply With Quote
Old 18th October 2015, 22:55   #76  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
DB_FindTrim.avs
Code:
# ############
# DB_FindTrim.avs
# DB_FindTrim Returns clip (or record number) containing movie frame Frame.
#   Search DBase for the record (clip) that contains the arg Frame, using Binary Search.
#   S_Field is the DB field that contains the first frame of the record clip.
#   E_Field is the DB field that contains the Last frame of the record clip.
#   Return of -1 = NOT FOUND.
# ############

Function DB_FindTrim(String DB,Int S_Field,Int E_Field,Int Frame) {
    result = -1                                                     # Init NOT FOUND
    low     = 0
    high    = RT_DBaseRecords(DB) - 1
    GSCript("""
        while(low <= high) {
            mid = (low + high) / 2
            if(RT_DBaseGetField(DB,mid,E_Field) < Frame) {
                low = mid + 1
            } Else If (RT_DBaseGetField(DB,mid,S_Field) > Frame) {
                high = mid - 1
            } Else {
                low = high + 1                                      # Force exit
                Result = mid
            }
        }
    """)
    return result
}
__________________
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; 31st October 2015 at 20:21. Reason: Update
StainlessS is offline   Reply With Quote
Old 18th October 2015, 22:57   #77  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
Use new TWriteAVI from here (still work in-progress):- http://forum.doom9.org/showthread.ph...24#post1743324

1_MakeTestClips.avs
Code:
# 1_MakeTestClips.avs

# Requires 5 empty directories in current Directory. DIR0, DIR1, DIR2, DIR3, DIR4
# View Progress via DebugView

Avisource("E:\V\StarWars.avi")      # YV12,YUY2,RGB - (with audio)
###
ConvertToYV12()                     # we're gonna use UT_Video YV12 rec601 codec
###
#ConvertAudioTo8Bit
#ConvertAudioTo16Bit
#ConvertAudioTo24Bit
#ConvertAudioTo32Bit
ConvertAudioToFloat


# Below 1000*20, (20,000) frames produced, source clip must be at least that length.
NCLIPS      =   1000            # Number of clips produced, total
CLIPLEN     =   20              # Frames Per clip

NDIRS       =   5               # Number of directories

MAXPERDIR   =   Int(Ceil(Float(NCLIPS) / NDIRS))    # max number of clips per directory

myName="MakeTestClips: "

Assert(Framecount>= NCLIPS * CLIPLEN,myName+"Not Enough Frames, need " + String(NCLIPS * CLIPLEN))

GSCript("""
    For(i=0,NCLIPS-1) {
        FN=RT_String("DIR%d\\File_%06d.AVI",i/MAXPERDIR,i)
        RT_DebugF("%d ] Name=%s",i,FN,name=myName)              # Output to DebugView (Google)
        c=Trim(i*CLIPLEN,-CLIPLEN)
        o=TWriteAVI(c,FN,True,True,FourCC="ULY0")
        o.ForceProcessAVI()
        o = 0                                       # Close clip and call clip Destructor, Not Necessary
    }
""")

MessageClip(myName+"All Done")
__________________
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; 31st October 2015 at 20:22. Reason: Update
StainlessS is offline   Reply With Quote
Old 18th October 2015, 22:58   #78  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
2_SpliceClips.avs (The actual joining script)
Code:
# 2_SpliceClips.avs

import("DB_AppendFilename.avs")
import("DB_SpliceClips.avs")
import("DB_FindTrim.avs")


# Make DataBase of Fullpath clip filenames given a file or string containing directories.
# Fills in ONLY the FileName in field 0
# View Progress via DebugView

OUTAVI          = "Movie.AVI"
DB              = "Movie.DB"
DB_TYPESTRING   = "s1024ii"                      # 1 String[1024] Filename, 2 Int fields (Start,End frames in final movie)
DB_FILENAMEFIELD= 0
GLOBAL_HEADER   = ""                             # Not needed for this demo (all same size etc)

#Directory Names in String pseudo array
DIR_STRING="DIR0"+Chr(10)+"DIR1"+Chr(10)+"DIR2"+Chr(10)+"DIR3"+Chr(10)+"DIR4"+Chr(10)
# OR DIR_STRING=RT_String("DIR0\nDIR1\nDIR2\nDIR3\nDIR4\n")

#DIR_STRING="DIR1"

WILDCARD = "*.AVI|DIVX|XDIV|MKV|MPG|MOV|MP4|M4V|WMV"           # Whatever
LOG_FN   = "MakeDB.LOG"
FOURCC   = "ULY0"                                              # Video Codec FOURCC (UT_Video rec601 YV12)

##################
    myName="SpliceClips: "
    (Exist(LOG_FN)) ? RT_FileDelete(LOG_FN) : NOP
    DLIST=DIR_STRING
    RT_DBaseAlloc(DB,0,DB_TYPESTRING)               # Allocate Dbase, 0 Records
    DB_AppendFileNamesFromDir(DB,DLIST,Wildcard,DB_FILENAMEFIELD,Log=LOG_FN,Debug=True,Verbose=True)
    DB_SpliceClips(DB,OUTAVI,StartFrameField=1,EndFrameField=2,ClipDBField=-1,OpenMax=24,Pass1Max=24,
        \ FourCC=FOURCC,Log=LOG_FN,Append=True,Debug=True,Verbose=True,Global_Header=GLOBAL_HEADER)

MessageClip(myName+"All Done")
__________________
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; 31st October 2015 at 20:23. Reason: Update
StainlessS is offline   Reply With Quote
Old 18th October 2015, 23:00   #79  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
4_ShowMovieDB.avs
Code:
# 4_ShowMovieDB.avs
# Write contents of Moveie.DB to DebugView window (google) 

TYPENAMES=RT_String("Bool\nInt\nFloat\nString\nBin\n")

DB="MOVIE.DB"

GSCript("""
    myName="ShowMovieDB: "
    S=DB
    RT_DebugF("\n%s\n",S)
    Records=RT_DBaseRecords(DB)
    Fields=RT_DBaseFields(DB)
    S=RT_String("Records      = %d",RT_DBaseRecords(DB))
    RT_DebugF(S)
    S=RT_String("RecordSize   = %d",RT_DBaseRecordSize(DB))
    RT_DebugF(S)
    S=RT_String("RecordsMax   = %d ($%X)",RT_DBaseRecordsMax(DB),RT_DBaseRecordsMax(DB))
    RT_DebugF(S)
    FIELDS=RT_DBaseFields(DB)
    S=RT_String("Fields       = %d",FIELDS)
    RT_DebugF(S)
    for(i=0,Fields - 1) {
        TYPE_S=RT_TxtGetLine(TYPENAMES,RT_DBaseFieldType(DB,i))
        S =RT_String("  %2d ) Type = %d(%6s) Size = %d",i,RT_DBaseFieldType(DB,i),TYPE_S,RT_DBaseFieldSize(DB,i))
        RT_DebugF("%s",S)
    }

    QUOT=Chr(34)
    for(i=0,Records-1) {
        RT_DebugF("%d] ----------------",i)
        for(j=0,fields-1) {
            Typ=RT_DBaseFieldType(DB,j)
            RT_DebugF("        %d:%d] %s%s%s",i,j,Typ==3?QUOT:"",String(RT_DBaseGetField(DB,i,j)),Typ==3?QUOT:"")
        }
    }

""")

MessageClip(myName+"All Done")
The six previous posts are updates to the previously posted file joining scripts, requires TWriteAVI mod posted here:- http://forum.doom9.org/showthread.php?t=172761

Above prev posts joins 1000 * 20 frame test clips together (Video + Audio).
__________________
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; 31st October 2015 at 20:24. Reason: Update
StainlessS is offline   Reply With Quote
Old 19th October 2015, 00:27   #80  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,132
For This demo, you need an AVS directory in current directory containing File_000001.avi, File_000002.avi and File_000003.avi files,
each of these can be different sizes (everything else the same [we are only gonna demo for diff sizes here]).
About 500 frames each.

Also in same AVS directory need '001.avs", '002.avs", and '003.avs".

'001.avs",
Code:
FN = "File_000001.AVI"
AVISource(FN)
#
Global GLB_SPLICE_WIDTH  = (GLB_SPLICE_WIDTH ==0) ? Width  : GLB_SPLICE_WIDTH       # Usage of Global Header
Global GLB_SPLICE_HEIGHT = (GLB_SPLICE_HEIGHT==0) ? Height : GLB_SPLICE_HEIGHT
Spline36Resize(GLB_SPLICE_WIDTH,GLB_SPLICE_HEIGHT)
#                                                                                   # Passing Private Dbase to Main DB
DB_TYPESTRING   = "sss1024"                                                         # Field 0 string[256], Field 1 string[256], Field 2 String[1024]
Global GLB_CLIPDBASE=ScriptName+".DB"                                               # Global to make available via main DBase
RT_DBaseAlloc(GLB_CLIPDBASE,1,DB_TYPESTRING)                                        # 1 Record (record 0), 3 Fields
TIM = RT_LocalTimeString(File=False)                                                # What time is it ?
RT_DBaseSet(GLB_CLIPDBASE,0,Chr(7)+"!Red"+Chr(7)+"-",TIM,FN)                        # Record 0, Fill all three fields
#
Return Last
'002.avs",
Code:
FN = "File_000002.AVI"
AVISource(FN)
#
Global GLB_SPLICE_WIDTH  = (GLB_SPLICE_WIDTH ==0) ? Width  : GLB_SPLICE_WIDTH       # Usage of Global Header
Global GLB_SPLICE_HEIGHT = (GLB_SPLICE_HEIGHT==0) ? Height : GLB_SPLICE_HEIGHT
Spline36Resize(GLB_SPLICE_WIDTH,GLB_SPLICE_HEIGHT)
#                                                                                   # Passing Private Dbase to Main DB
DB_TYPESTRING   = "sss1024"                                                         # Field 0 string[256], Field 1 string[256], Field 2 String[1024]
Global GLB_CLIPDBASE=ScriptName+".DB"                                               # Global to make available via main DBase
RT_DBaseAlloc(GLB_CLIPDBASE,1,DB_TYPESTRING)                                        # 1 Record (record 0), 3 Fields
TIM = RT_LocalTimeString(File=False)                                                # What time is it ?
RT_DBaseSet(GLB_CLIPDBASE,0,Chr(7)+"4Green"+Chr(7)+"-",TIM,FN)                      # Record 0, Fill all three fields
#
Return Last
'003.avs",
Code:
FN = "File_000003.AVI"
AVISource(FN)
#
Global GLB_SPLICE_WIDTH  = (GLB_SPLICE_WIDTH ==0) ? Width  : GLB_SPLICE_WIDTH       # Usage of Global Header
Global GLB_SPLICE_HEIGHT = (GLB_SPLICE_HEIGHT==0) ? Height : GLB_SPLICE_HEIGHT
Spline36Resize(GLB_SPLICE_WIDTH,GLB_SPLICE_HEIGHT)
#                                                                                   # Passing Private Dbase to Main DB
DB_TYPESTRING   = "sss1024"                                                         # Field 0 string[256], Field 1 string[256], Field 2 String[1024]
Global GLB_CLIPDBASE=ScriptName+".DB"                                               # Global to make available via main DBase
RT_DBaseAlloc(GLB_CLIPDBASE,1,DB_TYPESTRING)                                        # 1 Record (record 0), 3 Fields
TIM = RT_LocalTimeString(File=False)                                                # What time is it ?
RT_DBaseSet(GLB_CLIPDBASE,0,Chr(7)+"9Blue"+Chr(7)+"-",TIM,FN)                       # Record 0, Fill all three fields
#
Return Last
In current directory we need

GlobalHeader.avs (hold resize stuff)
Code:
Global GLB_SPLICE_WIDTH  = 640
Global GLB_SPLICE_HEIGHT = 480
MakeDemo.avs
Code:
# MakeDEMO.avs

import("DB_AppendFilename.avs")
import("DB_SpliceClips.avs")

OUTAVI          = "DEMO.AVI"
DB              = "DEMO.DB"
DB_TYPESTRING   = "s1024iis1024"                             # 1 String[1024] Filename, 2 Int fields (Start,End frames in final movie)
DB_FILENAMEFIELD= 0
GLOBAL_HEADER   = "GlobalHeader.avs"


DIR_STRING="AVS"

WILDCARD = "*.AVS"                                           # Whatever
LOG_FN   = "MakeDEMO.LOG"
FOURCC   = "ULY0"                                            # We're gonna use UT_Video YV12 rec601 codec

myName="MakeDEMO: "
(Exist(LOG_FN)) ? RT_FileDelete(LOG_FN) : NOP
DLIST=DIR_STRING
RT_DBaseAlloc(DB,0,DB_TYPESTRING)               # Allocate Dbase, 0 Records
DB_AppendFileNamesFromDir(DB,DLIST,Wildcard,DB_FILENAMEFIELD,Log=LOG_FN,Debug=True,Verbose=True)
DB_SpliceClips(DB,OUTAVI,StartFrameField=1,EndFrameField=2,ClipDBField=3,OpenMax=24,Pass1Max=1,
    \ FourCC=FOURCC,Log=LOG_FN,Append=True,Debug=True,Verbose=TRue,Global_Header=GLOBAL_HEADER)

MessageClip(myName+"All Done")
ShowDemo.avs
Code:
# ShowDemo.avs

import("DB_FindTrim.avs")

OUT_FN   = "DEMO.AVI"
G_DB     = "DEMO.DB"

Global  G_PREV_FRAME        = -2                # Force Init
Global  G_CURRENT_TRIM      = -1                # Init for play
Global  G_MOVIETRIM_START   = -1                # Init for play
Global  G_MOVIETRIM_END     = -1                # Init for play
Global  G_FN                = ""                # Init for play
#
Global  G_CDB               = ""                # Client DB filename
#
Global  G_FAV               = ""                # Contents of client DB
Global  G_TIM               = ""
Global  G_FNORG             = ""
#
Avisource(OUT_FN)

ScriptClip("""
    DoInit = (G_PREV_FRAME + 1 != current_frame || current_frame > G_MOVIETRIM_END)
    Global G_CURRENT_TRIM   = (DoInit) ? DB_FindTrim(G_DB,1,2,current_frame) : G_CURRENT_TRIM
    Global G_MOVIETRIM_START= (DoInit) ? RT_DBaseGetField(G_DB,G_CURRENT_TRIM,1) : G_MOVIETRIM_START
    Global G_MOVIETRIM_END  = (DoInit) ? RT_DBaseGetField(G_DB,G_CURRENT_TRIM,2) : G_MOVIETRIM_END
    Global G_FN             = (DoInit) ? RT_DBaseGetField(G_DB,G_CURRENT_TRIM,0) : G_FN
    # Client DB
    Global G_CDB            = (DoInit) ? RT_DBaseGetField(G_DB,G_CURRENT_TRIM,3) : G_CDB                # Name of Client DB
    # Read From Client DB
    Global G_FAV            = (DoInit) ? RT_DBaseGetField(G_CDB,0,0) : G_FAV                            # Fav color
    Global G_TIM            = (DoInit) ? RT_DBaseGetField(G_CDB,0,1) : G_TIM                            # Wazza tyme
    Global G_FNORG          = (DoInit) ? RT_DBaseGetField(G_CDB,0,2) : G_FNORG                          # Original Filename (avi)
    #
    RT_SubTitle("%04d] {%d:%04d} %s\n\nClient DB=%s\n\nMy Favorite Color Is %s\nOpen Time Was %s\nOriginal FileName = %s",
        \ current_frame,G_CURRENT_TRIM,current_frame-G_MOVIETRIM_START,G_FN,
        \ G_CDB,
        \ G_FAV,G_TIM,G_FNORG
        \ )
    Global  G_PREV_FRAME = current_frame                # Remember previous frame visited for next iteration
    return Last
""")

Return Last
Last script shows info particular to the individual (EDIT: original) source clips.
EDIT: See also previous 7 posts (for required scripts and TWriteAVI mod).
EDIT: For the 001.avs type files where they will be all nearly identical, could use Avisynthesizer_Mod in Batch creation mode
to create many nearly identical avs files where only the source file name differs. http://forum.doom9.org/showthread.php?t=166820
From Avisynthesizer_MOD:-
Code:
20 Feb 2014, Added Batch AVS creation mode.
 If template has a repeating section {enclosed in square brackets eg [AviSource("___FILE___")]} then will
 use the standard mode, creating a single file with multiple sources concatenated.
 If template DOES NOT have a repeating section {not enclosed in square backets eg AviSource("___FILE___")}
 then will create multiple AVS files, one for each source 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 ???

Last edited by StainlessS; 31st October 2015 at 20:27. Reason: Update
StainlessS 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 10:22.


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