Encoding video files
Quality note: Converting to video generally leads to a loss of quality and inflated file sizes. Gif animation gives a good alternative, retaining the original quality and maintaining small file sizes, however it lacks play controls. With skillful use of frame delays during the generation of the Gif it is possible to create pauses to emphasize certain frames. Ulead Gif Animator works well although there are many programs to choose from. To create files with many frames in Ulead add around 150 files as frames at a time.
Mplayer is an award-winning open source movie player. Mencoder (which comes packaged with Mplayer) is its movie encoder. Mencoder can take in various file formats (png,gif,jpg) and convert them to movies.
Assuming you have created a lot of .png files and would like to encode a .mpeg, .avi or other video format, a number of solutions are known:
- The DiVX encoder using mplayer and mencoder? There's binaries for Unix and Windows. It makes rather nice compression on a 800x600 (probably higher). It doesn't take too long to produce the nicer quailty movies, but much longer than simply
mencoder "mf://*.png" -mf type=png:fps=18 -ovc lavc -o output.avi
namely something like (this command worked BEST for my case; it's all one line connect it where the backslashes are).
mencoder -mc 0 -noskip -skiplimit 0 -ovc lavc -lavcopts \ vcodec=mpeg4:vhq:trell:mbd=2:vmax_b_frames=1:v4mv:vb_strategy=0:vlelim=0:vcelim=0:cmp=6:subcmp=6:precmp=6:predia=3:dia=3:vme=4:vqscale=1 \ mf://*.png -mf type=png:fps=18 -o output.avi
- If your movie shows up in PowerPoint with only the first frame showing, or is just a black square, try adding -of asf or -of avi.
- If the above line complains about the codec part, then replace the word codec in the command line with vcodec.
mencoder, mplayer, movie
- For those with Photoshop CS3 installed: Load files using File - Scripts - Load Files into Stack. This loads the files as layers. Turn on the animation window at Window - Animation. You may need to reverse the frames for the correct direction - this is done at the animation window using the drop menu above the frames. You will also want to set a delay on the frames, select all frames using the dropdown menu and and then adjust to 0.2s on one of the frames. Then export the film using File - Export - Render Video. There are plenty of options for format and compression types. I found a quicktime movie with no compression at 10f/s to be right for my needs. The video could get quite big, but it will look as good as pymol. Alternatively you can also create animated GIFs in Photoshop. Once you have the frames of your clip as above, choose File - Save for Web and Devices and then save the GIF. The limit of 200 pictures is a problem in Photoshop.
- Another good program for converting images into movies of different formats is VideoMach : http://gromada.com/VideoMach.html
- TMPGEnc from http://www.tmpgenc.net is very fast, easy to use, and produces very nice ouput (MPEG-2). Unfortunately, it does not handle images larger than 720 x 576 pixels.
- Adobe Premiere recipe, using Microsoft's MPEG4 V2, 960x720 @ 30 fps, which PowerPoint automatically treats as full-screen (due it's wacky metrics). Using this codec, a recent 24-second movie consumed only 4.5 MB of space, but looks much better than a 640x480 Cinepak-based movie with a file size of around ~40 MB. It definitely pays to use the latest technology.
- A freeware jiffy to convert png files to an animation is imgcon, which proved to be very useful:http://www.fmrib.ox.ac.uk/~yongyue/imgcondl.html
- The program convert, part of the ImageMagick suite of programs can be used provided the program mpeg2encode is in your path. mpeg2encode can be found here http://www.mpeg.org/MSSG/. To make an mpeg file, go
convert *.png movie.mpeg
If you want to make an animated gif, do
convert *.png movie.gif
Movies on a Mac
On a Mac, it's easy enough to just fire up QuickTime Player and select
File->Open Image Sequence
This will prompt you to select the first png file in a folder and load all other pngs with the same base name in that folder. Then simply export these frames as a movie with any of the available quicktime codecs at a frame rate you like.
The above requires QT Pro ($25). For free you can use this: .
In a Presentation
You don't need to convert the PyMol scene to a movie, just save session as a .psw (pymol show file) with the scenes embedded in there. Then from within Power|Point just set up a hyperlink (Insert hyperlink) and point it to the .psw file. In presentation mode when you click on the hyperlink pymol automatically boots and you can scroll thru your scens like a full screen powerpoint presentation. You have to make sure that you have pymol installed on your presentation computer (and you have your psw file) and just click OK when powerpoint warns of the perils of non-microsoft products. the final scene will return to your powerpoint presentation without any effort.