(Mac OS X) Producing iMovie and Keynote editable videos from png files

Lets say you have a collection of *.png files: 0001.png, 0002.png, 0003.png and so on.
These *.png files represent different frames of a movie you just rendered (in Blender, Maya, or some other program). How do you actually combine these into a movie?
One way is to use the following script:

ffmpeg -i %4d.png -c:v libx264 -r 24 myvideo.mp4

Which will render the simulation at 24 frames per second in the libx264 codec (and it looks very nice!). However, the libx264 codec is not compatible with Quicktime, iMovie, or even Keynote (you can play it on videolan though).
It is better to use the mpeg4 codec which is readily editable in either of these:

ffmpeg -r 24 -i %4d.png -c:v mpeg4  -vb 20M myvideo.mp4

Update: ffmpeg complained sometimes on the .png files not being found. The following command works better:

ffmpeg -r 48 -pattern_type glob -i '*.png'   -c:v mpeg4  -vb 20M myvideo.mp4
Advertisements