jit.movie dynamic frame control / frame counting
Hello all,
Getting jit.movie to output a specific frame is simple enough, this patch seems to work well. My question is this: how can I dynamically cycle through each frame, one at a time, looping back to the first frame after the last frame has been output. I need it to work dynamically, i.e. I won't know how many frames are in the video until it is read in. Any ideas?
Thanks,
Devin
Ok, so I spoke too soon. I can’t even get frames to consistently output from the jit.movie object. Currently, this patch is working horribly, I only get frames output every once in a while. Does it work any better for you? I’m currently using an arbitrary value of 600 frames - I’m hoping there’s a way to dynamically generate this from the loaded movie?
Thanks,
Devin
Update: I got this version of the patch to work rather well. I am able to sequentially cycle through each frame of my video. The counter maximum parameter is still being set arbitrarily (3). If my patch could count the number of frames of a loaded video file, I should be able to easily adjust the counter object dynamically. Getting close!
Still haven't got the dynamic frame counting working - but I did manage to get a 2 matrix jit.xfade working. My question now is how to get the crossfading smoother. It's quite jumpy. I've set my line grain and qmetro from 5ms to 50ms, but not any real change in smoothness. Any ideas?
Thanks in advance for enduring this shifting thread and any help you can offer.
Simplify. No need for loops, gates, delays, etc. Just get the framecount, then count from frame 0 to one less than the framecount. Note that the movie should be stopped; you just go to the desired frame, and output it.
In this example, when the patch is opened, the movie is read in, thanks to loadmess. When the movie is read, the 'read' message comes out the right outlet of jit.movie. If the read was successful, it will trigger 'getframecount' to get the framecount and subtract 1 from that and use it to set the maximum of the counter. All set. Click on the toggle to start your slideshow.
Hi Christopher - thanks!! your frame count reading setup worked. :)
Actually, the delays and gate is working to allow jit.xfade to crossfade between the previous frame's matrix data and the new frame's matrix data.
I’m still hoping to get smoother crossfading between matrices - any ideas?
To do a video crossfade, you need two video sources. Whenever you want to go to a new source, fade from the previous source to the new source. Of course, the next time you want to fade to a new source, you have to use what was previously considered the "new" source as the "previous" source. There are various ways you can do that. You could have two jit.movie objects, and alternate which of them you fade to. Or, for still images, as in this example, you can keep track of the most recent output (we'll call that the "previous" image), then whenever you want to fade to something new, stash that previous image in the right inlet of jit.xfade, set the xfade value to 1 (to show that previous image), start sending the new image into the left inlet of jit.xfade, and start fading from 1 to 0 (right inlet to left inlet, i.e. previous to new).
[For additional examples, see the examples called "Crossfade between two videos" and "Slideshow of images, with crossfade" on this page.]
Christopher - did you see my patch above? I already have crossfading working. My issue is the smoothness of the crossfading.
I don't have time to debug your patch, but it appears you may be changing the "prev" matrix (the matrix going into the right inlet of jit.xfade) while crossfading. You want to keep the matrix in the right inlet of jit.fade the same while you're doing the crossfade.
In my last patch, the matrices aren't changing while the crossfade is occurring. The matrices change, which triggers the crossfade (ramp generated with Line). When the crossfade is complete, the cycle repeats. I'm talking about the smoothness of the fade itself - it's somewhat quantized or stair-stepped. Anyone else seeing the quantized crossfade in my patch?
Thanks,
Devin
drive all rendering and movie output from a single qmetro object set to your desired framerate (e.g. qmetro @hz 30 for 30 FPS).
use bline for animation, banged by the same qmetro. the timing arg for bline is in frames, rather than ms, so you would send 30 for a 1 second transition at 30 fps.
Hi Rob,
Removing the second qmetro and changing the line object to bline did nothing to smooth out the crossfade. Also, I'm not playing back video at normal rates - I am displaying one frame at a time - eventually in sync with Live's master clock/tempo as a Max for Live plugin.
Changing my jit.matrix objects to float32 fixed the jit.xfade issues - I'm now getting smooth crossfades!