View Full Version : Avisynth multipass cache.
Zep
1st February 2007, 23:13
The calculation seems pretty easy. It could be implemented as a Toolbox that could give you these stats.
this is really great stuff thanks for it!
I was wondering though if you ever thought about doing something like this for video?
Example: I want to do a 2 pass Xivd or 2 pass x264 encode There are a ton of slow filters and resize and decimation in the script. Well it would be really nice if at the end of the script I use for pass 1 there was something like
VideoOut()
Which could write out a fast LOSSLESS file for use in pass 2 (of course the video data is as always passed on to VDub or whatever for processing to get the video.pass file) this would save a TON of time on pass 2 since you are using the filtered/resized/decimated/etc... file that VideoOut() made on pass 1 as the source input for pass 2.
This would eliminate the need to rerun all those slow filters and functions. In my head i see a dialog that pops up and lets you select one of the fast lossless codecs and a hard drive/location to save this file which you get to enter a name of the file also. (simple "browse... button would be great)
I run some very CPU eater filters and it sucks having to run them again on pass 2 and the fastest Lossless codecs can easily write out in real time and faster so you should gain a lot more than lose by adding this feature. yes for those that do basically no filtering odds are it would be a wash but most of us would see a nice gain since pass 1 would be a little slower but pass 2 would be A LOT FASTER :D
thoughts?
foxyshadis
1st February 2007, 23:35
Well, MeGUI does have a pre-render checkbox. You can also do that manually by loading the script into vdub, choosing your lossless codec, saving, and then adding a line like Avisource("lossless.avi").
So that you don't have to modify the script, it wouldn't be too hard to add a wrapper function, called like AviPrerenderSource("lossless.avi") after your main script, as long as you remember to save it with the right name:
function AviPrerenderSource(clip c, string s) {
try {
Avisource(s)
}
catch {
c
}
}
squid_80
2nd February 2007, 14:32
I was wondering though if you ever thought about doing something like this for video?
Example: I want to do a 2 pass Xivd or 2 pass x264 encode There are a ton of slow filters and resize and decimation in the script. Well it would be really nice if at the end of the script I use for pass 1 there was something like
VideoOut()
Which could write out a fast LOSSLESS file for use in pass 2 (of course the video data is as always passed on to VDub or whatever for processing to get the video.pass file) this would save a TON of time on pass 2 since you are using the filtered/resized/decimated/etc... file that VideoOut() made on pass 1 as the source input for pass 2.
This is a good idea (if off-topic for this thread), I've done this a few times using graphedit and the infinite tee (don't forget to turn off the Use Clock option!). I wonder if it could be done somehow with TCPDeliver?
Zep
5th February 2007, 11:31
This is a good idea (if off-topic for this thread), I've done this a few times using graphedit and the infinite tee (don't forget to turn off the Use Clock option!). I wonder if it could be done somehow with TCPDeliver?
can you give and example in a little more detail how you did it?
(i have not messed with graphedit much at all so...)
thanks! :)
Zep
5th February 2007, 11:41
You can also do that manually by loading the script into vdub, choosing your lossless codec, saving, and then adding a line like Avisource("lossless.avi").
assuming i understand you correctly that means 3 passes.
1 with the filters and then the normal 2 pass run but using
the lossless avi. That i have done and i'm trying to avoid that :)
tritical
5th February 2007, 16:23
I wrote a filter called twriteavi a good while ago that I think will do what you want. See here: http://forum.doom9.org/showthread.php?p=621067#post621067. You can have it create a lossless file while running the first pass for a codec at the same time. Warning: it was never tested that thoroughly.
squid_80
5th February 2007, 18:31
That's very nice! Going to make one small mod though - keep track of what frames have been written and only write each frame once. It won't help if the frames are accessed out of order but it will stop extra frames being added to the end (which make certain encoders complain). Probably wouldn't be too hard to turn it into IanB's disk based cache idea either (as long as keyframe only codecs were used), but I think you'd have to give up using the avi file structure for that and use a custom binary format.
(Oh, just thought of a simple fix for the out of order problem - have the filter write the avi file and an index file which matches frame numbers of the avi to frame numbers of the source.)
sh0dan
6th February 2007, 17:11
I do find this an interesting project. And using parts of TCPDeliver for fast and simple compression could be quite efficient.
I have a ton of ideas, but until SoundOut is a bit more finalized, I'll let it wait.
hanfrunz
8th February 2007, 19:54
That's very nice! Going to make one small mod though - keep track of what frames have been written and only write each frame once.
Maybe it would make sense to write single bitmaps instead of a big file. So you can very easily check if a frame was rendered. And you could use the files on a differnt computer as well if you put them in a shared network folder...
Zep
10th February 2007, 03:02
I wrote a filter called twriteavi a good while ago that I think will do what you want. See here: http://forum.doom9.org/showthread.php?p=621067#post621067. You can have it create a lossless file while running the first pass for a codec at the same time. Warning: it was never tested that thoroughly.
thanks i will give it a look see :)
Zep
10th February 2007, 03:05
I do find this an interesting project. And using parts of TCPDeliver for fast and simple compression could be quite efficient.
I have a ton of ideas, but until SoundOut is a bit more finalized, I'll let it wait.
Well i will be more than happy to beta test that! :D
squid_80
14th February 2007, 12:24
(Oh, just thought of a simple fix for the out of order problem - have the filter write the avi file and an index file which matches frame numbers of the avi to frame numbers of the source.)
I uploaded my mods (with source): http://members.optusnet.com.au/squid_80/twriteavi.zip. Now it only writes each frame once, and there's an optional string parameter called idxname for a filename to write an index file to, compatible with stickboy's remapframes plugin.
Zep
14th February 2007, 14:53
I uploaded my mods (with source): http://members.optusnet.com.au/squid_80/twriteavi.zip. Now it only writes each frame once, and there's an optional string parameter called idxname for a filename to write an index file to, compatible with stickboy's remapframes plugin.
i can't get it load. using 2.6 alpha :(
if i try a loadplugin("D:\twriteavi.dll") it errors with "unable to load"
if i stick it in the plugin folder i then get a "There is no function named twriteavi"
tritical's original version works fine
Zep
14th February 2007, 16:13
I uploaded my mods (with source): http://members.optusnet.com.au/squid_80/twriteavi.zip. Now it only writes each frame once, and there's an optional string parameter called idxname for a filename to write an index file to, compatible with stickboy's remapframes plugin.
feature request :)
can you make it so that whatever codec you last selected
is the default for next time you tun it so that a dialog window
does NOT come up so it is not interactive and you can just run it and walk away :D
maybe have an option dialog=false or something in which
case it would use the last codec you used and not pop up a window etc...
thx!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.