You are here

FFmpeg (video encoding)

Table of Contents

Introduction

FFmpeg is a full-featured program for various kinds of audio and video conversion.  However, in the WestGrid context, the most likely use is combining individual image files from a time-dependent simulation into a movie file.

Running FFmpeg on Lattice and Parallel

FFmpeg has been installed on Parallel and Lattice in /global/software/ffmpeg/ffmpeg-git-20150429-64bit-static. The -h (-h long or -h full) command line argument generates a summary of other options (bash shell example):

export PATH=/global/software/ffmpeg/ffmpeg-git-20150429-64bit-static:$PATH
ffmpeg -h long

PDF-based documentation is in /global/software/ffmpeg/ffmpeg-git-20150429-64bit-static/manpages.

Here is a sample command line used to convert a series of PNG images to an MPEG movie:

ffmpeg -r 20 -i snap%04d.png \
-c:v libx264 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" movie.mp4

In this example it is assumed that you have a series of PNG files named snap0000.png, snap0001.png, ... (with exactly four characters for the numeric part), and you want to convert them into an MP4 movie. The "scale" argument is necessary to make the movie Quicktime-compatible, and "-r 20" sets the frame rate per second.

For More Information

2015-04-29 - Page created.