Trying to export a video file and automatically open it and play it back

johnbackstrom's icon

Hi, I'm trying to set up a patch that will export a 1 second, 0-keyframe video clip from a webcam, and then open that file and play it back, and continue doing this process indefinitely. I can't get the write.grabfile.mov command to work with more parameters than just the default, such as kframe amounts, and I'm also trying to figure out what the best codec would be to use for this.

Attached is my patch so far. This is the first thing I've ever done in Jitter/Max/MSP

449.Picture_213.png
png
Rob Ramirez's icon

few things.
first, when asking questions of the forum, please post the actual patch code, not an image:
https://cycling74.com/forums/common-max-arcana

second, if your intention is to record a buffer of video and then process that buffer in your patch, you are probably better off using the jit.matrixset object, instead of trying to write to disk, and immediately read from disk.
search the forum, tutorials, help file, and jitter-examples for information on how to use jit.matrixset.

lastly, the best quicktime codecs for jitter are usually photo-jpeg, apple intermediate, or animation (if you need an alpha channel).

johnbackstrom's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Thanks for the info! Here's my patch-

reading about jit.matrixset, it seems like it might work, but can you control the amount of keyframes the video has when using exportmovie?

Rob Ramirez's icon

i'm not really sure what this kframe message is all about. according to the help file, it's not supported.

what are you trying to achieve?

johnbackstrom's icon

I'm trying to "data-mosh" live footage from a camera in as close to real time as possible. The abstract pixellated effect is a result of dropped keyframes.

Andrew Benson's icon

Proper "datamoshing" involves a number of fairly process intensive steps (encoding to DivX, removing I frames, and then saving/reading), which doesn't really lend itself to realtime work. Even if you were to get something writing and reading properly, your framerates would probably not be anywhere near realtime. Also, you probably wouldn't be able to get what you really want out of the standard Jitter objects, since they are built on Quicktime, which is a bit too smart for "data-moshing". It's possible that someone could build a third-party movie player object that did the job, but the frame calculations required to play back a temporally compressed movie without keyframes will likely grind your patch to a halt in short order.
Another approach might be to think about what specific aesthetic aspects of data-moshing you are attracted to and consider ways to replicate that using realtime-friendly processes.

johnbackstrom's icon

I'm pretty familiar with the data-moshing process, but yeah I'm kinda realizing that utilizing compression as part of this process won't really work, so I am now experimenting with other methods of distorting the image in a somewhat reflexive way. Thanks again for the feedback