Log in

View Full Version : Seeking backwards: any way to make faster?


AlanHK
21st July 2010, 14:02
When editing a script in AvsP, or playing it in VDub, it's noticeable that going back more than a very few frames causes a big delay.

Presumably Avisynth caches a small number of frames and once it goes beyond that it has to reseek from a known point, maybe even the beginning.

Is there any way to make Avisynth cache more frames so editing (setting Trims, joins and other transition points) isn't so frustrating? I don't care how inefficient this is as I would disable it when running the script in an encode.

Guest
21st July 2010, 15:23
Have you tried SetMemoryMax()?

Also, remove all non-used loadplugin calls and avsi's and empty your plugins directory.

IanB is the guy to answer this definitively.

sh0dan
21st July 2010, 15:40
Backwards seeking is mainly slow, because decoders cannot seek backwards, if you are using a format that isn't all keyframes. There are several scenarios:

* Keyframe in source at at frame 0. You skip to frame 250, the decoder silently decodes all frames from frame 0 to 249. You skip back to frame 249, and the decoder has to decode all frames from frame 0 to 248 before it can be shown.

* You play from frame 0 to frame 249. When you play it back, the decoder hands all frames to avisynth, which caches all the frames it can hold in memory (determined automatically or by SetMemoryMax). If you skip back to frame 248, avisynth is very likely to have this in cache, and will give this to you fast.

* All keyframe source: The frame you request are decoded (fast).

So your solution is:
* Use a format that is all keyframes.
* Use shorter keyframe intervals.

You may ask why avisynth does always decode all frames - that would unfortunately make ordinary skipping much slower, since the decoder would have to hand all frames to avisynth. The decoders are often able to do skipping faster than actual decoding, since they don't have to prepare and hand the images to avisynth.

Guest
21st July 2010, 15:43
I think he's just asking to keep more played frames in the cache. We all know why seeking is slow.

AlanHK
21st July 2010, 17:53
When you play it back, the decoder hands all frames to avisynth, which caches all the frames it can hold in memory (determined automatically or by SetMemoryMax).


I don't suppose there is any way to see which or even just how many frames are cached at any time?