Generate a Moving Dot Test Pattern with FFmpeg

This article provides a quick, step-by-step guide on how to use FFmpeg’s built-in source filters to generate a video test pattern featuring a moving dot. You will learn the exact commands required to create these synthetic videos using both the testsrc and testsrc2 filters, along with how to customize their resolution, frame rate, and duration.

Using the testsrc Filter

The standard testsrc filter generates a test pattern that includes a color grid, a real-time frame counter, and a tiny, moving one-pixel cursor (dot) that sweeps across the screen to show motion and frame progression.

To generate a 10-second, 1080p video at 30 frames per second using testsrc, run the following command in your terminal:

ffmpeg -f lavfi -i testsrc=size=1920x1080:rate=30:duration=10 output_testsrc.mp4

If you need a highly visible, larger moving dot, the testsrc2 filter is the better option. It generates a color spectrum background with a dedicated white circle (dot) that bounces around the screen, making it ideal for testing motion estimation, latency, and frame drops.

To generate a 5-second, 720p video at 60 frames per second using testsrc2, use this command:

ffmpeg -f lavfi -i testsrc2=size=1280x720:rate=60:duration=5 output_testsrc2.mp4

Parameter Breakdown

You can customize the output of these filters by modifying the parameters passed to the -i input option: