Configure FFmpeg showwaves Dimensions Mode and Color

The FFmpeg showwaves filter converts input audio into a visual waveform video. This guide provides a straightforward explanation of how to configure the waveform’s dimensions, drawing mode, and colors using command-line parameters to customize your audio visualization.

Waveform Dimensions

To change the width and height of the output video, use the s (or size) parameter. The format is widthxheight. For example, to set the video resolution to High Definition (1280x720), use: s=1280x720

Drawing Mode

The mode parameter defines how the waveform is drawn. You can choose from four available modes: * point: Draws only a single sample point per column. * line: Draws a vertical line for each sample. * p2p: Draws a point-to-point line connecting sample envelopes. * cline: Draws a centered vertical line.

For example, to use the centered line mode, apply: mode=cline

Waveform Color

The colors parameter sets the color of the waveform. You can specify standard color names (such as red, blue, or green) or hexadecimal color codes. If your audio has multiple channels, you can separate colors with a pipe symbol (|) to color each channel differently.

For example, to make a stereo waveform with a red left channel and a yellow right channel, use: colors=red|yellow

Complete Implementation Example

To combine these settings, use the showwaves filter syntax within your FFmpeg command. Below is an example that takes an audio file, applies a 1280x720 dimension, sets the mode to cline, colors the stereo channels blue and green, and outputs it as an MP4 video:

ffmpeg -i input.mp3 -filter_complex "showwaves=s=1280x720:mode=cline:colors=blue|green" -c:a copy output.mp4