loading next movie causes a pause

Guilherme Martins's icon

I am building a video player application, and this is the patch where I have the videos being played and crossfaded.

The thing I would like to know if it is possible to solve is, when the next video is loaded, the previous video pauses for less then a second and then the cross fade starts. It is a picky issue but it is hitting my eyes everytime I load a new video.

Any help on this will be very apreciated

Max Patch
Copy patch and select New From Clipboard in Max.

generalh's icon

hello,
loadram and vps tuts from Andrew Benson are your next hours
cheers
hube

Guilherme Martins's icon
g_net55's icon

Andrew Benson is good, but you will have 5-10 double frames
after switching.

still no solution for this problem ....

perhaps someone found a way to switch directly from
one movie to another without hickup od double frames.

the only way i found out is to copy all the clips into
one, save it with the quicktime player and jump into
this single movie.

best
gisela

Guilherme Martins's icon

heelo gisela, thank you for your reply

it is really weird the fact that there is no solution for this, I will continue my research and post the results.. if I found any

seejayjames's icon

yep if you can do it, put them all into one movie and jump frames. totally dead-on instant in my experience---I did hours of testing with a movie that has 400-frame chunks, running alongside precisely-timed audio (bpm 120). Locked perfectly. Changing the audio rate along with the movie rate all the time, no problems at all. (No audio in the movie, it was separate... changing movie rate with audio in the movie can behave strangely, so I had sfplay~ running instead.)

Guilherme Martins's icon

putting them all into one single movie is not an option because I need them to crossfade when I switch to the next movie.

it's odd the fact that sometimes it doesn't do any stops and it is very smooth when switching to the next video, other times it stops a bit, you only notice if you are really focused on the video.

i'm running a MBP 15", 2.8ghz, 4GB ram, Max 5

Guilherme Martins's icon

here is an interesting document about max performance settings:
https://cycling74.com/docs/max5/vignettes/core/scheduler_pane.html

and this post is a must read, I have just started:
https://cycling74.com/forums/most-efficient-way-to-use-jit-qt-movie-opengl

Christopher Dobrian's icon

Without having really tested your patch or having read all the links in this thread, I'll just comment that you might want to try making everything be triggered by the 'read' message that comes out of the right outlet of the jit.qt.movie object when you drag-'n'-drop a new movie file into the dropfile object, rather than by the 'read' message going into the jit.qt.movie object. The amount of time it takes the jit.qt.movie file to read the movie in from the hard drive and begin to play it is "unknowable", so if you wait till it actually tells you it's ready you might get better results.

seejayjames's icon

"putting them all into one single movie is not an option because I need them to crossfade when I switch to the next movie."

You can do a workaround for this using a jit.xfade-with-itself bit. When you send a new frame command for jumping around, it delays it while the xfade gets to maximum (and playback now looks faded from the frame "reverb"), sends the new frame number, then the xfade ramps back down. Tweak the timings to suit. I made the ramps linear but it would work better if it was rounded at the top like an exponential curve, as jit.xfade doesn't seem to work linearly (there's a big difference in the range 0.9 to 0.99 versus 0.0 to 0.09, for example).

Max Patch
Copy patch and select New From Clipboard in Max.

At the very least, the jit.xfade-with-itself is a simple way to get some fun echoey effects in your visuals :)

Guilherme Martins's icon

@seejayjames nice workaround!! pitty it doesn't work with sound, but anyway, it's a really cool effect and I'm sure I will use this is the near future!
Thanks a lot!
My research continues :)

Guilherme Martins's icon

@Christopher Dobrian, I think I can understand what you mean, but I can't figure out the way to do it :

Kurt Ralske's icon

@seejayjames, your jit.xfade-with-itself patch is very clever. Just for the record, thought I'd mention that it does the same job as the Auvi object "au.tween" (http://auvi-software.com)

@visualiz, I think Chris Dobrian means this: when you send a "read" message to jit.qt.movie, it loads the file. When it's completed loading, it sends the message "read xxxx.mov 1" out its right outlet. If you are crossfading, you could delay the start of the crossfade until you are sure that this message appeared out the right outlet. A "route read" object might be useful.

Guilherme Martins's icon

@Kurt, endeed, now I got it, I was being confused by the fact that when a message "read" is sent to the jit.qt.movie it starts the playback automatically. But now I understand that I can turn on the metro just after the video being totally loaded.

seejayjames's icon

thanks! yep I found that little trick way back on the Forums (where else?) and have made some good use of it. Looks very cool for that dream-like effect.

I was thinking about the sound---you could do a similar hack with spigot~ instead of the regular jit.qt.movie volume (set @vol 0.) Grab the audio with spigot~ and split it into two streams, going into different channels of a matrix~. When you jump a frame, gate the audio through tapin~/tapout~ of the right length (so the last audio before frame-jumping has an echo) and then cross-fade that with the new audio. You'd need to tweak the tapin~/tapout~ lengths and amount of feedback to match the frame-jumping transition time, but it should be doable.

Anyway, fun stuff to mess with... as always with Max :)