How do you combine multiple videos into one in texture or shader?

    May 25 2016 | 3:50 pm
    Hi guys,
    How do you combine multiple videos into one in texture or shader like in the example below? So not within a videoplane or anything like that but before that so I can put an effect after it. Any clues?
    Thank you, ygreq

    • May 25 2016 | 3:52 pm
      Or better yet how to you multiply it as many times as you want? 10x10 for example?
    • May 25 2016 | 5:23 pm
      if you want behavior similar to jit.glue, then using jit.glue with matrices prior to turning in to textures is the simplest route.
      otherwise, you can roll up your sleeves with to accomplish this. "sample" and "norm" are the operators to look at. you will need to set the output texture dimensions to whatever you want using a dummy texture in the left most outlet.
      here's a basic example that glues together to video inputs to a single texture:
    • May 25 2016 | 6:26 pm
      Thank you, Rob, but jit.glue is a terrible object. And is a bit like Chinese for me.
      I was trying to create at least a 2x2 grid of 4 videos. I guess I will try to do it using if there are no other possibilies. :(
    • May 25 2016 | 9:24 pm
      Wow. Didn't realize you could do *that*, Rob. Thanks.
    • May 25 2016 | 9:30 pm
      By the way - what's wrong with jit.glue? It's the obvious choice (unless you want to use usesrcdim / usedstdim and their friends srcdimstart, srcdimend, dstdimstart, and dstdimend to write to a named matrix, maybe)....
    • May 25 2016 | 9:36 pm
      I am using jit.grab and doing fx with some shaders so I cann't combine those with jit.glue. And jit.glue is hoggy when it comes to using multiple columns and rows. At least this is what I remember since I last used it intensively a few years ago.
    • May 26 2016 | 2:55 am
      ...and, thanks to Rob's elegant example, here's a solution to the 4-in-1.
      As ever, I am in awe of your skills, Rob. Thanks!
    • May 26 2016 | 3:00 am
      Or just this?
    • May 26 2016 | 3:02 am
      sweeeeeeeet, Christopher! Add a few negative values to the scaling and it's kaleidoscope time!!!!
    • May 26 2016 | 7:26 am
      Thank you, guys, for your help!
      Max, I will try that definitely. Christopher, that is what I was thinking of when I said I would need to add a as there are many things that happen in the main render. Both solutions are great! And thanks again, Rob!
    • Dec 19 2016 | 3:32 am
      Just found this thread and have a question for those in the know. If I wanted to construct a larger grid of videos (16x12 using 6 videos), than the option would be the best route in terms of performance over the other options offered...?
    • Dec 19 2016 | 5:39 pm
      the important thing is to size your video files appropriately (no larger than necessary), and enable output_texture. either technique in this thread will work well for displaying them.
    • Dec 19 2016 | 9:58 pm
      Thanks for that Rob.
      Yes, I have resized my video appropriately. I have constructed this 'video fabric' using the jit.glue route but would say it is not functioning at a performance level that cuts the mustard—particularly when switching videos.
      I think I will roll up my sleeves and give the a try. To date, everything I have constructed in jit.gen has outperformed all other options.
    • Mar 17 2017 | 12:13 am
      Update on the 'video fabric' efforts and additional question.
      To construct a 10x10 grid of video's I ended up using 6 x ( @output_tecture 1 @ texture_name (name) @colormode uyvy) to 100 x ( @texture (name) @transform_reset 2 @automatic 1 @drawto cat) to ( cat @fps 60).
      I have 40 videos that are randomly read into the objects. Up until this past weekend, I had no issues and am loving the results. The ultimate test, however, is if the installation can run all night.
      The issue is, after a few hours of running, I get an error message stating the movie file can not be found when the attempts to read. I have to close the patch and reopen it to reconnect the file pathway. I'm working on a Mac Book Pro and have set the Energy Saver to 'Never' and have clicked the Prevent App Nap in Max. I added a counter during the last test to see how many read messages were successful before the error. 130 x 6.
      I will test again this weekend and perhaps move the movie files to another location but other than that, I can't figure out what might be the issue. I'm stumped. Any thoughts?
    • Mar 20 2017 | 7:30 pm
      sounds like maybe you're relying on the the current working directory path to load your movies. this will change to the location of the most recently loaded file, and so is not reliable if that location changes. you should either look into using absolute file paths for your movie files, or better yet use Projects.
    • Mar 20 2017 | 10:35 pm
      Thanks for the reply Rob,
      This weekend I tested a few methods and ended up with the same issue. I even placed the movies in the media folder where all the Max demo video are located. But no go. After a few hours of running the installation, I get the “can’t find movie file” error. But before that error message, there is always a series of draw begin: GL Error: Invalid value I thought that perhaps the was losing the connection with @output_texture 1 so I set up a periodic bang message to the
      The weird thing is, and this is what confuses me, if I am working on the patch; as in manually triggering buttons etc., this error issue does not occur. I've work a whole day on this patch with no problems. I might give PHIOL's a go to see of that might work better.
      Regards, Teresa
    • Mar 21 2017 | 1:10 am
      try the version of my
      you'll get better results if you save the version as a seperate patch
      I'm getting a solid 60 fps with 20X20 videos (400 instances) and even a good 33 fps with 40X40 videos (1600 instances)
      and my mbp is almost 3 years old nvidia 750m
      of course you need to save it in a folder with all the other abstraction patchers. and again the content (moviefiles) go in the media folder.
      here it is , if anybody ever falls on this thread :-)
    • Mar 21 2017 | 4:47 pm
      teresa, sounds like you might be running out of memory, are you running in 32 or 64 bit? def better to be in 64 if possible.
    • Mar 22 2017 | 9:30 pm
      Hi Rob, Thanks for the reply. I'm running in 64 bit. I stopped doing anything in 32 bit some time ago.
      Hi PHIOL, Thanks A BUNCH for that! I will give it a go.
      My issue was not fps as I was (joyfully) getting a solid 60 fps for the whole during when the installation ran. It's just the patch stopped finding the movies after a few hours. I placed all movies in a Projects folder, then placed them all into the OS Movie folder with a direct search link, and then (going old school) into the Max program media folder. Same thing happened, after running for a few hours the jit.moive kicked out the error message that the movie could not be found, preceded by the ( draw begin: GL Error: Invalid value) error.
      I’ll spend the weekend looking at your patch, and thanks again for that.
    • Mar 23 2017 | 12:31 am
      Hi again Teresa ,
      > I have 40 videos that are randomly read into the objects. >130 x 6
      This is where I believe my patch will help you. All videos are read only once(on startup), then (in my patch setup ) each video texture are called using noise to call @texture attribute. As you can see this occurs directly in the object.
      As common practice, you load everything on startup , then put it to sleep. Then wake it up when needed. This is how thing are done in 3D gl gaming software. If the camera does not see your geos , there are not processed. But still everything is loaded on startup and waiting for a go!
      Here below (objects in blue),
      I make it obvious how to change a single cell's texture
      good luck
    • Mar 23 2017 | 12:46 am
      Thanks for that Phiol,
      Nice patch. It’s very helpful.
      Best, Teresa