How to Use FFmpeg Mandelbrot Filter for Fractal Video

This guide explains how to use FFmpeg’s built-in mandelbrot video source filter to generate stunning, animated fractal videos. You will learn the basic command structure, explore key parameters for customizing the fractal’s appearance and motion, and see practical examples to render your own high-definition fractal animations directly from your command line interface.

The Basic Command

Because the Mandelbrot generator is a virtual input device (a source filter), you must tell FFmpeg to use the Libre-AV filtergraph (lavfi) library as the input format.

Here is the simplest command to generate a 10-second Mandelbrot fractal video:

ffmpeg -f lavfi -i mandelbrot=s=1280x720:r=30 -t 10 output.mp4

Customizing the Fractal with Parameters

The mandelbrot filter accepts several parameters to customize the position, depth, and zoom level of the fractal. You append these parameters to the filter name using a colon (:) separator.

Key Parameters:

Creating a Deep Zoom Animation

To generate a dynamic video that continuously zooms into the fractal, you must set an end_scale value that is significantly smaller than the start_scale.

The following command generates a high-definition (1080p), 60 FPS zoom animation lasting 15 seconds:

ffmpeg -f lavfi -i mandelbrot=s=1920x1080:r=60:end_scale=0.00000005:maxiter=5000 -t 15 -c:v libx264 -pix_fmt yuv420p fractal_zoom.mp4