QC - play movie clips at random intervals

weevil's picture

Hello! I'm working on a screensaver (yeah, really) in QC, and I'm having a difficult time with timing.

I have a few movie clips running into a multiplexer. What I'd like to do is wait a random interval with nothing playing, then trigger one of the clips randomly, and keep doing that.

I've been fumbling with integrators and LFO's and random patches and I finally have to admit that I don't know how to do it. Beyond just flipping the index at a random time, I also have to reset and play the movies, I don't want to flip between them with them already playing.

I also can't use any custom patches because it's a screensaver.

I hope someone can help!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

gtoledo3's picture
Re: QC - play movie clips at random intervals

Maybe you could setup two movie players to two different billboards to start and multiplex into the file paths to load different clips. Maybe a random, interpolation, LFO, range + patch time or system time...possibly using any of those in combo with some math op...and could control the index of a multiplexer that holds file path locations? Keep in mind you can control variability of a random patch with the settings panel, if you haven’t run across that already.

You could mess with blend modes and color of the billboards to do dissolves and various effects.

Another approach might be to try using just one billboard, and hook the output of both movie players into something like the composite blend mode patch. Or dissolve, or similar. If you go that route you may have to mess around with resizing/crop in images when the movies don’t match pixel height/width.

And of course you could get way more nuanced about it from there.

Good luck!

weevil's picture
Re: QC - play movie clips at random intervals

Thanks for the suggestions! This might be more elaborate than what I'm looking for though. I don't need any crossfading or blends. I just want to pick a random movie from the multiplexer, play it to completion, then wait 4 to 10 seconds and play another random movie. In other environments I know this would be pretty easy since I'd have an iEnumerator with wait() or some other kind of waiting function that I could feed a random value, but I am totally stumped here. I'm not super handy with javascript but maybe this could be done as a javascript patch?

Achim Breidenbach's picture
Re: QC - play movie clips at random intervals

Did you take a look at the "Watcher" patch? You can connect the index value for your movie to it and it will send out a pulse whenever it changes. Use this pulse for a Stop Watch patch to reset the stop watch. Reverse the signal and connect it to the "Start" of the Stop Watch. Switch the Movie Importers timebase from "Parent" to "Local" (right click on the patch to get a popup menu where you can change those settings). The Stop Watch output can now control the Movie Importers Time (which is the playback time of the movie), so the movie will start from the beginning (I hope :-) )

weevil's picture
Re: QC - play movie clips at random intervals

ohh! This might be the way to do it... I'll experiment and report back.

weevil's picture
Re: QC - play movie clips at random intervals

Sorry, I thought I understand what you meant, but I think I am getting lost at reversing the signal?

PreviewAttachmentSize
000.qtz30.47 KB

Achim Breidenbach's picture
Re: QC - play movie clips at random intervals

Reversion means: plug the bool signal into a Logic patch (Important: top input) and set this patch to do a "NOT". This will output a "1" if you input a "0" and vis versa. When ever the Watcher signals a change for the movie index it will output a "1" which you need to connect to the "Reset" of the Stop Watch. the reversed "0" should be connected to the "Start" input of the Stop Watch. So if the Watcher drops to "0" then the NOT turns it to a "1" and this will start the Stop Watch again.

weevil's picture
Re: QC - play movie clips at random intervals

No luck dealing with the stop watch.

Movie importers don't accept a play position value, even in local/async mode. They do have a reset button though.

Even if this did work, it wouldn't have helped with the random pause between movie plays.

I have been able to restart a non-looping movie with the number watcher and a logic patch, but when I try to cycle through the multiplexer index I have all sorts of problems.

I switched from multiple movie importers to one with a multiplexer for the file urls, which seems to help a little.

PreviewAttachmentSize
000.qtz32.35 KB

Achim Breidenbach's picture
Re: QC - play movie clips at random intervals

You have too much recursion going on in your composition. You can get rid of one by using a math patch to get to an useful index.

However I added a state machine to your composition that depends on the knowledge of the length of each movie. You need to put in the length in the "duration" input splitters. Also a min time gap and max time gap between each movie can be specified. The state machine calculates a patch time when to start the next movie based on those values and then waits for a duration to start all over. There is only one recursion in the composition. I hope this helps.

Maybe you need to switch the "Patch Time" patch to a "System Time" patch because in the Screensaver environment I don't know if the Patch Time is actually progressing. Something in my mind says there was a problem with it.

PreviewAttachmentSize
000_1 (Achim).qtz38.1 KB

weevil's picture
Re: QC - play movie clips at random intervals

I spent some time studying this today and I actually learned a ton of new QC stuff from it! Thank you so much!

Unfortunately it looks like maybe Mojave finally killed Quartz Composer screensavers. This is such a drag. They worked in High Sierra, but I just updated and now it floats a "You cannot use the (screensaver name) screen saver with this version of macOS. Please contact the vendor to get a newer version of this screen saver".

Right, Apple. Because you have another publicly available easy to use screensaver making tool. Oh, I know, I'll write one in friggin' Xcode.

Blah.

weevil's picture
Re: QC - play movie clips at random intervals

Trying to learn about the ScreenSaver.framework in Xcode now, and also looking into the possibility of making an electron app that could make mac and pc screensavers, but it's kind of uncharted territory, it seems. Pray for me :)