Ffmpeg
ffmpeg is a free and open-source suite of programs which allow for the conversion and creation of video, audio, and image files. While ffmpeg can be thought of as a swiss-army knife for multimedia formats, we can use ffmpeg on the output of VMD (or any other MD sim) to create smooth animations.
Installation
Linux and Mac OSX users can use the built-in package manager to install ffmpeg via command line:
- Ubuntu/Debian Linux:
# sudo apt install ffmpeg
- Mac OSX via homebrew:
$ brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265
Windows users can install manually using packages built by community package maintainers:
- Download 'release' package build archive from https://www.gyan.dev/ffmpeg/builds/
- Unzip into an easy-to-find folder, such as
C:\ffmpeg
- To add ffmpeg to your system
PATH
, so that you can run it from any window, open a CMD/Powershell window as Administrator, then run:setx /M PATH "%PATH%;C:\ffmpeg\bin"
In any case, ffmpeg can now be invoked from a command-line. To make sure we have a working system, you can run: ffmpeg -version
to display information about the build.
Use with VMD
ffmpeg is already linked against VMD in the Unix versions of the program. For Windows users, Navigating to 'Extensions > Movie Maker' will allow the creation of a number of images, one per step size specified, which are saved to a specified folder. After creating these images, you can perform the following to create a movie file:
- change to the directory:
cd C:\output_folder\
- to make an MP4 with 30 frames a second from images in the format starting 'output.0001.bmp':
ffmpeg -r 30 -crf 25 -i output.%04d.bmp yourmovietitle.mp4
- to make a WMV with the same settings:
ffmpeg -r 30 -crf 25 -i output.%04d.bmp yourmovietitle.mpv
ffmpeg will read sequentially across the pattern %04d as input -i, and create a movie with rate -r and quality -crf. Many other options are possible, and would require a look at the ffmpeg documentation.
Outside Resource
ffmpeg homepage wiki: https://trac.ffmpeg.org/wiki