Jitter movie playback optimizations

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.

Download Jitter Movie Optimization Methods

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).

8 Responses to “Jitter movie playback optimizations”

  1. Jean-François Charles Says:

    Simple, clear, efficient. Will be very useful. If they don’t know the techniques, or are unsure, jitter users should visit this page!

  2. Parag Mital Says:

    Thank you!

  3. Foxy Says:

    I found my way to your help patches. Thanks

  4. Luis Marques Says:

    hello, i’m a beginner in jitter, can you help me explaining the commands inside the jit.qt.movie, and the others, like this “jit.qt.movie @unique 1″. really appreciated, that way i can understand better what you are doing. many thanks. Luis Marques

  5. Hans MIttendorf Says:

    Hi,
    it is great to have you offering your expertise!
    I am a composer and started to get into multimedia using Jitter.
    As a composer, I have developed a mathematical approach to generate music. I would like to transfer that to Jitter.
    My latest ‘idea’ asked for running 60 short quicktime movies.
    I got the patch but running slows down the fps rate to 2 which is not viable.
    I tryed your patches and I saw that your patches using just 2 quicktime videos show a fps of 11 on my G5.

    When I load all the movies run them and stop them and start the algorithm again, I have 32 fps because the program only takes the last still frame. When I click start movies it goes down. So obviously the streaming causes a problem.

    Do you think one can actually optimize to play 60 movies or is it an illusion to try?

    best

    Hans

    P.S I have movies on youtube
    http://www.youtube.com/watch?v=3q4BRIzhrY4&feature=PlayList&p=41ABA779FD961F1C&index=0&playnext=1

  6. The B-Roll » Archives » Day 345 / Modding My App Says:

    [...] Tonight I opened my app and stripped it of any functionality I didn’t need, like the pattern recorders and the midi stuff.  I altered my playback engine to match a configuration recommended by Max/MSP afficionado named Vade.  Vade designed a series of optimisation methods for playback in Jitter. [...]

  7. MBOSSA Says:

    thanks a lot. superuseful

  8. Project Journal – Four Screen TEST « daily Says:

    [...] Jitter movie playback optimizations http://abstrakt.vade.info/?p=147 [...]

Leave a Reply