Tuesday, July 10, 2007

In case the folks at Pixar read my blog, I would consider relocating for a permanent position.



Thanks to everyone who made suggestions in response to my call for help. I decided to use the mjpeg tools, and not to use an audio stream. I figured that a lot of beeping going off at the same time I was trying to explain the action in the film was probably not a good idea.

The movie shows a very simple dynamic system called a "sine-circle map." It's similar to what I would like to present in my talk. I generated the individual jpeg files (some 2000 or so) using R. The sine-circle map describes the coupled behavior of two oscillators. One oscillator, the "driving" or "forcing" oscillator, determines when the "%%%%" appears over the circle. The "%%%%" marks the beginning of each period of this oscillator. The second oscillator is shown more completely as the second hand sweeping around the circle.

Because the two oscillators are coupled, changes in the period of the driving oscillator are detected by the second oscillator which then changes its own period to compensate. After some time, the periods of the two oscillators will be the same, and their phases will match as well. Phase mismatches between the oscillators due to differences in period appear as a red wedge. The three time series plots from top to bottom show the period of the driving oscillator, the phase of the second oscillator, and the period of the second oscillator.

I had several issues in getting this all together, issues that resulted in stuttering between frames and sloppy, smeary aliasing. The stuttering looked like the movie got "stuck" between two frames and played them over and over (and over) again. You can see, if you have really good eyes and can filter the abomination that is the Google Video above, the slight smeariness that I was unable to eliminate completely. It appears most evidently as black smudges within the red slice when the driving oscillator reduces its period.

I found I had to use a low frame rate (25 frames per second) and that the jpegs could not exceed about 560 x 720 pixels. (I also learned that the image dimensions had to be divisible by 16. Why? I have no idea.) Most of my problems had something to do with the frame rate. With smaller images (just the circle alone, e.g.), I could go as high as 50 fps, but as soon as I added the plots I got stuttering and smear. It almost seemed like a memory problem, but the documentation for jpeg2yuv leaves much to be desired, and I really don't have the time to become an expert in jpeg and mpeg formats. So I just don't know.

I have one of the mpegs I hope to use for my talk finished, but I have several others yet to go. Even though I still have no clue what I'm doing, I hope that keeping the frame rate low and the jpegs as small as possible will produce acceptable video. Maybe, if my current proposal gets funded, I can hire someone to make them pretty.

5 comments:

Anonymous said...

At some point in the past I've tried to make movies like this (I sometimes work with coupled oscillators and related dynamics).

While not very efficient, I found that compiling the frames into a huge animated GIF made for lossless presentation (and you just need a web browser to play it).

I've also made/played movies within Matlab, but that has issues as well.

Angry Professor said...

I considered using animated gifs, but I got the impression (perhaps erroneously) that Adobe Reader won't animate them. My final presentation will be in pdf format, hence my obsession with mpegs.

Anonymous said...

You may be getting smearing from compressing the images before they go into the MPEG stream (all JPEGs have lossy compression). If you could output the individual frames in a losslessly compressed format like GIF (or better, PNG), and turn those into an MPEG, that might improve matters. With the MJPEG suite, if you have room to store completely uncompressed files, you can encode PPM frames with ppmtoy4m.

CB Pascal said...

Wholly off topic but I watched the video while listening to As I Am by Lords of Acid. It synced up quite well.
Back on topic, PNG is the way to go even though it's a bit late since you've all ready begun. Or MNG since you needed it animated. (Multiple-image Network Graphics)

Anonymous said...

I have an animated gif you can paste onto a pdf to try it out if you want.

--AB