Log in

View Full Version : dealing with huge scripts


thom_b
19th May 2011, 13:50
Hi there,

I use the scriptlanguage of my 3d program to automatically create avisynth scripts, that are able to edit together ANY video it randomly finds in a database. the cuts usually are very fast and a lot of clips are used, so there are some problems:

1. is there a way to see the avisynth progress while it's loading in virtual dub? It can take quite some time.

2. sometimes i run into memory issues, the "access violation" error appears or virtual dub crashes, even though i have 6 gigs of ram on a win7 64bit system.

This is how my scripts look like:

video = ResampleAudio(Trim(directShowSource("test1.0001.avi",fps=25).BilinearResizeBars(1024,576).convert_to_stereo(),0,15),48000)
video = video+ResampleAudio(Trim(directShowSource("anothervid.avi",fps=25).BilinearResizeBars(1024,576).convert_to_stereo(),0,15),48000)
[... a lot of vids ...]
video

convert_to_stereo and BilinearResizeBars are custom functions (the first i wrote to make a clip stereo no matter what and the second I found on the net and it resizes while keeping the aspect ratio).

Maybe somebody knows a more efficient way to do this? Is avisource (+ fps filter) perhaps better than directshowsource? Is there an easier way to conform clips befor adding them?

Thanks!!

Didée
19th May 2011, 15:02
Your biggest problem is that the number of different video-source-filters is limited. The problem has been discussed a few times in the past, and I'm not the best one to explain the reasons ... it's not solely an Avisynth problem, basically it's a ressource problem of the Windows operating system (not RAM, but stacks and things and whatnotelse), and Avisynth does not offer sufficient workarounds.

There's also no hard rule how much sourcefilter calls can be used in a script. Some users might be able to use 40 or 50 sourcefilter calls before the crashing occurs, others might not even reach 20 sourcefilter calls.

Zarxrax
19th May 2011, 15:56
I wonder if FFvideosource has such limits?

thom_b
19th May 2011, 16:42
Your biggest problem is that the number of different video-source-filters is limited. The problem has been discussed a few times in the past, and I'm not the best one to explain the reasons ... it's not solely an Avisynth problem, basically it's a ressource problem of the Windows operating system (not RAM, but stacks and things and whatnotelse), and Avisynth does not offer sufficient workarounds.

There's also no hard rule how much sourcefilter calls can be used in a script. Some users might be able to use 40 or 50 sourcefilter calls before the crashing occurs, others might not even reach 20 sourcefilter calls.

Thanks for the answer!

It seems the only way around this is by splitting the clip. To still have a one-button-solution I rewrote my (meta)script to generate separate avs files every 10 videos and then, at the end, automatically generate a virtual dub script job that renders and joins them. Seems to work fine to a certain point, but virtualdub just becomes so damn unstable and crashes alot during rendering!!! What could the reason for that be? (it has nothing to do with the job list i think, because manually loading also leads into this problem after a certain time)

Here is the virtual dub script I use (and append for each avs script)

// $job "Job %jobnum%"
// $input "%input%"
// $output "%output%"
// $state 0
// $start_time 0 0
// $end_time 0 0
// $script

VirtualDub.Open("%input%","",0);
VirtualDub.audio.SetSource(1);
VirtualDub.audio.SetMode(0);
VirtualDub.audio.SetInterleave(1,500,1,0,0);
VirtualDub.audio.SetClipMode(1,1);
VirtualDub.audio.SetConversion(0,0,0,0,0);
VirtualDub.audio.SetVolume();
VirtualDub.audio.SetCompression();
VirtualDub.audio.EnableFilterGraph(0);
VirtualDub.video.SetInputFormat(0);
VirtualDub.video.SetOutputFormat(7);
VirtualDub.video.SetMode(3);
VirtualDub.video.SetFrameRate(0,1);
VirtualDub.video.SetIVTC(0,0,-1,0);
VirtualDub.video.SetRange(0,0);
VirtualDub.video.SetCompression(0x64697678,0,10000,0);
VirtualDub.video.filters.Clear();
VirtualDub.audio.filters.Clear();
VirtualDub.subset.Clear();
VirtualDub.subset.Delete();
VirtualDub.project.ClearTextInfo();
VirtualDub.SaveAVI("%output%");
VirtualDub.audio.SetSource(1);
VirtualDub.Close();

// $endjob
//--------------------------------------------------



But it does seem to work in general - there is no special crashing moment... :-(

Or maybe because avisynth is 32 bit and my system 64? arrg.

thom_b
19th May 2011, 17:28
I just realized directShowSource is the problem. I switched to avisource and everything faster and more or less stable (only occasional crashes). Unfortunately i need more formats, so I'll start trying the other import plugins, but hints would be appreciated.