Scrubbing movie: freeze using position message
Hi there, hoping for Rob support, but whoever help is appreciated.
I'm trying to scrub some videos (while they are being played back) in hap codec .mov using the position message, whit jit.movie @output_texture 1 @autostart 0, but I'm encountering two issues, which have variations depending on the file I'm using (some default .mp4 or my hap file).
I'm attaching wetransfer link to one of the hap files I'm experimenting with https://we.tl/t-KjxRZCNCHj
Scrubbing at 500ms speed, I get two different behaviors depending on the file I'm using. With default mp4 (chickens.mp4) it seems that at the moment of the jump, I'm seeing other frames of the video, giving it a glitchy taste, instead of a clean jump. With my hap codec file, at each jump the playback is freezed for a short time (maybe 100-200ms) before restarting. You can see the framecount number sobbing.
Scrubbing at 50ms speed, both with chickens and my file i get 3-7sec freeze once every 10-20 seconds, while if using bubbles.mov it goes steadily. (if there are some glitchy inaccuracy as mentioned before in the first issue... who knows ; ) ).
Here goes the patch!! Have a nice day!
Oh sorry, using latest version of Max, on Mojave mac pro 2018, if this helps
i can't reproduce any stalls using the hap file you linked, and stalling when attempting random access with h264 encoded files is entirely unsurprising. but it entirely depends on your machine specs, harddrive specs, and what else you have going on in your patch and cpu/gpu.
you may get better performance by switching the metro to a qmetro, or better yet syncing the random frame trigger to the drawbang outlet from jit.world (middle out), and controlling the speed via counter, e.g. [ jit.world (middle outlet)] -> [ counter 0 0 1 ] -> [ sel 0 ] -> [ random 1000 ]. you then control the "speed" by increasing the max value of the counter (e.g. once every other frame, once every 3 frames, etc).
another alternative is to use viddll engine, set your cache_size way up, and use the loadram message to load the entire file into memory (i was able to get the linked file into memory with cache_size 4 )
Thank you Rob for the attention.
Your suggestions are nice ones, I managed to figure out that the stalling was caused by the playback of the file using the play command of jit.movie, while if the file ain't playing, scrubbing goes fine.
So I managed to get both scrubbing and playback to work bypassing the play command and using instead a jit.time calibrated on the file lenght, adding random offset to it for scrubbing, and warping with pong to remain in the 0-1 range of the position message.
Here is the patch in case anyone needs it.
Cya : )