FFmpeg Linux Color Bars Test Pattern Guide
This article provides a straightforward, step-by-step guide on how to generate a standard color bars test pattern video using FFmpeg on a Linux system. You will learn the exact command-line syntax required to create standard SMPTE color bars, customize the video resolution, set the frame rate, adjust the duration, and optionally add an audio test tone. By the end of this guide, you will be able to produce professional-grade test videos directly from your Linux terminal for display testing or video editing workflows.
Generating Standard Color Bars
FFmpeg includes a built-in virtual input device called
smptebars specifically designed to generate the standard
Society of Motion Picture and Television Engineers (SMPTE) color
bars.
To create a basic, 5-second color bar video at a standard 1080p resolution and 30 frames per second, open your Linux terminal and run the following command:
ffmpeg -f lavfi -i smptebars=size=1920x1080:rate=30 -t 5 output.mp4Breaking Down the Command Syntax
Understanding each part of the FFmpeg command allows you to customize the output to fit your specific technical requirements:
-f lavfi: This flag tells FFmpeg to use the Libavfilter virtual input device, which allows for the internal generation of video and audio sources.-i smptebars=...: This specifies the input source. Thesmptebarsfilter generates the test pattern.size=1920x1080: Defines the resolution of the output video. You can change this to any standard resolution, such as1280x720or3840x2160.rate=30: Sets the frame rate of the video to 30 frames per second. You can modify this to24,60, or any other standard frame rate.-t 5: Specifies the duration of the output video in seconds. In this example, the video will stop rendering after 5 seconds.output.mp4: The name and format of your final video file.
Adding an Audio Test Tone
In many testing scenarios, a visual color bar pattern is paired with
a steady audio tone (usually a 1 kHz sine wave) to test audio channels
and synchronization. You can combine the smptebars video
filter with the sine audio filter in a single command:
ffmpeg -f lavfi -i smptebars=size=1920x1080:rate=30 -f lavfi -i sine=frequency=1000 -t 10 output_with_audio.mp4In this variation, -f lavfi -i sine=frequency=1000
generates a 1000 Hz (1 kHz) audio tone. The -t 10 parameter
ensures that both the generated video and the audio track will cut off
precisely at the 10-second mark.