Recently there have been quite a few questions on how to optimize quicktime movie playback within Jitter. The question is complex because there are many factors involved with making a decent quicktime movie – compression settings, bit rate considerations, progressive vs interlaced, frame rate and resolution, as well as the Max/MSP/Jitter programming considerations. Jitter can be incredibly simple or deviously complex depending on what you want to do with it.
Ive created a set of 12 patches showcasing *simple, ideal cases* for single channel and dual channel playback, from simple beginner objects, to fully fledged opengl, shader using, uyvy frame synced rendering playback patches – with comments to help explain what the hell is going on. These patches are meant more for beginner and intermediate users who are looking for guidelines than advanced users, most should have migrated to GL anyway (hint hint!).
I hope the patches can be of some use for those looking for answers to get higher performance from Jitter, but by no means are they the end all of the subject.
I ask the users with questions please post to the Max/MSP/Jitter lists where appropriate, rather than post questions here – more users will find the Max lists than my blog.
Some basic guidelines for any programming environment:
- Get it working before you optimize – no need to complicate your life ahead of time
- Clean, commented, organized code is easier to understand, and easier to optimize than messy, uncommented code – especially with graphical patching environments, messy means visually complex, hard to follow patchcoord everywhere spaghetti. Not fun.
- Test your code – isolate potential bottlenecks and try out various methods. Sometimes more code can be faster than less, in specific cases (compare the amount of objects for the gpu based uyvy playback patch to the CPU based one) .
For Jitter specifically, some considerations – and DO NOTs.
- DO NOT create unnecessary UI objects that constantly update – Jitter shares its drawing thread with the Max UI – the more you draw on screen, the less time Jitter has to draw to your window. If you REALLY need all that stuff on your screen blinking, set the screen refresh rate lower in performance options – and use qlim to limit the rate of updating.
- No really, DO NOT create unnecessary UI elements, even hidden ones. Max has to keep track of them. Simply hiding them wont do it. Replace number boxes with [float] and [int], etc.
- Pwindows – those little preview windows everyone wants to use – use qlim to limit the speed the pwindow is updated, and turn off “Use Onscreen” – you should see a decent speed increase just from that.
- If you are using OpenGL, it is highly recommended to manage drawing manually by using @layer, or with @automatic. Using @automatic 0 allows you to stop OpenGL objects from drawing/being activated by simply not banging them. This can be very useful with complex filterchains. Its a pain at first, but manageable and much more powerful
- If you plan on using the UYVY colormode, it is suggested you use the cc.uyvy2rgba shaders, as Windows users do not have native UYVY texturing (at least, @colormode on some GL objects in XP does not work). Just a heads up
As for Quicktime movie creation and optimization for realtime performance, there are many many guides online on what settings are best for playback, search the Max list and use google.
Quickly, I use Motion Jpeg @ 75 – 80% quality, 850×480 pixel movies (square pixel, 16×9 down-sampled from HD sources) at 29.97 or true 30fps (depending on the source, I try not to convert frame-rates).