View Full Version : avisynth crashes when using to many input streams
kaefert
14th July 2014, 13:05
Hi there!
I'm trying to combine a lot of small clips into a more than an hour long video using avisynth. However, after loading around 30 clips avisynth will crash.
The problem is not related to one clip in particular, since a script using the first 25 clips work fine, as well as a script using clips 25 to 50. Only a script using all of those clips will crash.
Is this problem a known one? I couldn't find anything about it by googling. I am a Linux + Wine user but I also dug out a windows machine and tried it there only to see the same problem.
Is there a workaround, did I maybe do something wrong in my script that causes that problem?
Here's my script:
http://pastebin.com/duRX7MHV
the printed errors are inconsistent, sometimes this one:
Avisynth error:
Evaluate: Unrecognized exception!
(playground.avs, line 56)
(playground.avs, line 132)
and sometimes this one:
Avisynth error:
FFVideoSource: Could not open video codec
(script.avs, line 84)
(script.avs, line 207)
raffriff42
14th July 2014, 14:18
Too many video files open at once. If you can you merge them all into a single video (https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files) (EDIT or merge them in groups into several videos, so you have fewer than about 16 files open), you can take as many clip segments (using Trim) as you need.
StainlessS
14th July 2014, 14:57
I think I found that 28 was usually OK, varies a little with source filter. (Imagereader OK for many input pics but probs with all video source filters).
kaefert
14th July 2014, 15:00
thanks for the reply!
But concatenating those files (and duplicating the space they fill) and then spliting them again with trim (where I first have to look and note the number of frames in each of those videos seems to be a lot of effort to me...
I wish there was an easier way around this problem..
StainlessS
14th July 2014, 15:16
I dont know of any work arounds, think its a system resources problem rather than Avisynth source filter problem.
For future stuff, Avisynthesizer_MOD might help http://forum.doom9.org/showthread.php?p=1608041#post1608041
similar thread to yours
http://forum.doom9.org/showthread.php?p=1682093&highlight=avisynthesizer_mod#post1682093
fvisagie
15th July 2014, 08:44
It seems to be a memory usage issue brought about by the memory consumed by each additional media file filter instance. On my machine this would occur once the Avisynth host process reaches around 1,666MB memory usage. According to other posts on this forum one might expect Avisynth failures from around that point, the theoretical limit for 32-bit processes being 2GB.
In addition to varying the number of input files, you could also consider varying other parameters, e.g. changing the number of threads per media file filter instance if it supports it, looking for another media file filter that uses less memory and if necessary transcoding to that, etc. If you aren't yet working with lossless intermediate files the latter might be an opportunity to kill two birds with one stone.
Groucho2004
15th July 2014, 09:26
If you're on a 64 Bit OS there are a couple of things you could try:
1. Go all 64 Bit (AVS+ x64, FFMS x64), should work fine with the simple script you have.
2. If you are using an encoder like x264, pipe your script via stdout into the encoder. Avisynth (32 Bit) can allocate up to 4GB in this scenario.
fvisagie
15th July 2014, 09:46
If you are using an encoder like x264, pipe your script via stdout into the encoder. Avisynth can allocate up to 4GB in this scenario.
That's very interesting. Is that dependent on the 64-bit OS? What host application would you suggest for piping out Avisynth?
Groucho2004
15th July 2014, 10:15
That's very interesting. Is that dependent on the 64-bit OS? What host application would you suggest for piping out Avisynth?
In order to get 4 GB address space for 32 Bit Avisynth, you'll need a 64 Bit OS and a pipe tool that is "large address aware", like this one (https://www.dropbox.com/s/2y4nflazvuh24vu/avs2yuv.zip).
The command line for x264 would look something like this:
avs2yuv "video.avs" -o - | "x264_64.exe" - --preset slow --crf 16 --frames 147701 --output "video.264" --demuxer y4m
fvisagie
15th July 2014, 12:29
Thanks.
kaefert
15th July 2014, 12:37
avs2yuv "video.avs" -o - | "x264_64.exe" - --preset slow --crf 16 --frames 147701 --output "video.264" --demuxer y4m
well the problem with that strategy is that you loose the sound.. :(
and the 64bit stuff does not seem to work with wine. I'm also thinking about taking a look at avxsynth maybe that can handle more files.
fvisagie
15th July 2014, 13:06
well the problem with that strategy is that you loose the sound.. :(
ffmpeg includes x264 and also provides encoding of and muxing with sound. And it just occurred to me that it also supports piped media input.
kaefert
15th July 2014, 13:08
ffmpeg includes x264 and also provides encoding of and muxing with sound. And it just occurred to me that it also supports piped media input.
Yes, I know it does. but avs2yuv will only forward the video stream, no audio.
Groucho2004
15th July 2014, 13:19
Yes, I know it does. but avs2yuv will only forward the video stream, no audio.
I think there is a pipe tool that does both but I can't remember which one. Something like avs2pipe.
kaefert
15th July 2014, 13:29
I think there is a pipe tool that does both but I can't remember which one. Something like avs2pipe.
yes, avs2pipe has support for both video and audio, but it seems to me as it can only do one at a time. so no simple piping into ffmpeg with x264 support to get a finished file in one go.
http://forum.doom9.org/showthread.php?t=160383
kaefert
17th July 2014, 10:59
Okey. So on my Windows 8.1. box I've tried Avisynth 64bit - first Avisynth+ 64bit (http://avs-plus.net/) and then SEt's Avisynth 2.5.8 MT compiled for *X86_64 (http://forum.doom9.org/showthread.php?t=152800). Both will not crash but just hang before even writing the first frame.
They open up 224 ffms2 threads (I'm counting 121 video files in my script) and than fully occupy one cpu-core and run forever without reading from disk or anything.
this is the call stack of x264-r2431-ac76440.exe -->
ntdll.dll!RtlEnterCriticalSection+0x13
ffms2-x64.dll!FFMS_ResetPP+0x4780
ffms2-x64.dll!FFMS_GetSourceTypeI+0xa735
ffms2-x64.dll!FFMS_GetSourceTypeI+0xa58a
ffms2-x64.dll!FFMS_GetSourceTypeI+0x85ed
ffms2-x64.dll!FFMS_GetSourceTypeI+0x8f74
ffms2-x64.dll!FFMS_ReadIndex+0x6f
ffms2-x64.dll+0x1d2f
avisynth.DLL!CreateScriptEnvironment2+0x1620
avisynth.DLL!DllGetClassObject+0x693d
avisynth.DLL!DllGetClassObject+0x7680
avisynth.DLL!DllGetClassObject+0x6c2c
avisynth.DLL!DllGetClassObject+0x7365
avisynth.DLL!DllGetClassObject+0x792d
avisynth.DLL!DllGetClassObject+0x814f
avisynth.DLL!DllGetClassObject+0x811c
avisynth.DLL!DllGetClassObject+0x809f
avisynth.DLL!DllGetClassObject+0xdecc
avisynth.DLL!CreateScriptEnvironment2+0x1620
avisynth.DLL!DllGetClassObject+0x693d
avisynth.DLL!DllGetClassObject+0x7680
avisynth.DLL!DllGetClassObject+0x68c5
avisynth.DLL!DllGetClassObject+0x7680
avisynth.DLL!DllGetClassObject+0x6c2c
avisynth.DLL!DllGetClassObject+0x7365
avisynth.DLL!DllGetClassObject+0x792d
avisynth.DLL!DllGetClassObject+0x811c
avisynth.DLL!DllGetClassObject+0x814f
avisynth.DLL!DllGetClassObject+0x811c
avisynth.DLL!DllGetClassObject+0x814f
avisynth.DLL!DllGetClassObject+0x811c
avisynth.DLL!DllGetClassObject+0x809f
avisynth.DLL!DllGetClassObject+0x88aa
avisynth.DLL!CreateScriptEnvironment2+0x1620
avisynth.DLL!CreateScriptEnvironment2+0x10ac
avisynth.DLL!DllGetClassObject+0x8f71
avisynth.DLL!CreateScriptEnvironment2+0x1620
avisynth.DLL!CreateScriptEnvironment2+0x10ac
avisynth.DLL!avs_invoke+0x6e
x264-r2431-ac76440.exe+0x100d3
x264-r2431-ac76440.exe+0x5b3ba4
x264-r2431-ac76440.exe+0x13b5
x264-r2431-ac76440.exe+0x14e8
KERNEL32.DLL!BaseThreadInitThunk+0xd
ntdll.dll!RtlUserThreadStart+0x1d
and this of one of the ffms2-x64.dll threads (all that I've looked at look very much the same)
ntdll.dll!NtWaitForAlertByThreadId+0xa
ntdll.dll!RtlSleepConditionVariableCS+0xbe
KERNELBASE.dll!SleepConditionVariableCS+0x28
ffms2-x64.dll!FFMS_ResetPP+0x66f7b
ffms2-x64.dll!FFMS_ResetPP+0x65c5f
ffms2-x64.dll!FFMS_ResetPP+0x15ce1f
ffms2-x64.dll!FFMS_ResetPP+0x15ceb3
KERNEL32.DLL!BaseThreadInitThunk+0xd
ntdll.dll!RtlUserThreadStart+0x1d
When I encode a shorter script with this it works, but the encoder produces artefacts after complaining about this warning: http://doom10.org/index.php?topic=278.0
On Linux with avxsynth I'm currently hanging at this problem:
https://github.com/avxsynth/avxsynth/issues/106
Groucho2004
17th July 2014, 11:58
Okey. So on my Windows 8.1. box I've tried Avisynth 64bit - first Avisynth+ 64bit (http://avs-plus.net/) and then SEt's Avisynth 2.5.8 MT compiled for *X86_64 (http://forum.doom9.org/showthread.php?t=152800). Both will not crash but just hang before even writing the first frame.
They open up 224 ffms2 threads (I'm counting 121 video files in my script) and than fully occupy one cpu-core and run forever without reading from disk or anything.
Don't use the old 2.5.8 64 Bit Avisynth, use AVS+.
Things to try if you are not yet fed up:
1. LWLibavVideoSource (http://forum.doom9.org/showthread.php?p=1685943#post1685943) should work with mov and has a 64 bit source filter.
2. Add "threads = 1" to the source filter calls so they won't spawn so many threads
3. Run the script through AVSMeter (http://forum.doom9.org/showthread.php?t=165528) (x64) to exclude the encoder from testing
kaefert
17th July 2014, 15:52
I've been fed up with this problem a long time ago, but this is for my girlfrind and you know how they start nagging if they don't get what they want ;)
So thanks for those hints I'm gonna try that tonight
kaefert
18th July 2014, 07:36
Okey so yesterday evening (and through the night till today in the morning) I got avxsynth (the linux port) which I self-compiled on a Linux Mint 17 64bit machine to render the whole 121 video files containing script minus the pictures since the function "ImageSource" seems to be missing in avxsynth. Does sombody maybe know of an alternative way to get pictures into avisynth (without using another program as an extra step to convert them to video clips outside of avxsynth, I know that that could be done but I'd prefer it to do all in one go without having to have intermediate steps)
StainlessS
18th July 2014, 12:10
Take a peek at this: http://forum.doom9.org/showthread.php?t=135928
Perhaps an Avxsynth version.
Also, perhaps you omitted to search for ImageReader, update to ImageSource.
EDIT: Does avxsynth use the same CPP interface as Avisynth ?
I have ripped out source for ImageReader that could be compiled as standalone plug in Avisynth.
(Had a problem with an image and ripped out, added debug messages to find the reason).
Groucho2004
18th July 2014, 12:28
I have ripped out source for ImageReader that could be compiled as standalone plug in Avisynth.
(Had a problem with an image and ripped out, added debug messages to find the reason).
Standalone? Did you link the DevIL library statically?
StainlessS
18th July 2014, 12:53
Dont think so, was a long time ago that I did it.
Just had a look, i've included il.h and have the devil.Lib in same directory as source, and Devil.lib in Settings/Link/Object Library Modules.
StainlessS
18th July 2014, 13:03
Here it is with all compiler project files for vs6 and (I think) VS TK2003.
http://www.mediafire.com/download/app8ar5fa0zcoh7/ImageSeq2.zip
Will be available for a few weeks, then deleted.
Groucho2004
18th July 2014, 13:15
Just had a look, i've included il.h and have the devil.Lib in same directory as source, and Devil.lib in Settings/Link/Object Library Modules.
You still need devil.dll, so it's not exactly a standalone filter.
StainlessS
18th July 2014, 13:17
Yep, had not initially realized that Devil lib was required, nor that source is not included.
kaefert
19th July 2014, 15:31
Okey, since I couldn't find anything on how to compile and/or use plugins with avxsynth other than those that are already included like ffms2 I'm back to trying to make this work with the windows 64bit version of avisynth.
So this is what I see when I run my script with 100+ input files with AVSMeter 64bit:
C:\Users\Name\Desktop\avisynth>AVSMeter179\AVSMeter179\AVS2.6_x64\AVSMeter.exe myscript.avs
AVSMeter 1.7.9 (AVS 2.6, x64) by Groucho2004
AviSynth+ 0.1 (r1576, x64)
Analysing script, please wait...
And it just keeps hanging there forever and eats up one cpu core just as the x264 encoder did.
Now that other hint, replacing ffms2 with LWLibavVideoSource (http://forum.doom9.org/showthread.php?p=1685943#post1685943) did the trick! Now I can preview the script with MPC 64bit player and I can render it with ffmpeg. I can work with that. Only thing thats missing for my total happiness is a way to do this on linux, either through wine or with avxysnth. But I can't get avisynth 64bit working with wine and avxsynth is missing a way to load pictures as input-clips.
raffriff42
19th July 2014, 16:26
...If you can you merge them all into a single video (https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files) (EDIT or merge them in groups into several videos, so you have fewer than about 16 files open), you can take as many clip segments (using Trim) as you need.
...concatenating those files (and duplicating the space they fill) and then spliting them again with trim (where I first have to look and note the number of frames in each of those videos seems to be a lot of effort to me...
I wish there was an easier way around this problem..
Okey, since I couldn't find anything on how to compile and/or use plugins with avxsynth other than those that are already included like ffms2 I'm back to trying to make this work with the windows 64bit version of avisynth...
...Doesn't seem like your way is easier after all. You could have been done by now :devil:
BTW I thought of a simple way to preserve your original frame numbers (to help in updating your edit points): do all your editing with human-readable frame numbers in an added top border, and crop the border away for your final video.
## test/proof of concept
C=DirectShowSource("uu~master2 vr22.00.mov")
B=BlankClip(C, length=0).AddBorders(0, 32, 0, 0) ## inter-clip separator; length=0 to disable
C.addframeno("00")++B++\
DirectShowSource("uu~master2 vr22.01.mov").addframeno("01")++B++\
DirectShowSource("uu~master2 vr22.02.mov").addframeno("02")++B++\
DirectShowSource("uu~master2 vr22.03.mov").addframeno("03")++B++\
DirectShowSource("uu~master2 vr22.04.mov").addframeno("04")++B++\
DirectShowSource("uu~master2 vr22.05.mov").addframeno("05")++B++\
DirectShowSource("uu~master2 vr22.06.mov").addframeno("06")++B++\
DirectShowSource("uu~master2 vr22.07.mov").addframeno("07")++B++\
DirectShowSource("uu~master2 vr22.08.mov").addframeno("08")++B++\
DirectShowSource("uu~master2 vr22.09.mov").addframeno("09")
return Last
##################################
function addframeno(clip C, string ID)
{
return C.AddBorders(0, 32, 0, 0)
\ .ShowFrameNumber(x=16, y=16, size=16)
\ .Subtitle(ID, align=9)
}
kaefert
19th July 2014, 17:34
...Doesn't seem like your way is easier after all. You could have been done by now :devil:
Well yes, for getting this one result it probably would have been easier doing it your way, but if I can make this work well my girlfriend will write scripts like that more often instead of clicking many such small clips into one with pinnacle. and for such a "long term solution" you're workaround would have been too annoying to repeat it the same way more than once.
StainlessS
19th July 2014, 19:40
Perhaps, just perhaps, you could take a look at RT_Stats together with GScript and TWriteAVI.
GScript has for/next loops and if/else constructs.
TWriteAvi can output a clip to a file.
RT_Stats, has many functions, to eg get a list of files from a directory together with a wildcard.
It also has both Array and DataBase functionality.
Given say a list of paths, you could have a small script that creates a database of filenames, gathered up from the given paths,
and result is a DB list of all files required to be joined. End of stage one.
Script 2:
Scan though the DB list of filenames, pull in the clips in batches of 20 or so, join them together and output to an accumulator directory.
Perhaps a third script to join those accumulated together files together, in batches of 20 or so.
Or maybe, join eg twenty clips together and output. Read in the output clip, and join 19 clips to it, output again and repeat.
It might take a bit of further thought if individual groups needed individual editing, but that should not be an impossible problem to solve.
(eg each source directory could contain a script [or coded instruction] that could be read in with RT_Stats, and some kind of editing done based on it).
I'll knock up demo script to show what I mean, it will not do anything fancy, just pull in clips and join them together and output, then repeat.
EDIT: TWriteAVI from this post: http://forum.doom9.org/showthread.php?p=1687617#post1687617
RT_Stats here: http://forum.doom9.org/showthread.php?t=165479
GScript: http://forum.doom9.org/showthread.php?t=147846
You will want a decent lossless compressor, perhaps UT Video, videoHelp should have it.
EDIT: TWiteAVI includes source, but no doc, so here
Function TWriteAvi(clip c,String "fname"="",bool "overwrite"=false,bool "showall"=false,string "idxname"="",string "fourcc"="")
Fname: default "" = Not Set. Filename, NOT optional.
Overwrite: Fails on existing unless overwrite==True.
Showall: Default false. Shows all codecs, not just ones supporting your clip colorspace.
Idxname: default "". Name of index file for RemapFrames.
Fourcc: Default "". Characters UPPER case fourCC code for codec, eg ULY0 for YV12 UT_Video rec601.
Writes clip to filename returning original clip.
StainlessS
20th July 2014, 01:29
See previous post.
OK, here four scripts to get you on your way, I have not done it all for you, did not want you to feel guilty :)
Joins 1000 x 20 frame clips together into a single movie.
Test Clip creator (so you can give it a go)
# 1_MakeTestClips.avs
# Requires 5 empty directories in current Directory. DIR0, DIR1, DIR2, DIR3, DIR4
mpeg2source("D:\vob\xmen2.d2v")
# 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
GSCript("""
myName="MakeTestClips: "
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")
for(j=0,o.FrameCount-1) {
RT_YankChain(o,n=j) # Forcibly write each frame
}
o = 0 # Close clip and call clip Destructor, Not Necessary
}
""")
MessageClip(myName+"All Done")
Make a DBase of filenames (Very quick, ~ 1 sec)
# 2_MakeDB.avs
# Make DataBase of Fullpath clip filenames given a file or string containing directories.
# Fills in ONLY the FileName in field 0
DB = "Movie.DB"
DB_TYPESTRING = "s1024ii" # 1 String[1024] Filename, 2 Int fields (Start,End frames in final movie)
# Directory names in text file
DIR_LIST_FILE = "MyDirList.Txt"
#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")
GET_DIRS_FROM_FILE=FALSE # we are gonna use a string instead
WILDCARD = "*.AVI|DIVX|XDIV|MKV|MPG|MOV|MP4|M4V|WMV" # Whatever
LOG_FN = "MakeDB.LOG"
##################
TMPLIST = "~MOVIE_LIST_"+RT_LocalTimeString()+".TXT"
GSCript("""
myName="MakeDB: "
(Exist(LOG_FN)) ? RT_FileDelete(LOG_FN) : NOP
if(GET_DIRS_FROM_FILE) {
Assert(Exist(DIR_LIST_FILE),myName+DIR_LIST_FILE+" Does not Exist")
DLIST=RT_ReadTxtFromFile(DIR_LIST_FILE) # Get list of files
} Else { DLIST=DIR_STRING }
RT_DBaseAlloc(DB,0,DB_TYPESTRING) # Allocate Dbase, 0 Records
NDIRS=RT_TxtQueryLines(DLIST) # Query Number of lines in String ie number of Directories.
Assert(NDIRS>0, myName+"No Directories found in list")
for(D=0,NDIRS-1) {
DN=RT_TxtGetLine(DLIST,D) # Directory name
DN=RT_FilenameSplit(DN) # convert to full path name (why not, also convert / to \ )
if(RightStr(DN,1)=="\") {
DN=LeftStr(DN,Strlen(DN)-1) # strip any trailing slash else Exist fails
}
Assert(Exist(DN),myName+DN+" Does not Exist")
DN=DN + "\" # Append Backslash
S=DN+WILDCARD
RT_DebugF("Searching for movies in %s",S,name=myName) # to DebugView
NMOVS=RT_WriteFileList(S,TMPLIST) # Create a listing movie files
Assert(NMOVS>0, myName+"No Movies found in "+DN)
MLIST=RT_ReadTxtFromFile(TMPLIST) # Get list of files
for(M=0,NMOVS-1) {
MN=RT_TxtGetLine(MLIST,M) # Movie name
RT_DebugF("%d:%d] DBase Append %s",D,M,MN,name=myName)
RT_DBaseAppend(DB,MN,0,0) # Set Only Field 0, the filename (S & E frames = 0)
RT_TxtWriteFile(RT_String("%d:%d ] ",D,M)+MN,LOG_FN,Append=True)
}
}
RT_FileDelete(TMPLIST)
""")
MessageClip(myName+"All Done")
Join Clips Together
# 3_JoinClips-v2.avs
# Join clips given a DB file containing filenames.
DB = "Movie.DB"
OUT_FN = "MOVIE.AVI"
LOG_FN = "JOINCLIPS.LOG"
JOINMAX = 20 # maximum num of clips to join at once
GSCript("""
myName="JoinClips-v2: "
Assert(Exist(DB),myName+"DBase does not exist")
(Exist(LOG_FN)) ? RT_FileDelete(LOG_FN) : NOP
FRAME = 0 PASS = 0 NMOVS = RT_DBaseRecords(DB)
START=RT_TimerHP()
While (NMOVS > 0) {
if(NMOVS <= JOINMAX) {
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,NMOVS-1) {
FN=RT_DBaseGetField(DB,in_i,0) # Field 0 was Filename string in original DB
if(PASS==0) {
# Here insert extra hack code for whatever reason, source not necessarily AVI (add additional source filters based on Extension)
# Here we just set clip start and end frames relative to final complete movie (In The Original DB ONLY, temp DB's only have 1 Field).
Ext=RT_GetFileExtension(FN)
if(Ext==".AVI") { in_c = AviSource(FN) } # Whatever, Select source filter based on Extensions
Else { in_c = DirectShowSource(FN) }
Len = in_c.FrameCount
S=RT_String("%d ] Processing Len=%d I/P Clip %s",in_i,Len,FN)
RT_DebugF("%s",S,name=myName)
RT_TxtWriteFile(S,LOG_FN,Append=True)
RT_DBaseSetField(DB,in_i,1,FRAME) # set Start Frame of clip for whatever reason
FRAME = FRAME+Len
RT_DBaseSetField(DB,in_i,2,FRAME-1) # set End Frame of clip for whatever reason
} Else {
in_c = AviSource(FN) # Always AVI
Len = in_c.FrameCount
S=RT_String("%d:%d ] Len=%d Aggregate Clip %s",PASS,in_i,Len,FN)
RT_DebugF("%s",S,name=myName)
RT_TxtWriteFile(S,LOG_FN,Append=True)
}
ACC = (ACC.IsClip()) ? ACC ++ in_c : in_c
JOINED = JOINED + 1
if(JOINED>=JOINMAX || in_i==NMOVS-1) { # limit or last input clip ?
if(ODB=="") {
OFN = OUT_FN # 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="ULY0")
S=RT_String("%d:%d ] WRITING Aggregate Clip %s",PASS,OCNT,OFN)
RT_DebugF("%s",S,name=myName)
RT_TxtWriteFile(S,LOG_FN,Append=True)
for(yank_i = 0, out_c.FrameCount-1) {
RT_YankChain(out_c,n=yank_i) # Forcibly write each frame
}
ACC = 0 in_c = 0 out_c = 0 # MAKE SURE each clip closed and destructor called
JOINED = 0
}
}
if(PASS != 0 ) {
for(deli=0,NMOVS-1) {RT_FileDelete(RT_DBaseGetField(DB,deli,0))} # Delete temp aggregate files (DONT DEL ORIGINAL INPUT FILES)
RT_FileDelete(DB) # Delete aggregate i/p DB
}
PASS = PASS + 1
DB=ODB # Next I/P is OLD O/P
NMOVS = (DB=="") ? 0 : RT_DBaseRecords(DB) # Last Pass ?
}
T=RT_TimerHP() - START
S=RT_String("%s Time = %f secs (%.2f mins)",myName,T,T/60.0)
RT_DebugF("%s",S,name=myName)
RT_TxtWriteFile(S,LOG_FN,Append=True)
""")
MessageClip(myName+"All Done")
Just to check DBase is as expected
# 4_ShowMovieDB.avs
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)
}
for(i=0,Records-1) {
RT_DebugF("%d ] -------------------",i)
for(j=0,fields-1) {
RT_DebugF("\t%d:%d ]\t%s",i,j,String(RT_DBaseGetField(DB,i,j)))
}
}
""")
MessageClip(myName+"All Done")
The clip joiner is not very clever, joins together 20 clips, loads the save clip and adds 19 more and repeats, so eg the 1st 20 clips
saved and resaved many times. Something for you to improve upon.
Also, you could eg read in some kind of command file, with commands on how to process a directory, save to the DB or whatever,
theres lots you could do.
EDIT: JoinClips sped up
EDIT:
Function to find original clip number, given the total combined movie frame number and JoinClips DB.
Call with S_Field=1 and E_Field=2, (as that is where we stored the offsets in the DB during JoinClip).
Other stuff could likewise be stored in DB, and clip number (record number) located and data extracted.
Here: Post where FindTrim was originally implemented:- http://forum.doom9.org/showthread.php?p=1682078#post1682078
EDIT: Added complete script to show Movie frame number, Original Trim/Clip Index and Clip frame number, and Original Clip name
(1000 original clips). Can jump about on timeline, plays in real time.
#5_ShowMovie.avs
#5_ShowMovie.avs
OUT_FN = "MOVIE.AVI"
G_DB = "Movie.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
Avisource(OUT_FN)
ScriptClip("""
DoInit = (G_PREV_FRAME + 1 != current_frame || current_frame > G_MOVIETRIM_END)
Global G_CURRENT_TRIM = (DoInit) ? 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
RT_SubTitle("%d] {%d:%04d} %s",current_frame,G_CURRENT_TRIM,current_frame-G_MOVIETRIM_START,G_FN)
Global G_PREV_FRAME = current_frame # Remember previous frame visited for next iteration
return Last
""")
Return Last
Function FindTrim(String DB,Int S_Field,Int E_Field,Int Frame) {
# DB Find Trim (record) containing movie frame Frame, S_Field = MovieStartFrame, E_Field = MovieEndFrame (Binary Search)
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
}
StainlessS
20th July 2014, 13:32
Well I guess I should have read your script before posting above, but it might though come in handy as examples for changing the below stuff.
I have now read your script and come up with I think a practical solution.
You need to make a few small changes to your script.
Move initial section of script including LoadPlugins, Global Variables, and Functions to new sciript "HeaderScript.avs".
Add "Global VIDEO_OPEN_COUNT = 0" to globals section.
Use this line in functions that open a VIDEO clip, ""Global VIDEO_OPEN_COUNT = VIDEO_OPEN_COUNT + 1"
The Remainder of scipt should have above stuff removed, I've named it "Keafert.avs".
Add to 1st line of Kaefert.avs 'Import("HeaderScript.avs")'.
You can now use above scripts as you would normally
"1_Evaluator.avs"
Will scan Kaefert.avs, and break it up into text strings, adding them one by one to an accumulator string.
When it comes across a string consisting only of white space (eg empty line), or whose first non white space character is hash '#',
then it adds that line to the accumulator and does an EVAL on accumulated string (processing whatever code that section had)
If at this point (VIDEO_OPEN_COUNT > CLIPMAX) then will write clip SUM (as used in your scripts) to a temp file in OUTDIR directory
and will add its name to a DBase, not all of the clip will be written, will keep last few frames for use in your Dissolve [Arrrrrhhhh!!!!].
Will then close all clips except the end Dissolve frames clip, an re-initialize VIDEO_OPEN_COUNT to 1 (still 1 open).
Will repeat above steps until all of script is processed and will finalize any end bits (not yet written) before closure.
I have not tested the below scripts in real situation, I dont have your clips (but tested with DO_EVAL set to FALSE which just outputs
logging for perusal).
NOTE, The 1_Evaluator.avs needs either blank lines or lines starting with a comment so that it can reliably break up the script into EvalAble
chunks, you may need to add in blank lines where there are groups of consecutive non-white lines, so that you dont go over maximum open clip count.
here tis,
1_Evaluator.avs
# 1_Evaluator.avs"
INSCRIPT = "Kaefert.AVS" # As your sample script without loadplugins and functions.
# Import the header (ie loadplugins and functions script) into INSCRIPT
# Add to Header script Global VIDEO_OPEN_COUNT = 0 and increment on each video clip load
OUTDIR = "OUT" # Must Exist (no trailing backslash)
DB = "Evaluator.DB"
LOG = "Evaluator.LOG"
CLIPMAX = 20 # Max clips to do at once
ENDFRAMES = 250 # Because of Dissolve (frames to keep for dissolve with next bunch)
DO_EVAL = False # we dont have your clips
GScript("""
SUM = 0 # Will beocome clip
myName="Evaluator: "
Assert(Exist(OUTDIR),myName+OUTDIR+" Does not Exist")
Assert(Exist(INSCRIPT),myName+INSCRIPT+" Does not Exist")
Exist(LOG) ? RT_FileDelete(LOG) : NOP
RT_DBaseAlloc(DB,0,"s1024ii") # Allocate Dbase, 0 Records
SCRIPT=RT_ReadTxtFromFile(INSCRIPT)
NLINES = RT_TxtQueryLines(SCRIPT) # Number of lines in script
HASH=RT_Ord("#") TAB=9 SPC=32
Global VIDEO_OPEN_COUNT = 0 # Just to make sure
EVS = ""
CLIPNO = 0
for(line=0, NLINES-1) {
S = RT_TxtGetLine(SCRIPT,line) # get single line
EVS = RT_TxtAddStr(EVS,S) # Add to accumulated eval string of text
Len = Strlen(S)
# Look for a 'Break Point' in script, Blank Lines or first non white char is hash (comment)
if(Len==0 || line==NLINES-1) { Term=True }
Else {
for(i=1,Len) {
ord = RT_Ord(S,i)
if(ord != SPC && ord != TAB) {
i=len # Break
}
}
Term=(ord==SPC||ord==TAB||ord==HASH)
}
if(Term) {
LS=RT_String(":::::::::: Processing Script FragmMent:\n%s",EVS)
RT_TxtWriteFile(LS,LOG,Append=True)
if(DO_EVAL) {
Eval(EVS)
}
EVS="" # Clear Accumulator string
LS=RT_String(":::::::::: Number Of Clips Currently Open=%d",VIDEO_OPEN_COUNT)
RT_TxtWriteFile(LS,LOG,Append=True)
if(VIDEO_OPEN_COUNT >= CLIPMAX) {
MN=RT_String("%s\\TEMP_%06d.AVI",OUTDIR,CLIPNO)
LS=RT_String(":::::::::: Writing AVI %s",MN)
RT_TxtWriteFile(LS,LOG,Append=True)
RT_DBaseAppend(DB,MN) # Add Filename to DBase
writec=SUM.Trim(0,SUM.FrameCount-1-ENDFRAMES) # Clip to write
keepc =SUM.Trim(SUM.FrameCount-ENDFRAMES,0) # Clip to delay write because of Dissolve (Arrrrrrrrrrhhhh!!!!!)
o=TWriteAVI(writec,MN,True,True,FourCC="ULY0")
for(i=0,o.FrameCount-1) {
RT_YankChain(o,n=i) # Forcibly write each frame
}
SUM = keepc
writec = 0 # Destroy clips (and source filter instances)
o = 0
keepc = 0
CLIPNO = CLIPNO + 1 # We did one more
Global VIDEO_OPEN_COUNT = 1 # Not 0, We kept a bit of the file because of Dissolve (Arrrrrrrrrrhhhh!!!!!)
}
}
}
# Now do leftovers
if(EVS != "") {
LS=RT_String(":::::::::: Processing FINAL Script FragmMent:\n%s",EVS)
RT_TxtWriteFile(LS,LOG,Append=True)
if( DO_EVAL) {
Eval(EVS)
}
}
LS=RT_String(":::::::::: FINAL Number Of Clips Open=%d",VIDEO_OPEN_COUNT)
if(VIDEO_OPEN_COUNT > 0) {
MN=RT_String("%s\\TEMP_%06d.AVI",OUTDIR,CLIPNO)
LS=RT_String(":::::::::: Writing FINAL AVI %s",MN)
RT_TxtWriteFile(LS,LOG,Append=True)
RT_DBaseAppend(DB,MN) # Add Filename to DBase
o=TWriteAVI(SUM,MN,True,True,FourCC="ULY0")
for(i=0,o.FrameCount-1) {
RT_YankChain(o,n=i) # Forcibly write each frame
}
}
""")
MessageClip(myName+"All Done")
and script to join all results
2_EvalJoinClips.avs
# 2_EvalJoinClips.avs
# Join clips given a DB file containing filenames.
DB = "Evaluator.DB"
OUT_FN = "Movie.AVI"
LOG_FN = "JOINCLIPS.LOG"
JOINMAX = 20
GSCript("""
myName="EvalJoinClips: "
Assert(Exist(DB),myName+"DBase does not exist")
(Exist(LOG_FN)) ? RT_FileDelete(LOG_FN) : NOP
FRAME = 0 PASS = 0 NMOVS = RT_DBaseRecords(DB)
START=RT_TimerHP()
S=RT_String("Joining %d clips",NMOVS)
RT_DebugF("%s",S)
RT_TxtWriteFile(S,LOG_FN,Append=True)
While (NMOVS > 0) {
if(NMOVS <= JOINMAX) {
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,NMOVS-1) {
FN=RT_DBaseGetField(DB,in_i,0) # Field 0 was Filename string in original DB
if(PASS==0) {
# Here insert extra hack code for whatever reason, source not necessarily AVI (add additional source filters based on Extension)
# Here we just set clip start and end frames relative to final complete movie (In The Original DB ONLY, temp DB's only have 1 Field).
Ext=RT_GetFileExtension(FN)
if(Ext==".AVI") { in_c = AviSource(FN) } # Whatever, Select source filter based on Extensions
Else { in_c = DirectShowSource(FN) }
Len = in_c.FrameCount
S=RT_String("%d ] Processing Len=%d I/P Clip %s",in_i,Len,FN)
RT_DebugF("%s",S,name=myName)
RT_TxtWriteFile(S,LOG_FN,Append=True)
RT_DBaseSetField(DB,in_i,1,FRAME) # set Start Frame of clip for whatever reason
FRAME = FRAME+Len
RT_DBaseSetField(DB,in_i,2,FRAME-1) # set End Frame of clip for whatever reason
} Else {
in_c = AviSource(FN) # Always AVI
Len = in_c.FrameCount
S=RT_String("%d:%d ] Len=%d Aggregate Clip %s",PASS,in_i,Len,FN)
RT_DebugF("%s",S,name=myName)
RT_TxtWriteFile(S,LOG_FN,Append=True)
}
ACC = (ACC.IsClip()) ? ACC ++ in_c : in_c
JOINED = JOINED + 1
if(JOINED>=JOINMAX || in_i==NMOVS-1) { # limit or last input clip ?
if(ODB=="") {
OFN = OUT_FN # 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="ULY0")
S=RT_String("%d:%d ] WRITING Aggregate Clip %s",PASS,OCNT,OFN)
RT_DebugF("%s",S,name=myName)
RT_TxtWriteFile(S,LOG_FN,Append=True)
for(yank_i = 0, out_c.FrameCount-1) {
RT_YankChain(out_c,n=yank_i) # Forcibly write each frame
}
ACC = 0 in_c = 0 out_c = 0 # MAKE SURE each clip closed and destructor called
JOINED = 0
}
}
if(PASS != 0 ) {
for(deli=0,NMOVS-1) {RT_FileDelete(RT_DBaseGetField(DB,deli,0))} # Delete temp aggregate files (DONT DEL ORIGINAL INPUT FILES)
RT_FileDelete(DB) # Delete aggregate i/p DB
}
PASS = PASS + 1
DB=ODB # Next I/P is OLD O/P
NMOVS = (DB=="") ? 0 : RT_DBaseRecords(DB) # Last Pass ?
}
T=RT_TimerHP() - START
S=RT_String("%s Time = %f secs (%.2f mins)",myName,T,T/60.0)
RT_DebugF("%s",S,name=myName)
RT_TxtWriteFile(S,LOG_FN,Append=True)
""")
MessageClip(myName+"All Done")
and script to view dbase
3_EvalShowDB.avs
# 3_EvalShowDB.avs
TYPENAMES=RT_String("Bool\nInt\nFloat\nString\nBin\n")
DB="Evaluator.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)
}
for(i=0,Records-1) {
RT_DebugF("%d ] -------------------",i)
for(j=0,fields-1) {
RT_DebugF("\t%d:%d ]\t%s",i,j,String(RT_DBaseGetField(DB,i,j)))
}
}
""")
MessageClip(myName+"All Done")
I cant be sure that it will work flawlessly as I not been able to test it. Good luck.
kaefert
20th July 2014, 13:51
StainlessS you're incredible ;) but seriously before doing such complex scripting I think just using 64bit avisynth on windows together with that L-SMASH Works source plugin much more sensible than such complex workarounds...
StainlessS
20th July 2014, 14:07
Well if you can get that working OK then great.
Give the above a try though, I'de quite like to know if it works.
EDIT: May be only practical solution for 32 bit users (I have 64bit m/c but XP32).
kaefert
20th July 2014, 14:09
Well if you can get that working OK then great.
Well that was what my post from yesterday 16:31 said ;)
Only thing I'm still missing is a way to do this without a windows machine (wine/avxsynth), but I don't plan on investing THAT MUCH work on that problem, sorry..
StainlessS
22nd July 2014, 18:04
Scripts in post #30 and #31 updated.
Post #30 Joinclips, originally would take 2.5 hours to join 1000 20 frame clips (13.5 mins PAL SD),
modded Joinclips does it in about 21 (EDIT: More like 19) mins and is not likely to get much faster than that (unless TWriteAVI could be persuaded to DirectStreamCopy, acting as both source and dest, unlikely). (Maximum open clips at once set to 20, Core Duo on 1 core, Sata 2)
@kaefert, I know your done, but others may find use for abilty to join 1000+ files (or even 20+ come to that).
Needs TWriteAVI update from here: http://forum.doom9.org/showthread.php?p=1687617#post1687617
Old version was broken.
EDIT: FindTrim() Function added to post #30.
StainlessS
22nd July 2014, 20:03
Changed FindTrim function added to post #30 a complete script to show,
Complete movie frame number, Original Trim/Clip Index and Trim/Clip frame number, and Original Trim/Clip name (1000 original clips) .
Can jump about on timeline, plays in real time.
fvisagie
24th July 2014, 12:24
This is a magnum opus, StainlessS! :)
Trying to understand how you implemented it, the iterative divide-by-JOINMAX processing caught my eye. I realise you did this to avoid Avisynth's limited number of concurrently open clips, but it does bring about the unwanted consequence of repeated processing. Whenever the number of input files exceeds JOINMAX, video material will be repeatedly processed. In that scenario, multiple output/intermediate files are created, which will again need to be processed for combining (and perhaps again and again...). For a large number of input files this significantly adds to total processing time, compared to the ideal of processing content only once ever.
Conversely, avoiding repeated processing may not only significantly reduce processing time, but may also greatly simplify it. This had me wondering if and how repeated processing might be avoided. It seems that the only way of avoiding repeated processing of multiple intermediate output files is appending to a single output file, in principle. In practice, that looks feasible since the appending of uncompressed or intra-frame-compressed frames to an existing file of similar characteristics should work.
Looking at the script section
ACC = (ACC.IsClip()) ? ACC ++ in_c : in_c
JOINED = JOINED + 1
if(JOINED>=JOINMAX || in_i==NMOVS-1) { # limit or last input clip ?
if(ODB=="") {
OFN = OUT_FN # 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="ULY0")
S=RT_String("%d:%d ] WRITING Aggregate Clip %s",PASS,OCNT,OFN)
RT_DebugF("%s",S,name=myName)
RT_TxtWriteFile(S,LOG_FN,Append=True)
for(yank_i = 0, out_c.FrameCount-1) {
RT_YankChain(out_c,n=yank_i) # Forcibly write each frame
}
ACC = 0 in_c = 0 out_c = 0 # MAKE SURE each clip closed and destructor called
JOINED = 0
it seems two approaches might be possible, in principle. One might be preserving the output clip for future (appended) output. In this case I think that approach won't work, mainly because Avisynth does not support that kind of stream-based approach - here, on future writes the output clip will be over-written instead of being appended to. What's more, I wonder whether keeping the output clip open may also keep open input clips, defeating the object of the exercise.
Much more simple, perhaps, would be modifying TWriteAVI() to support appending to an existing file. It might optionally do some additional format compatibility checks, but this may be the easiest way of significantly simplifying and speeding up the concatenation of many files.
Your thoughts, please?
fvisagie
24th July 2014, 13:09
It seems TWriteAVI() does not support audio :(.
See also http://forum.doom9.org/showthread.php?p=1073578#post1073578.
StainlessS
24th July 2014, 15:41
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. :(
I hope there is some kind of audio version of TWriteAVI ? (EDIT: SoundOut sounds like it might be similar)
I've actually spent some time converting that script into functions.
Created a function to scan multiple directories and add wildcard matching files to a DB. Same thing for multiple files submitted as a muti-line string.
Also added a clip splicing functions, with a user set function to call to open a clip or AVS file. The default function to do that only supports AVS, AVI and DirectShowSource. It need someone better aquainted with using ffmpegsource and that lsmash stuff etc to implement the open strategy based primarily on file extension. (thats why I'm made it possible to have a user supplied open routine, I usually only play with avi or mpeg, anything else I usually ffmpeg to lossless avi, when I come back from pub its done and no hassel figuring out how to open it). The default open routine, also allows setting of fields in DB to hold the start and end frames of the spliced clip in the final movie. Also loads an user selectable Global Header so that an opened AVS script (rather than avi clip) has access to global information, to eg resize all clips to same size etc. Also allow AVS clip to set a Global Variable to pass back the name of a personal DB created by the avs file, and option in splice routine to add this client DB fiename to the splice Dbase (in a user selected field). I have implemented a demo similar to the ScriptClip demo in your thread (EDIT: Here (http://forum.doom9.org/showthread.php?p=1682078#post1682078)) where it showed the original filename and start and end sectors of the original clip that occupies current_frame in complete movie. Have added to the demo the ability to extract info from the Client DB and show that too, I chose to implement the client scripts 'favorite color',
the original clip source file (eg avi source for avs) and the time that the avs file was opened in the splicer openclip routine, also show the name of the client DBase.
Wish I knew how to append files via TwriteAVI, it uses VirtualDubMOD (MOD I think) source which is a bit hard to follow.
The bug was quite easy to find in the plug implementor source, the VirtualDub stuff somewhat more of a mystery.
I'll have to figure out how to do audio.
EDIT: Also, can set OpenMAX to 1 file (eg AVS) for source files only (render to lossles first, ie AVS can already have many open files), aggregate files can use more (default 20).
HEre Demo complete with 3 avi files (20 frame each) ~8MB:
Link Removed:
Script Only:
Link Removed:
Files will be delete afte a week or two.
Setting attachment here, will leave in situ:
Attachment Removed: See next post.
StainlessS
25th July 2014, 17:59
Here updated ScriptOnly from previous post, was a bit of a bug in it , oops.
http://http://www.mediafire.com/download/9hbz8xo3zxk9els/DB_SpliceClips-scriptOnly.zip
From DB_AppendFileName in DB_AppendFileName.avs
if(!Exist(FN)) {
Assert(!MustExist,myName+String(i)+" ] '"+FN+"' Does not Exist")
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
}
} Else {
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
}
should have read
if(!Exist(FN)) {
Assert(!MustExist,myName+String(i)+" ] '"+FN+"' Does not Exist")
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
}
}
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
too many Else's (any other changes cosmetic only, ie mostly comment changes)
EDIT:
#################################################
#################################################
#################################################
Thread was hi-jacked a bit after here, can continue where we left off
here at post #73:- https://forum.doom9.org/showthread.php?p=1702364#post1702364
#################################################
#################################################
#################################################
Jenyok
4th August 2014, 18:23
# function InterpolateFrames2(clip clp, int FrameNumber, int FrameCount) using MFlowInter(), MRecalculate(), GScript
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\GSCRIPT_11\gscript.dll")
#
# InterpolateFrames2() function...
#
# FrameNumber is number of the 1-st frame in Source that needs replacing.
# FrameCount is total number of frames to replace.
# InterpolateFrames2(101, 5) would replace 101, 102, 103, 104, 105,
# by using MRecalculate() and MFlowInter() interpolation.
#
function InterpolateFrames2(clip clp, int FrameNumber, int FrameCount)
{
# Constants
# MSuper()
#
hpad = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
vpad = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
pel = 4 # default=2
sharp = 2 # default=2 !!!
rfilter = 4 # default=2
chroma = true # default=true
isse = true # default=true
planar = false # default=false
levels = 0 # default=0
# Constants
# MAnalyse()
#
blkh = 32 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
blkv = 32 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
overlap = 4 # Maybe 2, 4, 8, 16, !!! maybe blkh/2 or litle !!! Change this constant for best tuning !!!
overlapV = 4 # Maybe 2, 4, 8, 16, !!! maybe blkv/2 or litle !!! Change this constant for best tuning !!!
search = 3 # default=4 !!! DO NOT CHANGE =3
searchparam = 16 # default=2 !!! DO NOT CHANGE =16
dct = 5 # default=0
plevel = 2 # default=0
badrange = (-24) # default=24
badsad = 10000 # default=10000
divide = 0 # default=0
sadx264 = 0 # default=0
truemotion = true # default=true
lambda = (truemotion == false) ? 0 : (1000 * blkh * blkv / 64) # default=0 truemotion=false, default=1000*blksize*blksizeV/64 truemotion=true
lsad = (truemotion == false) ? 400 : 1200 # default=400 truemotion=false, default=1200 truemotion=true
pnew = (truemotion == false) ? 0 : 50 # default=0 truemotion=false, default=50 truemotion=true
pzero = pnew # default pzero=pnew
# Constants
# MRecalculate()
#
blkhR = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
blkvR = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
overlapR = 4 # Maybe 2, 4, 8, 16, !!! maybe blkhR/2 or litle !!! Change this constant for best tuning !!!
overlapVR = 4 # Maybe 2, 4, 8, 16, !!! maybe blkvR/2 or litle !!! Change this constant for best tuning !!!
searchR = 3 # default=4
searchparamR = 1 # default=2
thSAD = 400 # default=200 !!! DO NOT CHANGE =400
lambdaR = (truemotion == false) ? 0 : (1000 * blkhR * blkvR / 64) # default=0 truemotion=false, default=1000*blksize*blksizeV/64 truemotion=true
# Constants
# MFlowInter()
#
thSCD1 = 800 # default=400 !!! DO NOT CHANGE =800
thSCD2 = 130 # default=130
iml = 70 # default=100
blend = true # default=true
# Here is code of function...
#
# Restore bad frames with interpolation with MFlowInter
# Prepare functions
#
# function MSuper(clip, int "hpad", int "vpad", int "pel", int "levels", bool "chroma", \
# int "sharp", int "rfilter", clip "pelclip", bool "isse", bool "planar")
#
super = MSuper(clp, \
hpad = hpad, \
vpad = vpad, \
pel = pel, \
chroma = chroma, \
sharp = sharp, \
rfilter = rfilter, \
isse = isse, \
planar = planar, \
levels = levels)
# function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \
# int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \
# int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \
# int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \
# int "badrange", bool "isse", int "full", bool "meander", bool "temporal")
#
backward1 = MAnalyse(super, \
delta = (FrameCount + 1), \
isb = true, \
blksize = blkh, \
blksizeV = blkv, \
overlap = overlap, \
overlapV = overlapV, \
search = search, \
searchparam = searchparam, \
pelsearch = pel, \
lambda = lambda, \
chroma = chroma, \
truemotion = truemotion, \
lsad = lsad, \
plevel = plevel, \
pnew = pnew, \
pzero = pzero, \
dct = dct, \
divide = divide, \
sadx264 = sadx264, \
badSAD = badsad, \
badrange = badrange, \
isse = isse, \
levels = levels, \
global = true, \
pglobal = 0, \
meander = true, \
temporal = false, \
trymany = false)
# function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \
# int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \
# int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \
# int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \
# int "badrange", bool "isse", int "full", bool "meander", bool "temporal")
#
forward1 = MAnalyse(super, \
delta = (FrameCount + 1), \
isb = false, \
blksize = blkh, \
blksizeV = blkv, \
overlap = overlap, \
overlapV = overlapV, \
search = search, \
searchparam = searchparam, \
pelsearch = pel, \
lambda = lambda, \
chroma = chroma, \
truemotion = truemotion, \
lsad = lsad, \
plevel = plevel, \
pnew = pnew, \
pzero = pzero, \
dct = dct, \
divide = divide, \
sadx264 = sadx264, \
badSAD = badsad, \
badrange = badrange, \
isse = isse, \
levels = levels, \
global = true, \
pglobal = 0, \
meander = true, \
temporal = false, \
trymany = false)
# MRecalculate(clip super, clip vectors, int "thSAD", int "smooth", int "blksize", int "blksizeV", \
# int "search", int "searchparam", int "lambda", bool "chroma", bool "truemotion", \
# int "pnew", int "overlap", int "overlapV", string "outfile", int "dct", int "divide", \
# int "sadx264", bool "isse")
#
backward2 = MRecalculate(super, \
backward1, \
blksize = blkhR, \
blksizeV = blkvR, \
overlap = overlapR, \
overlapV = overlapVR, \
search = searchR, \
searchparam = searchparamR, \
lambda = lambdaR, \
dct = dct, \
truemotion = truemotion, \
thSAD = thSAD, \
isse = isse, \
chroma = chroma, \
pnew = pnew, \
divide = divide, \
sadx264 = sadx264, \
smooth = 1)
# MRecalculate(clip super, clip vectors, int "thSAD", int "smooth", int "blksize", int "blksizeV", \
# int "search", int "searchparam", int "lambda", bool "chroma", bool "truemotion", \
# int "pnew", int "overlap", int "overlapV", string "outfile", int "dct", int "divide", \
# int "sadx264", bool "isse")
#
forward2 = MRecalculate(super, \
forward1, \
blksize = blkhR, \
blksizeV = blkvR, \
overlap = overlapR, \
overlapV = overlapVR, \
search = searchR, \
searchparam = searchparamR, \
lambda = lambdaR, \
dct = dct, \
truemotion = truemotion, \
thSAD = thSAD, \
isse = isse, \
chroma = chroma, \
pnew = pnew, \
divide = divide, \
sadx264 = sadx264, \
smooth = 1)
GScript("""
if (FrameCount == 1) {
# MFlowInter(clip source, clip super, clip mvbw, clip mvfw, float "time", float "mL", \
# bool "blend", int "thSCD1", int "thSCD2", bool "isse", bool "planar")
#
inter2 = MFlowInter(clp, \
super, \
backward2, \
forward2, \
time = 50, \
mL = iml, \
blend = blend, \
thSCD1 = thSCD1, \
thSCD2 = thSCD2, \
isse = isse, \
planar = planar)
inter = inter2.Trim(FrameNumber, -1)
} # End of If-Then
else {
# Fill an Inter variable with the MFlowInter() clips with different times
# Times are calculated in each step
#
for (i=0, FrameCount-1) {
itime = (100.0 / Float(FrameCount + 1)) * Float(i + 1)
# MFlowInter(clip source, clip super, clip mvbw, clip mvfw, float "time", float "mL", \
# bool "blend", int "thSCD1", int "thSCD2", bool "isse", bool "planar")
#
inter2 = MFlowInter(clp, \
super, \
backward2, \
forward2, \
time = itime, \
mL = iml, \
blend = blend, \
thSCD1 = thSCD1, \
thSCD2 = thSCD2, \
isse = isse, \
planar = planar)
if (i == 0) {
inter = inter2.Trim(FrameNumber, -1)
} # End of If-Then
else {
inter = inter ++ inter2.Trim(FrameNumber, -1)
} # End of If-Else
} # End of For ()
} # End of If-Else
""") # End of GScript ()
return (clp.trim(0, FrameNumber - 1) ++ inter ++ clp.trim(FrameNumber + FrameCount, 0))
}
.
There is a function InterpolateFrames2() .
When using this function many times in script to restore bad frame(s) there are various errors occur,
not enough memory, error reading frame 0 and so on...
Or VirtualDub crashes.
.
Why ?
.
Jenyok
4th August 2014, 18:26
For example.
.
InterpolateFrames2(33923, 4)
InterpolateFrames2(89733, 2)
InterpolateFrames2(90420, 2)
InterpolateFrames2(91635, 2)
InterpolateFrames2(93117, 3)
InterpolateFrames2(95756, 2)
InterpolateFrames2(97357, 2)
InterpolateFrames2(97365, 2)
InterpolateFrames2(97487, 2)
InterpolateFrames2(97520, 2)
InterpolateFrames2(97608, 2)
InterpolateFrames2(98405, 2)
InterpolateFrames2(98428, 2)
InterpolateFrames2(98549, 2)
InterpolateFrames2(98717, 2)
InterpolateFrames2(98817, 5)
InterpolateFrames2(100604, 2)
InterpolateFrames2(101074, 2)
InterpolateFrames2(101083, 2)
InterpolateFrames2(101339, 2)
InterpolateFrames2(101480, 2)
InterpolateFrames2(101517, 2)
InterpolateFrames2(101969, 2)
InterpolateFrames2(102275, 2)
InterpolateFrames2(102595, 2)
InterpolateFrames2(103234, 2)
InterpolateFrames2(103471, 2)
InterpolateFrames2(103650, 2)
InterpolateFrames2(104357, 2)
InterpolateFrames2(105485, 2)
InterpolateFrames2(105720, 2)
InterpolateFrames2(105724, 2)
InterpolateFrames2(105928, 2)
InterpolateFrames2(105945, 2)
InterpolateFrames2(105950, 2)
InterpolateFrames2(106045, 3)
InterpolateFrames2(106268, 2)
InterpolateFrames2(106585, 2)
InterpolateFrames2(106757, 2)
InterpolateFrames2(107381, 2)
InterpolateFrames2(107451, 2)
InterpolateFrames2(107825, 2)
InterpolateFrames2(107898, 2)
InterpolateFrames2(107930, 2)
InterpolateFrames2(107936, 2)
InterpolateFrames2(107952, 2)
InterpolateFrames2(108212, 2)
InterpolateFrames2(108551, 2)
InterpolateFrames2(109667, 2)
InterpolateFrames2(110091, 2)
InterpolateFrames2(111327, 2)
InterpolateFrames2(111898, 2)
InterpolateFrames2(114673, 3)
InterpolateFrames2(115029, 3)
InterpolateFrames2(119015, 2)
InterpolateFrames2(119805, 2)
InterpolateFrames2(119837, 2)
InterpolateFrames2(121266, 3)
InterpolateFrames2(121298, 2)
StainlessS
4th August 2014, 18:43
Its connected with doing the motion estimation inside of a script function many times (creation of new clips every time), would not happen
if interpolation could be done only at main script level once. I think I have experienced problems when you get to about 70+ instances being
called. I used to get crashes in VDMod when doing an F5 refresh (reopen and jump back to same frame you were at), but OK if doing an F7
refresh (reopen, at frame 0), for some reason. Not sure on the cause, I think Didee gave an explanation of it somewhere.
foxyshadis
5th August 2014, 00:20
You should have an InterpolateAllFrames function that stores to a clip, and then use JDL_ReplaceRange as many times as necessary to fix the broken patches. Doing it all in the same huge function breaks AviSynth's memory management.
StainlessS
5th August 2014, 08:08
Script for fixing lots of broken SINGLE FRAMES ONLY: http://forum.doom9.org/showthread.php?p=1567214#post1567214
PredictFromPrevious and PredictFromNext need to be individually checked for 'goodness'.
All replacements done inside a single script function and so the problem does not appear.
Jenyok
7th August 2014, 10:55
StainlessS
.
I need a universal script for fixing not only SINGLE broken FRAME, but TWO broken FRAMES, THREE broken FRAMES and more continiuos broken FRAMES...
If you would see my script and example for using script in MAnalyse function is used FrameCount variable, and variable itime is used FrameCount variable too in function MFlowInter.
This is why that function is used many times in script.
.
What could I do in this situation ?
.
StainlessS
8th August 2014, 12:35
StainlessS
What could I do in this situation ?
.
Wait a little.
StainlessS
10th August 2014, 01:35
Jenyok,
Here Clipclop v1.2 Beta, with DoctorFrames() script.
Replaces (interpolates) up to 22 frames, + copy from previous frame + copy from next frame (single frame fixes).
Uses up all 256 clips available to ClipClop (incl source clip).
I still need to do a little work on it but you can have a play if you like.
here:- http://www.mediafire.com/download/ber7e52dukt43ea/ClipClop_25%2626_dll_v1.20Beta_20120325.zip
Here, part of the source script (is ~ 400 lines long, included in zip)
Function DoctorFrames(clip c, String "Scmd",String "Cmd",bool "Show",int "dv") {
# 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)
###
CP = c.DeleteFrame(c.Framecount()-1).DuplicateFrame(0)
CN = c.DuplicateFrame(c.Framecount()-1).DeleteFrame(0)
###
I = CP
sup = I.MSuper()
###
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)
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.0 / (BAD+1), ml=100)
I02_02 = I.MFlowInter(sup,I02_bv,I02_fv, time=100.0 * 2.0 / (BAD+1), ml=100)
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.0 / (BAD+1), ml=100)
I03_02 = I.MFlowInter(sup,I03_bv,I03_fv, time=100.0 * 2.0 / (BAD+1), ml=100)
I03_03 = I.MFlowInter(sup,I03_bv,I03_fv, time=100.0 * 3.0 / (BAD+1), ml=100)
###
### ... etc
###
BAD = 22
I22_bv = sup.MAnalyse(isb=true, delta=BAD+1)
I22_fv = sup.MAnalyse(isb=false, delta=BAD+1)
I22_01 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 * 1.0 / (BAD+1), ml=100)
I22_02 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 * 2.0 / (BAD+1), ml=100)
I22_03 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 * 3.0 / (BAD+1), ml=100)
I22_04 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 * 4.0 / (BAD+1), ml=100)
I22_05 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 * 5.0 / (BAD+1), ml=100)
I22_06 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 * 6.0 / (BAD+1), ml=100)
I22_07 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 * 7.0 / (BAD+1), ml=100)
I22_08 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 * 8.0 / (BAD+1), ml=100)
I22_09 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 * 9.0 / (BAD+1), ml=100)
I22_10 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *10.0 / (BAD+1), ml=100)
I22_11 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *11.0 / (BAD+1), ml=100)
I22_12 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *12.0 / (BAD+1), ml=100)
I22_13 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *13.0 / (BAD+1), ml=100)
I22_14 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *14.0 / (BAD+1), ml=100)
I22_15 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *15.0 / (BAD+1), ml=100)
I22_16 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *16.0 / (BAD+1), ml=100)
I22_17 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *17.0 / (BAD+1), ml=100)
I22_18 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *18.0 / (BAD+1), ml=100)
I22_19 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *19.0 / (BAD+1), ml=100)
I22_20 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *20.0 / (BAD+1), ml=100)
I22_21 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *21.0 / (BAD+1), ml=100)
I22_22 = I.MFlowInter(sup,I22_bv,I22_fv, time=100.0 *22.0 / (BAD+1), ml=100)
###
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 # 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 #
I12=69:12 #
I13=81:13 #
I14=94:14 #
I15=108:15 #
I16=123:16 #
I17=139:17 #
I18=156:18 #
I19=174:19 #
I20=193:20 #
I21=213:21 #
I22=234:22 #
# No more clip slots available (Used up all 256 available clips [including clip 0 ie source])
"
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,
\ I12_01,I12_02,I12_03,I12_04,I12_05,I12_06,I12_07,I12_08,I12_09,I12_10,I12_11,I12_12,
\ I13_01,I13_02,I13_03,I13_04,I13_05,I13_06,I13_07,I13_08,I13_09,I13_10,I13_11,I13_12,I13_13,
\ I14_01,I14_02,I14_03,I14_04,I14_05,I14_06,I14_07,I14_08,I14_09,I14_10,I14_11,I14_12,I14_13,I14_14,
\ I15_01,I15_02,I15_03,I15_04,I15_05,I15_06,I15_07,I15_08,I15_09,I15_10,I15_11,I15_12,I15_13,I15_14,I15_15,
\ I16_01,I16_02,I16_03,I16_04,I16_05,I16_06,I16_07,I16_08,I16_09,I16_10,I16_11,I16_12,I16_13,I16_14,I16_15,I16_16,
\ I17_01,I17_02,I17_03,I17_04,I17_05,I17_06,I17_07,I17_08,I17_09,I17_10,I17_11,I17_12,I17_13,I17_14,I17_15,I17_16,I17_17,
\ I18_01,I18_02,I18_03,I18_04,I18_05,I18_06,I18_07,I18_08,I18_09,I18_10,I18_11,I18_12,I18_13,I18_14,I18_15,I18_16,I18_17,I18_18,
\ I19_01,I19_02,I19_03,I19_04,I19_05,I19_06,I19_07,I19_08,I19_09,I19_10,I19_11,I19_12,I19_13,I19_14,I19_15,I19_16,I19_17,I19_18,I19_19,
\ I20_01,I20_02,I20_03,I20_04,I20_05,I20_06,I20_07,I20_08,I20_09,I20_10,I20_11,I20_12,I20_13,I20_14,I20_15,I20_16,I20_17,I20_18,I20_19,I20_20,
\ I21_01,I21_02,I21_03,I21_04,I21_05,I21_06,I21_07,I21_08,I21_09,I21_10,I21_11,I21_12,I21_13,I21_14,I21_15,I21_16,I21_17,I21_18,I21_19,I21_20,I21_21,
\ I22_01,I22_02,I22_03,I22_04,I22_05,I22_06,I22_07,I22_08,I22_09,I22_10,I22_11,I22_12,I22_13,I22_14,I22_15,I22_16,I22_17,I22_18,I22_19,I22_20,I22_21,I22_22,
\ scmd=SCMD,cmd=CMD,nickname=NICKNAME,show=SHOW,dv=DV)
}
c=Avisource("D:\avs\xmen2.avi")
SCMD="""
CP 100
CN 200
I1 300
I2 400
I3 500
I4 600
I5 700
I6 800
I7 900
I8 1000
I9 1100
I10 1200
I11 1300
I12 1400
I13 1500
I14 1600
I15 1700
I16 1800
I17 1900
I18 2000
I19 2100
I20 2200
I21 2300
I22 2400
"""
DoctorFrames(c,Scmd=SCMD,Show=True,dv=4)
return Last
you can of course add your own additional args to the script function and edit all of the relevant lines.
Jenyok
10th August 2014, 05:32
StainlessS
.
Thanks.
I shall try.
.
And once more.
Try
.
sup = I.MSuper(pel=4, sharp=2, rfilter=4)
.
and
ml=70 in MFlowInter funcrion...
.
StainlessS
10th August 2014, 13:46
OK, shall make suggested changes, if any more (that you cannot live without then say (and those you wish as DoctorFrame func arguments
if any, together with suggested defaults, hopefully not too many).
On my core duo with 3GB of ram on XP32 (unfortunately, I had 4GB but removed a stick for some reason, and seem to have thrown it out together
with about 150 sticks of old ram, what a silly Billy), on playing the given script it seems to settle at about 2.2GB pagefile and about 800MB
to 900 MB available memory, repeated playing from start without refresh does not increase ram usage and remains quite stable.
I have a P4 with 1GB ram, shall see what happens when I try with that, shall post results here.
Above with PAL SD DVD video, I dont have any HD video handy to try with.
EDIT: RAM usage without using all Ixx Interpolate commands should be somewhat lower, it is the (EDIT: first) usage of the interpolation
clips rather than creation that consumes most memory.
StainlessS
10th August 2014, 16:22
OK, tried with P4 machine, XP32 1GB ram, via TightVNC (http://en.wikipedia.org/wiki/TightVNC which would take a little ram itself).
At rest on desktop, ~ 200MB PageFile usage, ~ 820 MB available physical memory.
Loading given script into VDMod: ~ 1.35GB PageFile usage, ~ 540 MB available physical memory.
Playing script, Grows to: ~ 1.5GB PageFile usage, ~ 5 MB available physical memory.
Jump to frame 0 after about 8000 frames played, same pagefile usage, available physical mem about 30MB or so.
Playing again from start (without refresh), grows again to same usage as previous play.
I decided to clean system (CCleaner), remove Hibernation, Set Pagefile size to 0, defrag system drive.
Set pagefile size to 3048 (from 1536MB default size [1.5 * system memory]) and re-enabled hibernation, giving
contiguous single pagefile, and hibernation blocks.
Tried above again, pretty much exact same results.
For some reason pagefile did still not go above default pagefile size of 1.5 * system mem, with an additional 1.5GB that was never used.
So, at least for 1GB system memory and SD DVD size clip, remained stable.
EDIT: I'll also add an argument to script that allows to eg only use 1st 10 interpolation clip sets, or
full set of 22 clip sets. Would greatly reduce memory overhead where 22 frame interpolation was not required.
Will require Gavino's GScript.
Jenyok
10th August 2014, 16:54
StainlessS
.
VirtualDub and AviSynth already crashes.
See report from VirtualDub.
.
VirtualDub crash report -- build 32842 (release)
--------------------------------------
Disassembly:
005bc080: 015974 add [ecx+74h], ebx
005bc083: 156a03e8a3 adc eax, a3e8036a
005bc088: 9c pushfd
005bc089: 0000 add [eax], al
005bc08b: 85c0 test eax, eax
005bc08d: 59 pop ecx
005bc08e: 751f jnz 005bc0af
005bc090: 833db019640001 cmp dword ptr [006419b0], 01h
005bc097: 7516 jnz 005bc0af
005bc099: 68fc000000 push 000000fc
005bc09e: e834feffff call 005bbed7
005bc0a3: 68ff000000 push 000000ff
005bc0a8: e82afeffff call 005bbed7
005bc0ad: 59 pop ecx
005bc0ae: 59 pop ecx
005bc0af: c3 ret
005bc0b0: 8b442404 mov eax, [esp+04h]
005bc0b4: a30cd96500 mov [0065d90c], eax
005bc0b9: c3 ret
005bc0ba: ff350cd96500 push dword ptr [0065d90c]
005bc0c0: e87ee4ffff call 005ba543
005bc0c5: 85c0 test eax, eax
005bc0c7: 59 pop ecx
005bc0c8: 740f jz 005bc0d9
005bc0ca: ff742404 push dword ptr [esp+04h]
005bc0ce: ffd0 call eax
005bc0d0: 85c0 test eax, eax
005bc0d2: 59 pop ecx
005bc0d3: 7404 jz 005bc0d9
005bc0d5: 33c0 xor eax, eax
005bc0d7: 40 inc eax
005bc0d8: c3 ret
005bc0d9: 33c0 xor eax, eax
005bc0db: c3 ret
005bc0dc: 55 push ebp
005bc0dd: 8bec mov ebp, esp
005bc0df: 83ec08 sub esp, 08h
005bc0e2: 897dfc mov [ebp-04h], edi
005bc0e5: 8975f8 mov [ebp-08h], esi
005bc0e8: 8b750c mov esi, [ebp+0ch]
005bc0eb: 8b7d08 mov edi, [ebp+08h]
005bc0ee: 8b4d10 mov ecx, [ebp+10h]
005bc0f1: c1e907 shr ecx, 07h
005bc0f4: eb06 jmp 005bc0fc
005bc0f6: 8d9b00000000 lea ebx, [ebx+00]
005bc0fc: 660f6f06 movdqa xmm0, [esi]
005bc100: 660f6f4e10 movdqa xmm1, [esi+10h]
005bc105: 660f6f5620 movdqa xmm2, [esi+20h]
005bc10a: 660f6f5e30 movdqa xmm3, [esi+30h]
005bc10f: 660f7f07 movdqa [edi], xmm0 <-- FAULT
005bc113: 660f7f4f10 movdqa [edi+10h], xmm1
005bc118: 660f7f5720 movdqa [edi+20h], xmm2
005bc11d: 660f7f5f30 movdqa [edi+30h], xmm3
005bc122: 660f6f6640 movdqa xmm4, [esi+40h]
005bc127: 660f6f6e50 movdqa xmm5, [esi+50h]
005bc12c: 660f6f7660 movdqa xmm6, [esi+60h]
005bc131: 660f6f7e70 movdqa xmm7, [esi+70h]
005bc136: 660f7f6740 movdqa [edi+40h], xmm4
005bc13b: 660f7f6f50 movdqa [edi+50h], xmm5
005bc140: 660f7f7760 movdqa [edi+60h], xmm6
005bc145: 660f7f7f70 movdqa [edi+70h], xmm7
005bc14a: 8db680000000 lea esi, [esi+80]
005bc150: 8dbf80000000 lea edi, [edi+80]
005bc156: 49 dec ecx
005bc157: 75a3 jnz 005bc0fc
005bc159: 8b75f8 mov esi, [ebp-08h]
005bc15c: 8b7dfc mov edi, [ebp-04h]
005bc15f: 8be5 mov esp, ebp
005bc161: 5d pop ebp
005bc162: c3 ret
005bc163: 55 push ebp
005bc164: 8bec mov ebp, esp
005bc166: 83ec1c sub esp, 1ch
005bc169: 897df4 mov [ebp-0ch], edi
005bc16c: 8975f8 mov [ebp-08h], esi
005bc16f: 895dfc mov [ebp-04h], ebx
005bc172: 8b5d0c mov ebx, [ebp+0ch]
005bc175: 8bc3 mov eax, ebx
005bc177: 99 cdq
005bc178: 8bc8 mov ecx, eax
005bc17a: 8b4508 mov eax, [ebp+08h]
005bc17d: 33ca xor ecx, edx
005bc17f: 2b db 2bh
Built on Aegis on Fri Dec 24 13:18:44 2010 using compiler version 1400
Windows 5.1 (Windows XP x86 build 2600) [Service Pack 3]
EAX = 00000000
EBX = 00c867e0
ECX = 00000050
EDX = 00000000
EBP = 0012f7c0
ESI = 00c867e0
EDI = 00000000
ESP = 0012f7b8
EIP = 005bc10f
EFLAGS = 00210206
FPUCW = ffff027f
FPUTW = ffffffff
Crash reason: Access Violation
Crash context:
An out-of-bounds memory access (access violation) occurred in module 'VirtualDub'...
...writing address 00000000.
Pointer dumps:
EBX 00c867e0: 46464952 00000000 20495641 5453494c 0000227e 6c726468 68697661 00000038
ESI 00c867e0: 46464952 00000000 20495641 5453494c 0000227e 6c726468 68697661 00000038
ESP 0012f7b8: 00002800 00000000 0012f7f0 005bc1b5 00000000 00c867e0 00002800 ffffffff
0012f7d8: 00000000 005b306d 00c867e0 00002800 00c70b98 00c70bd4 0012f814 0052167c
0012f7f8: 00000000 00c867e0 00002800 00c6d3d8 00000000 00c70930 00002800 00002292
0012f818: 004bc471 00c867e0 00002800 00c70930 0012fbe4 00d46eb0 00c65908 00000100
EBP 0012f7c0: 0012f7f0 005bc1b5 00000000 00c867e0 00002800 ffffffff 00000000 005b306d
0012f7e0: 00c867e0 00002800 00c70b98 00c70bd4 0012f814 0052167c 00000000 00c867e0
0012f800: 00002800 00c6d3d8 00000000 00c70930 00002800 00002292 004bc471 00c867e0
0012f820: 00002800 00c70930 0012fbe4 00d46eb0 00c65908 00000100 00000566 0000108a
Thread call stack:
005bc10f: fastcopy_I()
005bc1b5: _VEC_memcpy()
005b306d: free()
0052167c: VDFileAsyncNT::FastWrite()
004bc471: AVIOutputFile::init()
004bb1d5: ?$list::_Insert_n()
0041e716: VDAVIOutputFileSystem::CreateSegment()
7c830944: kernel32!CreateEventA [7c800000+30922+22]
0051910c: VDSignal::VDSignal()
0040745d: VDAsyncBlitter::VDAsyncBlitter()
7c90dc1a: ntdll!NtSetEvent [7c900000+dc0e+c]
7c80a0c7: kernel32!SetEvent [7c800000+a0b7+10]
0041f9b5: VDDubProcessThread::NextSegment()
0041fb67: VDDubProcessThread::Init()
00419cbd: Dubber::Go()
004630f5: VDProject::RunOperation()
7c9101db: ntdll!RtlAllocateHeap [7c900000+100c4+117]
004134c7: SaveAVI()
004608ca: VDProject::SaveAVI()
004528b1: SaveAVI()
00465890: VDProjectUI::SaveAVIAsk()
0046c4e6: VDProjectUI::MenuHit()
7e369488: USER32!GetWindowLongA [7e360000+945d+2b]
7e378d8b: USER32!DefWindowProcW [7e360000+18d20+6b]
004794a0: VDUIFrame::DefProc()
0046da41: _catch$?MainWndProc@VDProjectUI@@IAEJIIJ@Z$0()
7e369488: USER32!GetWindowLongA [7e360000+945d+2b]
00465ac0: VDProjectUI::WndProc()
00479b65: VDUIFrame::StaticWndProc()
7e368734: USER32!GetDC [7e360000+86c7+6d]
7e368816: USER32!GetDC [7e360000+86c7+14f]
7e3689cd: USER32!GetWindowLongW [7e360000+88a6+127]
7e37a43b: USER32!PeekMessageA [7e360000+1a340+fb]
7e3696c7: USER32!DispatchMessageA [7e360000+96b8+f]
00452596: WinMain@16()
005b78db: __tmainCRTStartup()
7c816037: kernel32!RegisterWaitForInputIdle [7c800000+15fee+49]
-- End of report
.
Jenyok
10th August 2014, 16:57
Script...
.
#
#
# Версия скрипта: V 1.0
#
# Дата: 21.06.2010 года
#
#
#
# 2-й скрипт для работы с фильмом "Учитель"
#
# Восстановление "плохих" кадров
#
#
# Входной файл Teacher_HiQ2.avi
#
#
# Выходной файл Teacher_HiQ3.avi
#
#
#
# Скрипт выполняется долго ~ 2 - 3 часа
#
# Можно применить к уже полностью готовому видео
#
#
#Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT\interpolateframes.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\CLIPCLOP_25&26_DLL_V1_20BETA_20120325\doctorframes.avs")
# Константы
#
#InputFileDir = "C:\Z_DISK_D\VIDEO2\TEACHER\"
#InputFileDir = "..\"
#InputFileName = "Teacher_HiQ_2.avi"
#OutputFileName = "Teacher_HiQ_3.avi"
# =============================================================================
#
# Собственно скрипт AVI формат
#
AVISource("C:\Z_DISK_C\PICTURE\JENYOK\SCHOOL_47_KURGAN\VIDEO\DVD 25YEARS DISK7 ФИЛЬМ УЧИТЕЛЬ V1_00 (OLD, +AVI, +AVS)\source_teacher_768x576p_25fps_28mbps_divx_mp3_44khz_stereo_2013.avi")
audio=KillVideo(last)
last=KillAudio(last)
# Плохие кадры
#
SCMD="""
I1 145
I1 149
I1 195
I2 214
I4 228
I4 497
I4 513
I1 519
I1 524
I5 530
I3 536
I2 561
I2 585
I1 633
I5 643
I4 651
I2 658
I3 672
I2 678
I19 684
I1 723
I1 727
I2 732
I1 740
I2 743
I8 748
I1 838
I1 842
I1 860
I1 866
I6 900
I2 949
I3 963
I2 981
I1 1024
I1 1253
I1 1294
I1 1328
I1 1452
I2 1467
I1 1582
I1 1614
I2 1626
I1 1723
I3 1754
I1 1763
I2 2116
I1 2497
I1 2568
I1 2727
I1 3099
I1 3314
I2 3598
I1 4067
I1 4441
I1 4683
I4 4791
I1 4834
I1 5070
I2 5445
I1 5715
I3 5741
I1 5751
I2 6030
I1 6238
I2 6245
I3 6680
I1 6702
I2 6820
I1 6858
I1 6891
I1 7289
I2 7425
I1 7450
I1 7480
I2 7487
I1 7565
I1 7574
I1 7605
I2 7732
I1 7738
I1 7775
I1 7916
I1 7990
I2 8001
I1 8049
I2 8171
I1 8516
I2 8643
I3 8681
I1 8766
I1 8787
I1 8810
I1 8821
I2 8847
I1 8909
I1 8943
I1 9030
I3 9120
I1 9198
I6 9297
I1 9312
I1 9343
I1 9365
I1 9792
I1 9795
I1 10185
I2 10206
I2 10269
I1 10471
I1 10578
I1 10680
I1 10954
I1 10966
I3 11363
I1 11376
I1 11476
I4 11504
I1 11636
I2 11647
I1 11654
I2 11727
I1 11820
I2 11838
I1 11862
I1 11887
I3 11895
I1 11961
I1 11998
I1 12097
I9 12304
I1 12526
I1 12589
I5 12608
I5 12723
I1 12741
I1 12756
I2 12807
I1 12867
I1 12881
I1 12916
I1 12945
I1 12969
I1 12985
I1 13140
I1 13162
I1 13193
I1 13203
I2 13274
I1 13287
I1 13293
I1 13299
I2 13309
I3 13331
I1 13514
I1 13500
I2 13595
I1 13667
I1 13715
I1 13778
I1 13818
I1 13860
I1 13881
I1 13903
I1 13956
I1 13990
I1 14020
I1 14075
I1 14131
I2 14156
I1 14167
I1 14174
I2 14227
I2 14271
I1 14281
I1 14327
I1 14364
I2 14481
I2 14714
I1 14744
I2 14778
I1 14784
I1 14813
I1 14969
I8 15002
I1 15126
I1 15540
I2 15892
I1 15935
I1 16029
I1 16046
I1 16119
I1 16126
I1 16139
I1 16147
I1 16188
I1 16217
I4 16228
I1 16239
I1 16260
I1 16267
I1 16282
I1 16369
I1 16422
I1 16437
I1 16452
I1 16458
I2 16480
I1 16510
I1 16583
I1 16704
I1 17009
I1 17073
I1 17077
I1 17082
I1 17272
I1 17279
I2 17493
I1 17513
I1 17964
I1 18087
I1 18161
I2 18254
I1 18359
I1 18429
I1 18737
I1 18745
I2 18828
I1 18909
I1 18971
I1 19047
I1 19195
I1 19351
I1 19371
I1 19572
I2 19619
I1 19628
I1 19734
I1 19741
I1 19749
I1 19774
I1 19784
I1 19804
I1 20215
I1 20266
I2 20732
I1 20743
I2 20747
I1 20765
I1 20788
I1 20838
I2 20949
I1 21033
I1 21198
I3 21231
I2 21268
I1 21413
I1 21458
I2 21685
I1 22268
I1 22272
I1 22966
I1 23008
I1 23129
I1 23137
I2 23187
I6 23197
I2 23208
I3 23221
I2 23261
I14 23407
I2 23532
I2 23581
I1 23724
I1 23750
I2 24043
I1 24065
I2 24128
I1 24147
I1 24394
I2 24403
I1 24446
I1 24472
I1 24886
I1 25240
I1 25431
I1 25499
I1 25513
I1 25529
I1 25673
I1 25692
I2 25701
I1 25773
I1 26461
I1 26778
I1 26820
I2 26846
I1 26928
I1 26984
I2 26999
I1 27027
I1 27047
I1 27055
I2 27181
I3 27262
I3 27284
I3 27418
I1 27551
I1 27603
I1 27658
I1 27673
I1 27870
I1 27925
I1 27944
I1 28092
I1 28119
I1 28322
I2 28398
I1 28407
I1 28507
I1 28653
I1 28786
I1 28797
I2 28863
I1 28873
I1 28914
I1 28958
I2 29028
I1 29065
I2 29094
I1 29160
I1 29188
I1 29271
I1 29287
I1 29309
I1 29439
I1 29448
I1 29547
I1 29761
I1 29857
I1 29886
I1 29957
I3 30045
I1 30170
I1 30183
I1 30191
I1 30339
I4 30690
I1 30930
I1 31040
I1 31069
I4 31103
I1 31210
I1 31319
I1 31382
I8 31399
I2 31424
I1 31608
I1 31646
I1 32063
I1 32313
I1 32385
I2 32497
I1 32508
I1 32560
I2 32584
I1 32607
I1 32622
I3 32654
I4 32662
I1 32704
I1 32873
I1 32882
I1 32901
I1 32962
I1 32986
I1 33182
I1 33233
I1 33247
I3 33271
I4 33446
I1 33455
I1 33462
I5 33465
I2 33476
I2 33487
I1 33495
I2 33500
I1 33512
I2 33516
I1 33522
I1 33530
I1 33548
I9 33558
I1 33585
I5 33602
I1 33612
I1 33644
I1 33658
I2 33667
I1 33678
I6 33684
I2 33700
I1 33904
I1 34179
I1 34219
I1 34402
I1 34592
I1 34613
I1 34842
I1 34955
I1 35057
I1 35072
I1 35111
I5 35130
I1 35397
I2 35565
I2 35667
I1 35678
I1 35849
I4 35910
I1 36008
I1 36015
I9 36046
I1 36145
I1 36342
I1 36361
I2 36365
I1 36411
I1 36425
I1 36480
I1 36746
I1 36913
I1 36918
I1 36926
I1 36941
I1 37020
I1 37062
I2 37081
I1 37139
I1 37145
I1 37162
I1 37202
I1 37304
I1 37318
I2 37321
I1 37339
I1 37387
I1 37717
I1 37729
I9 37732
I1 38007
I1 38012
I1 38314
I1 38824
I1 38875
I1 39018
I1 39035
I7 39050
I2 39068
I2 39115
I1 39123
I1 39129
I1 39140
I1 39153
I1 39187
I1 39202
I1 39325
I1 39333
I3 39409
I1 39596
I4 39812
I4 39927
I1 40363
I1 40406
I1 40414
I1 40420
I1 40486
I1 40547
I1 40613
I1 40887
I1 41138
I1 41154
I2 41157
I1 41194
I1 41526
I1 41545
I1 41562
I1 41669
I1 41699
I1 41714
I1 41762
I1 41794
I1 41817
I1 41822
I3 41845
I1 41882
I1 42074
I1 42251
I1 42423
I1 42473
I1 42493
I2 42611
I1 42630
I1 42862
I1 43062
I1 43280
I1 43401
I1 43478
I1 43547
I1 43706
I1 43915
I1 44011
I1 44025
I1 44058
I1 44081
I1 44098
I1 44241
I1 44336
I1 44373
I1 44434
I1 44474
I2 44621
I1 44656
I2 44680
I1 44699
I1 44899
I1 44949
I1 44972
I1 44993
I1 45083
I1 45254
I1 45298
I1 45402
I3 45524
I1 45547
I1 45565
I1 45596
I3 45599
I1 45616
I2 45632
I1 45636
I1 45654
I1 45666
I1 45669
I5 45678
I5 45690
I5 45702
I1 45713
I1 45726
I4 45738
I1 45746
I1 45750
I1 45754
I1 45758
I1 45766
I1 45770
I1 45797
I2 45890
I1 45910
I7 45932
I1 45964
I1 45999
I1 46002
I1 46059
I1 46067
I1 46080
I1 46095
I1 46106
I1 46117
I1 46130
I1 43169
I1 46177
I1 46376
I1 46390
I1 46446
I1 46449
I4 46559
I6 46657
I3 46784
I2 46817
I2 46837
I1 46843
I1 46891
I1 46901
I1 47021
I1 47045
I1 47108
I1 47133
I1 47163
I1 47207
I1 47383
I1 47413
I1 47766
I1 48357
I1 48390
I1 48543
I1 48645
I3 48672
I1 48767
I1 48812
I1 48836
I2 48940
I1 48914
I1 48998
I1 49102
I1 49376
I1 49459
I1 49465
I1 49478
I1 49603
I6 49611
I1 49678
I1 49681
I1 49707
I2 49755
I1 49782
I1 49854
I1 49907
I1 49913
I2 49922
I1 50141
I1 50233
I1 50257
I1 50272
I1 50325
I1 50469
I1 50561
I1 50585
I1 50683
I1 50736
I1 50753
I1 50816
I1 50870
I1 51017
I2 51289
I1 51417
I1 51469
I2 51489
I1 51636
I2 51658
I2 51673
I2 51709
I2 51716
I1 51805
I1 51833
I1 51946
I1 52179
I1 52444
I1 52539
I1 52562
I1 52587
I1 52629
I1 52664
I1 52677
I1 52697
I1 53158
I1 53677
I1 53868
I1 54000
I1 54059
I1 54065
I2 54071
I1 54104
I2 54123
I2 54146
I1 54222
I1 54328
I1 54441
"""
DoctorFrames(last, Scmd=SCMD, Show=false, dv=0)
##InterpolateFrames(11409, 60)
##InterpolateFrames(23434, 75)
##InterpolateFrames(30993, 28)
AudioDub(last, audio)
ConvertToYUY2()
.
StainlessS
10th August 2014, 17:51
The assembly debug stuff dont mean a lot to me, but its part of VirtualDub that yields the access violation, on address 0, perhaps out of memory.
What memory does the machine have ?
What version Vdub ?
Can you turn on "Show" and dv=4 in args to DoctorFrames and give output from DebugView.
Also, which frame does it get up to (what does it show on frame before crash), [It looks like you are saving clip rather than just playing], does it also happen if just playing ?
Perhaps could also monitor memory usage in TaskManager (CTRL-SHIFT-ESC).
StainlessS
10th August 2014, 21:03
OK, have re-created clip of same size (768x576) and used exact same script as you.
On first play through it crashed (@frame 496 [well that was last shown, next frame is I4 497]) with a "We seem to have run out of memory folks" error,
which I think was from VDubMod rather than Avisynth, with a pagefile of ~2GB
and avaialble physical memory of ~1.7GB, so looks not to be a memory problem.
On 2nd play, no error, played though to about 20,000 frames without error.
Anyway, looks like I should be able to find error myself if I keep trying, so dont bother providing any further info.
Groucho2004
10th August 2014, 21:39
On first play through it crashed (@frame 496 [well that was last shown, next frame is I4 497]) with a "We seem to have run out of memory folks" error,
which I think was from VDubMod rather than Avisynth
This error is definitely thrown by Avisynth.
and avaialble physical memory of ~1.7GB, so looks not to be a memory problem.Are you sure that the 1.7 GB were available physical memory?
StainlessS
10th August 2014, 21:58
This alert that I'm getting:
VirtualDub Error
Avisynth read error:
GetFramebuffer: Returned a VBF with a 0 data pointer!
size = 3639680, max=536870911, used=395895984
I think we have run out of memory folks!
From TaskManager:
Physical Memory:
Total 3126972KB
Available 1788284KB
SystemCache 1199600KB
Commit Charge:
Total 2298680KB
Limit 5057532KB
Peak 2371884KB
Kernel Memory:
Total 86980KB
Paged 60052KB
NonPaged 26912KB
Pagefile usage shows about 2.0GB.
On taking a peek at my pagefile size setting (My computer/Properties/Advanced/Performance/Advanced/Virtual Memory/)
I see a 'Custom Setting" Initial Size of 2048MB with a maximum of 4096MB (dont remember setting that),
so pagefile looks to be at maximum Initial Size.
Groucho2004
10th August 2014, 22:18
This alert that I'm getting:
VirtualDub Error
Avisynth read error:
GetFramebuffer: Returned a VBF with a 0 data pointer!
size = 3639680, max=536870911, used=395895984
I think we have run out of memory folks!
From TaskManager:
Physical Memory:
Total 3126972KB
Available 1788284KB
SystemCache 1199600KB
Commit Charge:
Total 2298680KB
Limit 5057532KB
Peak 2371884KB
Kernel Memory:
Total 86980KB
Paged 60052KB
NonPaged 26912KB
Pagefile usage shows about 2.0GB.
On taking a peek at my pagefile size setting (My computer/Properties/Advanced/Performance/Advanced/Virtual Memory/)
I see a 'Custom Setting" Initial Size of 2048MB with a maximum of 4096MB (dont remember setting that),
so pagefile looks to be at maximum Initial Size.
Set the page file to a fixed size, 2GB is fine. You should check the history of the memory usage, AVSMeter with the -l switch writes this to a log file.
StainlessS
10th August 2014, 22:54
Have set PageFile to 2048MB Initial + Maximum size.
Here output from AvsMeter, (debug version of dll), (Omitted script and chopped out some of the info to reduce size)
[General info]
Log file created with: AVSMeter 1.7.9 (AVS 2.6, x86)
Avisynth version: AviSynth 2.60, build:Sep 18 2013 [17:36:36]
[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
[Performance data]
Frame interval Frames/sec Time/frame(ms) CPU(%) Threads PhysMEM(MB) VirtMEM(MB)
0-9 373.192 2.6796 0 3 253 1565
10-19 420.039 2.3807 0 3 253 1565
20-29 425.693 2.3491 0 3 253 1565
30-39 416.577 2.4005 0 3 253 1565
40-49 418.552 2.3892 68 3 255 1566
50-59 348.012 2.8735 68 3 255 1566
60-69 295.643 3.3825 68 3 255 1566
70-79 160.971 6.2123 43 3 255 1566
80-89 159.546 6.2678 43 3 255 1566
90-99 158.361 6.3147 37 3 255 1566
100-109 159.596 6.2658 37 3 255 1566
110-119 162.394 6.1579 31 3 255 1566
120-129 158.746 6.2994 31 3 255 1566
130-139 204.455 4.8910 42 3 255 1566
140-149 37.161 26.9101 69 3 287 1593
150-159 337.142 2.9661 69 3 287 1593
160-169 276.618 3.6151 69 3 287 1593
170-179 292.703 3.4164 69 3 287 1593
180-189 285.839 3.4985 75 3 311 1617
190-199 68.923 14.5088 80 4 331 1637
200-209 257.481 3.8838 80 4 331 1637
########
######## CUT OUT to reduce space
########
2000-2009 272.221 3.6735 57 4 835 1903
2010-2019 277.849 3.5991 57 4 835 1903
2020-2029 267.810 3.7340 64 4 835 1903
2030-2039 265.859 3.7614 64 4 835 1903
2040-2049 264.852 3.7757 64 4 835 1903
2050-2059 270.135 3.7019 64 4 835 1903
2060-2069 261.860 3.8188 64 4 835 1903
2070-2079 262.265 3.8129 64 4 835 1903
2080-2089 265.525 3.7661 64 4 835 1903
2090-2099 263.897 3.7894 64 4 835 1903
2100-2109 282.374 3.5414 64 4 835 1903
2110-2119 49.950 20.0199 69 4 854 1922
2120-2129 322.979 3.0962 69 4 854 1922
2130-2139 306.025 3.2677 69 4 854 1922
2140-2149 238.213 4.1979 57 4 854 1922
2150-2159 306.457 3.2631 57 4 854 1922
2160-2169 277.489 3.6037 57 4 854 1922
2170-2179 274.537 3.6425 57 4 854 1922
2180-2189 278.374 3.5923 61 4 854 1922
2190-2199 275.472 3.6301 61 4 854 1922
2200-2209 281.842 3.5481 61 4 854 1922
2210-2219 278.458 3.5912 85 4 854 1922
2220-2229 280.080 3.5704 85 4 854 1922
2230-2239 298.780 3.3469 85 4 854 1922
2240-2249 284.759 3.5117 85 4 854 1922
2250-2259 294.351 3.3973 75 4 854 1922
2260-2269 280.542 3.5645 75 4 854 1922
2270-2279 314.364 3.1810 75 4 854 1922
2280-2289 365.056 2.7393 42 4 854 1922
2290-2299 353.589 2.8281 42 4 854 1922
2300-2309 371.106 2.6947 42 4 854 1922
2310-2319 364.423 2.7441 42 4 854 1922
2320-2329 365.019 2.7396 78 4 854 1922
2330-2339 368.205 2.7159 78 4 854 1922
2340-2349 344.291 2.9045 78 4 854 1922
2350-2359 274.910 3.6376 78 4 854 1922
2360-2369 250.485 3.9923 50 4 854 1922
2370-2379 254.663 3.9268 50 4 854 1922
2380-2389 258.605 3.8669 50 4 854 1922
2390-2399 262.306 3.8123 57 4 854 1922
2400-2409 246.372 4.0589 57 4 854 1922
2410-2419 244.742 4.0859 57 4 854 1922
2420-2429 250.401 3.9936 43 4 854 1922
2430-2439 258.856 3.8631 43 4 854 1922
2440-2449 261.932 3.8178 43 4 854 1922
2450-2459 253.473 3.9452 62 4 854 1922
2460-2469 251.527 3.9757 62 4 854 1922
2470-2479 251.959 3.9689 62 4 854 1922
2480-2489 255.291 3.9171 50 4 854 1922
2490-2499 61.901 16.1549 59 4 868 1936
2500-2509 275.153 3.6343 59 4 868 1936
2510-2519 307.270 3.2545 59 4 868 1936
2520-2529 313.323 3.1916 59 4 868 1936
2530-2539 316.358 3.1610 62 4 868 1936
2540-2549 304.669 3.2822 62 4 868 1936
2550-2559 296.977 3.3673 62 4 868 1936
[AVISynth error]
GetFrameBuffer: Returned a VFB with a 0 data pointer!
size=3639680, max=536870912, used=398608928
I think we have run out of memory folks!
EDIT: Actual colorspace is YV12 during ClipClop use, ConvertToYUY2 only at end of script.
Groucho2004
11th August 2014, 00:32
Have set PageFile to 2048MB Initial + Maximum size.
Here output from AvsMeter, (debug version of dll), (Omitted script and chopped out some of the info to reduce size)
I don't know why Windows swaps out pages before the physical memory is exhausted. I've seen that before, I think it was actually you who reported it in a different context.
Either way, be it physical or virtual memory, you're hitting the 2GB mark and Avisynth throws the usual error.
The odd thing is that it ran through on a second run (if I understood your post #55 correctly).
StainlessS
11th August 2014, 01:09
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.
StainlessS
11th August 2014, 12:05
@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 (http://forum.doom9.org/showpost.php?p=1689443&postcount=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
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 :)
StainlessS
11th August 2014, 16:04
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
[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.
Jenyok
11th August 2014, 18:04
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.
.
StainlessS
11th August 2014, 19:28
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.
StainlessS
13th August 2014, 12:58
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.
StainlessS
17th August 2014, 22:01
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):
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
####
####
Jenyok
19th August 2014, 09:11
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.
.
StainlessS
19th August 2014, 17:52
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. :)
fvisagie
11th December 2014, 09:44
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? ;)
StainlessS
11th December 2014, 16:34
@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.
fvisagie
11th December 2014, 20:06
Thanks. Not to worry on my account, though, I'll find another approach in the meantime.
StainlessS
18th October 2015, 22:53
DB_SpliceClip.avs, part 1 of two (too big)
# ############
# 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, :- https://forum.doom9.org/showthread.php?t=172837
StainlessS
18th October 2015, 22:54
DB_SpliceClip.avs, part 2 of 2 (too big)
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
""")
}
StainlessS
18th October 2015, 22:54
DB_AppendFileName.Avs
# ############
# 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
""")
}
StainlessS
18th October 2015, 22:55
DB_FindTrim.avs
# ############
# 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
}
StainlessS
18th October 2015, 22:57
Use new TWriteAVI from here https://forum.doom9.org/showthread.php?t=172837
1_MakeTestClips.avs
# 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")
StainlessS
18th October 2015, 22:58
2_SpliceClips.avs (The actual joining script)
# 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")
StainlessS
18th October 2015, 23:00
4_ShowMovieDB.avs
# 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).
StainlessS
19th October 2015, 00:27
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",
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",
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",
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)
Global GLB_SPLICE_WIDTH = 640
Global GLB_SPLICE_HEIGHT = 480
MakeDemo.avs
# 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
# 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:-
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.
StainlessS
22nd October 2015, 18:07
Using TWiteAVI update posted here (currently for v2.6 only):- LINK REMOVED, see next post
Can use two above posted demos with all valid colourspaces with exception of YV411, and all valid Audio Formats incl 32 bit IEEE Float,
7.1 surround.
EDIT: Audio ALWAYS written as lossless PCM or IEEE Float.
StainlessS
31st October 2015, 20:39
Demo scripts from post #73 to post 80 Updated for current TWriteAVI.
current v2.6 dll only, here (bottom of 1st post): LINK REMOVED
scripts in posts 73 to 80 zipped here: LINK REMOVED
DEMO2 requires files "File_000001.AVI", "File_000002.AVI", "File_000003.AVI" in AVS folder (not supplied).
See new thread here:- http://forum.doom9.org/showthread.php?t=172837
The Splicing demos come in zip.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.