Log in

View Full Version : Is there a limit of maximal number of clips in avs scripts?


belonesox
20th October 2010, 21:05
Consider simple avisynth script


global all=false

function add(string fname){
video = AVISource(fname)
global all=IsClip(all)? all+video : video
}

add("clip.avi")
add("clip.avi")
add("clip.avi")


...repeat "add" hungred times...


add("clip.avi")
add("clip.avi")
add("clip.avi")

return all


If "add" encountered more than 76 times, I receive
"Avisynth open failure: AVISource: couldn't locate a decompressor for fourcc"

Small sample attached.

Is it bug or feature?

Thanks all in advance,
Sincerely, Stas Fomin

IanB
20th October 2010, 22:03
Yes there is a limit to the number of Vfw instance you can have in a 32 bit process. In your case it appears to be 76, others have struck out at a much lower number. :(

belonesox
21st October 2010, 00:16
Yes there is a limit to the number of Vfw instance you can have in a 32 bit process. In your case it appears to be 76, others have struck out at a much lower number. :(
Which limit? (32? 64? 128? 65355? How I can know it?)
Is it possible to increase it?

IanB
21st October 2010, 01:31
Each AviSource() statement creates a Vfw instance. Each instance uses up some process level windows resources which are apparently limited. Depending on how many resources other parts of the process use determines how many AviSource statements you can actually have. Getting 76 is quite good, most people get less.

Sorry it cannot be easily increased.

You can try different source statements to open your input files.

DirectShowSource usually encounters a similar limit but at a lower number.

StainlessS
21st October 2010, 01:31
Which limit? (32? 64? 128? 65355? How I can know it?)
Is it possible to increase it?

"Which limit", as IanB said, "76" in your case.

I'm guessing that it is dependent on things like codecs used and
OS, service Pack / Hotfixes applied to your system (perhaps also memory).
EDIT:- There are probably settings that could be hacked in the registry
to achieve a greater usable number of VFW instances, however, I would
not know what they are and it may impact system performance in other
areas that may not be desirable.

"Is it possible to increase it?", Probably not deliberately, also,
think Mr B would have said if were possible.

If your files are consecutively named, perhaps you could use
VirtualDub in "Direct Stream Copy" mode to join in several goes, eg
in folder "PART1" have "Movie_001.AVI" to "Movie_049.AVI"
in folder "PART2" have "Movie_050.AVI" to "Movie_099.AVI"

And In VirtualDub load the first clip, then select "File/Append
AVI Segment" and tick the "Auto Detect Additional Segments by Filename"
box at the bottom of the file selector dialog box.
Then, Select "Video/Direct Stream Copy" and then save.

You can then do same with the movies 50-99 etc.

They will though all need to use the same codec for that to work.

After that, join all parts together in Avisynth.

Good luck :)

Zarxrax
21st October 2010, 01:43
A funny thing about this limit. If you get to the very maximum number of allowed clips, if you open virtualdub and try to choose a codec to compress with, none will be available :p

Also, when my friend was trying to encode with near the maximum allowed clips, his script kept crashing, until he lowered it significantly.

Robert Martens
21st October 2010, 04:09
Each instance uses up some process level windows resources which are apparently limited.

I'm guessing that it is dependent on things like codecs used and
OS, service Pack / Hotfixes applied to your system (perhaps also memory).

I'm no developer, and most of the material goes right over my head, but Mark Russinovich has a fascinating set of posts ("Pushing the Limits of Windows") over on his blog (http://blogs.technet.com/b/markrussinovich/) that I believe covers this kind of thing.

I imagine you can skip straight to "Processes and Threads (http://blogs.technet.com/b/markrussinovich/archive/2009/07/08/3261309.aspx)" if you're familiar with the subject, but the recommendation seems to be to start with the first installment, "Physical Memory (http://blogs.technet.com/b/markrussinovich/archive/2008/07/21/3092070.aspx)".

I don't know if any of it is directly related to what's going on here, but it seems like the series might prove interesting for people who want to dig into the details of this stuff.

gyth
31st March 2012, 15:58
Since the files are being accessed serially it shouldn't be necessary to have them all open at once.
A custom source that took a list of files+framecounts might be able to serve frames from all of them while only needing to keep one open at once.
Has anyone done anything like that?