Reducing jitter lag and CPU drain.
I'm working on a patch in which a jit.qt.movie object is told which frame to display by a variable signal. I'm using the "frame" message to jump to the desired frame, which is followed by a bang to output the matrix to a window. The frame message is constantly being set but only delivered at a variable interval. This seems to be incredibly processor hungry and is very laggy with (reasonably) high quality videos that seem to play fine otherwise, even at intervals of 100 milliseconds (10 fps). Although, It works fine with low quality videos. Is this simply too much to ask of my i5 6GB laptop? or is there an alternative method that would be smoother, perhaps using openGL? Ideally I would be skipping through frames at 20 fps and above on HD videos, but this seems unrealistic.
Also, what file type should I be using for optimum performance in this context?
Thanks.
Try searching for Vade's fantastic jitter optimization patches. Great examples. should help! The biggest things to know for your sake (I think) with be instantiating your jit.qt.movie with @colormode uyvy and @unique 1.
Hope this helps!
What you describe should work fine with HD video. Perhaps your 'frame' messages are coming too frequently? Why send them more often than you need them? You could hold onto the frame number in an 'int' object, and then deliver the 'frame' message only when you plan to display that frame. Might help.
Vade mentions this, but it bears repeating: Pay attention to the compression format in your movie. Modern distribution formats like MP4 & H.264 use keyframes, so there is a lot of math involved when you jump to an arbitrary frame. Formats like Apple ProRes, Apple Intermediate Codec, or the old standby Photo JPEG will work much better (but they take up more space and require faster hard-drive performance).
Just to reinforce what zlp said!
If the playback is non-linear, you should really be using video codecs that only employ spatial compression strategies. The majority of "final delivery" codecs (web, DVD, Blu-Ray) use spatial AND temporal compression.
Working with movie-jpeg has increased the speed dramatically, it seems temporal compression was the culprit. Thanks to all!