https://pymolwiki.org/api.php?action=feedcontributions&user=Squaredevil&feedformat=atomPyMOLWiki - User contributions [en]2024-03-19T13:06:50ZUser contributionsMediaWiki 1.35.7https://pymolwiki.org/index.php?title=Making_Movies&diff=8676Making Movies2010-11-26T13:20:44Z<p>Squaredevil: /* Encoding video files */ fix line</p>
<hr />
<div>==Movie Creation in PyMOL==<br />
This page talks about how to take your export movie frames and turn them into an actual movie. For learning how to make a movie in the first place, see [[MovieSchool]].<br />
<br />
==Encoding video files==<br />
<br />
===Animated GIF===<br />
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.<br />
<br />
===Avidemux===<br />
[http://avidemux.sourceforge.net/ Avidemux] is a great tool to stich your image files together as a movie. It can read the PNG output stack from Pymol and encode a movie using almost all codecs currently available. The program has an easy to use graphical interface, making the conversion simple compared to some of the other options available to you.<br />
<br />
===Mencoder/Mplayer===<br />
[http://www.mplayerhq.hu 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.<br />
<br />
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:<br />
* 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<br />
<br />
mencoder "mf://*.png" -mf type=png:fps=18 -ovc lavc -o output.avi<br />
<br />
namely something like (this command worked BEST for my case; it's all one line connect it where the backslashes are).<br />
<br />
mencoder -mc 0 -noskip -skiplimit 0 -ovc lavc -lavcopts \<br />
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 \<br />
"mf://*.png" -mf type=png:fps=18 -o output.avi<br />
<br />
The mpeg4 codec requires a DivX plugin which is not a part of the default installation on some operation systems. The codec msmpeg4v2 makes movies which are more likely to be playable on standard Windows players and can be used with mencoder e.g.<br />
<br />
mencoder -mc 0 -noskip -skiplimit 0 -ovc lavc -lavcopts vcodec=msmpeg4v2:vhq "mf://*.png" -mf type=png:fps=18 -o output.avi<br />
<br />
This encoder line is however not optimised (yet), and the codec also produces a bit larger files than the mpeg4 at the same visual quality according to the Mplayer homepage.<br />
<br />
====Troubleshooting====<br />
#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'''.<br />
#If the above line complains about the '''codec''' part, then replace the word '''codec''' in the command line with '''vcodec'''.<br />
<br />
===Virtual Dub===<br />
[http://virtualdub.sourceforge.net/ Virtual Dub] is an open-source, robust piece of software that allows easy creation of .AVI files from image sequences (such as *.PNG created by PyMol). After opening Virtual Dub, select '''File''' Menu --> '''Open Video File''' --> under "files of type" select '''image sequence (*.png, etc)'''.<br />
<br />
After viewing (and editing) the movie, choose '''save as AVI (F7)''' from '''File''' menu.<br />
This generates high quality, yet very large, AVI files; in order to down-size the files into formats which fit PowerPoint, free software such as [http://www.formatoz.com/download.html FormatFactory] ('''FF''') is available for download and easy use.<br />
<br />
== Keywords ==<br />
mencoder, mplayer, movie<br />
<br />
===Other Options===<br />
* 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.<br />
* Another good program for converting images into movies of different formats is VideoMach : http://gromada.com/VideoMach.html<br />
* 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.<br />
* 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.<br />
* 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<br />
* 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 <br />
<br />
convert *.png movie.mpeg<br />
If you want to make an animated gif, do<br />
convert *.png movie.gif<br />
<br />
==Movies on a Mac ==<br />
===QT Pro===<br />
On a Mac, it's easy enough to just fire up QuickTime Player and select <br />
File->Open Image Sequence<br />
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.<br />
<br />
===Alternative===<br />
The above requires QT Pro ($25). For free you can use this: [http://www.likelysoft.com/framed/].<br />
<br />
===In a Presentation===<br />
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 <br />
your presentation computer (and you have your psw file) and just click OK when powerpoint warns of the perils of non-microsoft products. the <br />
final scene will return to your powerpoint presentation without any effort.<br />
<br />
= Troubleshooting =<br />
== Quicktime ==<br />
Recent attention to transparencies and QuickTime show that one typically wants to set<br />
<source lang="python"><br />
set ray_opaque_background, off<br />
</source><br />
to tell PyMol to stop using Alpha-channel for transparencies and switch to blending.<br />
<br />
If you're having transparency problems this could be a fix.<br />
<br />
<br />
[[Category:Third_Party_Software|Movies]]<br />
[[Category:Third_Party_Software|Making Movies]]<br />
[[Category:Movies]]</div>Squaredevilhttps://pymolwiki.org/index.php?title=Making_Movies&diff=8675Making Movies2010-11-26T13:20:24Z<p>Squaredevil: /* Encoding video files */ adding virtual dub</p>
<hr />
<div>==Movie Creation in PyMOL==<br />
This page talks about how to take your export movie frames and turn them into an actual movie. For learning how to make a movie in the first place, see [[MovieSchool]].<br />
<br />
==Encoding video files==<br />
<br />
===Animated GIF===<br />
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.<br />
<br />
===Avidemux===<br />
[http://avidemux.sourceforge.net/ Avidemux] is a great tool to stich your image files together as a movie. It can read the PNG output stack from Pymol and encode a movie using almost all codecs currently available. The program has an easy to use graphical interface, making the conversion simple compared to some of the other options available to you.<br />
<br />
===Mencoder/Mplayer===<br />
[http://www.mplayerhq.hu 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.<br />
<br />
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:<br />
* 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<br />
<br />
mencoder "mf://*.png" -mf type=png:fps=18 -ovc lavc -o output.avi<br />
<br />
namely something like (this command worked BEST for my case; it's all one line connect it where the backslashes are).<br />
<br />
mencoder -mc 0 -noskip -skiplimit 0 -ovc lavc -lavcopts \<br />
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 \<br />
"mf://*.png" -mf type=png:fps=18 -o output.avi<br />
<br />
The mpeg4 codec requires a DivX plugin which is not a part of the default installation on some operation systems. The codec msmpeg4v2 makes movies which are more likely to be playable on standard Windows players and can be used with mencoder e.g.<br />
<br />
mencoder -mc 0 -noskip -skiplimit 0 -ovc lavc -lavcopts vcodec=msmpeg4v2:vhq "mf://*.png" -mf type=png:fps=18 -o output.avi<br />
<br />
This encoder line is however not optimised (yet), and the codec also produces a bit larger files than the mpeg4 at the same visual quality according to the Mplayer homepage.<br />
<br />
====Troubleshooting====<br />
#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'''.<br />
#If the above line complains about the '''codec''' part, then replace the word '''codec''' in the command line with '''vcodec'''.<br />
<br />
<br />
===Virtual Dub===<br />
[http://virtualdub.sourceforge.net/ Virtual Dub] is an open-source, robust piece of software that allows easy creation of .AVI files from image sequences (such as *.PNG created by PyMol). After opening Virtual Dub, select '''File''' Menu --> '''Open Video File''' --> under "files of type" select '''image sequence (*.png, etc)'''.<br />
<br />
After viewing (and editing) the movie, choose '''save as AVI (F7)''' from '''File''' menu.<br />
This generates high quality, yet very large, AVI files; in order to down-size the files into formats which fit PowerPoint, free software such as [http://www.formatoz.com/download.html FormatFactory] ('''FF''') is available for download and easy use.<br />
<br />
== Keywords ==<br />
mencoder, mplayer, movie<br />
<br />
===Other Options===<br />
* 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.<br />
* Another good program for converting images into movies of different formats is VideoMach : http://gromada.com/VideoMach.html<br />
* 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.<br />
* 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.<br />
* 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<br />
* 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 <br />
<br />
convert *.png movie.mpeg<br />
If you want to make an animated gif, do<br />
convert *.png movie.gif<br />
<br />
==Movies on a Mac ==<br />
===QT Pro===<br />
On a Mac, it's easy enough to just fire up QuickTime Player and select <br />
File->Open Image Sequence<br />
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.<br />
<br />
===Alternative===<br />
The above requires QT Pro ($25). For free you can use this: [http://www.likelysoft.com/framed/].<br />
<br />
===In a Presentation===<br />
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 <br />
your presentation computer (and you have your psw file) and just click OK when powerpoint warns of the perils of non-microsoft products. the <br />
final scene will return to your powerpoint presentation without any effort.<br />
<br />
= Troubleshooting =<br />
== Quicktime ==<br />
Recent attention to transparencies and QuickTime show that one typically wants to set<br />
<source lang="python"><br />
set ray_opaque_background, off<br />
</source><br />
to tell PyMol to stop using Alpha-channel for transparencies and switch to blending.<br />
<br />
If you're having transparency problems this could be a fix.<br />
<br />
<br />
[[Category:Third_Party_Software|Movies]]<br />
[[Category:Third_Party_Software|Making Movies]]<br />
[[Category:Movies]]</div>Squaredevil