Skip to content

FFmpeg

FFmpeg (Fast Forward MPEG) is a multimedia framework able to encode, decode, mux, demux, stream, filter and play any type of media including audio and video.

FFmpeg is available as a module on Apocrita.

FFmpeg Alternative Options

Although FFmpeg is provided as a module it is also available via Miniforge using the conda-forge channel. This version includes improved codec and GPU support and can provide improved functionality.

Usage

To run the default installed version of FFmpeg, simply load the ffmpeg module:

$ module load ffmpeg
$ ffmpeg --help
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

For full usage documentation, run ffmpeg --help.

Example jobs

Serial jobs

Here are two example jobs each running on 1 core and 1GB memory:

#!/bin/bash
#SBATCH -n 1               # (or --ntasks=1) Request 1 core
#SBATCH --mem-per-cpu=1G   # Request 1GB RAM per core
#SBATCH -t 1:0:0           # Request 1 hour runtime

module load ffmpeg

# Convert image(s) to video with 24 frames per second
ffmpeg -framerate 24 -i image1.png image2.png output.mp4
#!/bin/bash
#SBATCH -n 1               # (or --ntasks=1) Request 1 core
#SBATCH --mem-per-cpu=1G   # Request 1GB RAM per core
#SBATCH -t 1:0:0           # Request 1 hour runtime

module load ffmpeg

# Create a thumbnail image every 1 second of the video
ffmpeg -i output.mp4 fps=1 out%03d.png

The %03d in the above example dictates that the ordinal number of each output image will be formatted using 3 digits i.e. out001.png, out002.png, out003.png, etc.

References