Jaded-Encoding-Thaumaturgy / vs-preview

Previewer for VapourSynth scripts.
Apache License 2.0
57 stars 16 forks source link

vspreview caches frames even though no cacheing was requested #117

Closed jsaowji closed 8 months ago

jsaowji commented 9 months ago

It still request new frames everytime but does still display old contents.

I think the problem is that all intermediate nodes need setvideocache 0 too. And it only request the frames again because of final setprops call here maybe ?? https://github.com/Irrational-Encoding-Wizardry/vs-preview/blob/c1d496a2057ae32867ba1eadcd670259b888a0d7/vspreview/core/types/video.py#L121

repro example

from vstools import core
from time import time
import functools
b = time()

def evaly(n,f,tt):
    f2 = f.copy()
    ll = time() - tt
    print(n, ll)
    f2.props["time"] = ll
    return f2

a = core.std.BlankClip()

a = core.std.ModifyFrame(a,[a],functools.partial(evaly,tt=b))
core.std.SetVideoCache(a,0)
a = a.text.FrameProps()
core.std.SetVideoCache(a,0)

a.set_output(0)

#does not do antything
#from vspreview import set_output
#set_output(a,cache=False)

This seems to fix it, always displaying a updated frame every time. But i dont know if you need to litter that call around more.

diff --git a/vspreview/core/types/video.py b/vspreview/core/types/video.py
index f3e2acf..bb6845a 100644
--- a/vspreview/core/types/video.py
+++ b/vspreview/core/types/video.py
@@ -289,6 +289,9 @@ class VideoOutput(AbstractYAMLObject):

         clip = clip.resize.Bicubic(**resizer_kwargs)

+        if not self.cached:
+            vs.core.std.SetVideoCache(clip, 0)
+
         if is_alpha:
             return clip
Setsugennoao commented 8 months ago

Fixed in https://github.com/Irrational-Encoding-Wizardry/vs-preview/commit/c9b0bda3654d2f6419595802dd6816d95598ab5b