Generate Zone Plate Test Pattern with FFmpeg yuvtestsrc

This guide demonstrates how to generate a zone plate test pattern using FFmpeg's built-in yuvtestsrc filter. You will learn the exact command-line syntax required to create this specialized video pattern, customize its resolution and frame rate, and save it as a video file for testing display calibration, scaling algorithms, or video encoders.

The yuvtestsrc filter in FFmpeg is a virtual input source designed specifically to generate a YUV test pattern featuring a zone plate (a pattern of concentric rings with increasing spatial frequency). This is highly useful for analyzing aliasing, frequency response, and rendering quality.

Basic Command Syntax

To generate a default zone plate pattern and save it to an MP4 file, use the following command:

ffmpeg -f lavfi -i yuvtestsrc -t 5 output.mp4
  • -f lavfi: Tells FFmpeg to use the Libavfilter input virtual device.
  • -i yuvtestsrc: Specifies the input source filter.
  • -t 5: Limits the output duration to 5 seconds.

Customizing Resolution and Frame Rate

By default, the filter outputs a resolution of 320x240 at 25 frames per second. You can customize these parameters directly inside the filter argument using the size (or s) and rate (or r) options.

To generate a 10-second Full HD (1080p) zone plate at 60 frames per second, use this command:

ffmpeg -f lavfi -i yuvtestsrc=size=1920x1080:rate=60 -t 10 output.mp4

Key Parameter Options

You can fine-tune the source filter using the following key-value pairs separated by colons:

  • size or s: Sets the video resolution (e.g., 1280x720 or hd720).
  • rate or r: Sets the frame rate (e.g., 30 or 24000/1001).
  • duration or d: Sets the maximum duration of the generated video directly within the filter (e.g., duration=5).
  • sar: Sets the sample aspect ratio of the generated video.

For example, to specify the duration inside the filter instead of using the -t flag:

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