How to Use the FFmpeg showwavespic Filter

This article provides a straightforward guide on how to use the FFmpeg showwavespic filter to generate static waveform images from audio files. You will learn the basic command structure, how to customize the output image size and colors, and how to configure multi-channel audio visualization for your projects.

The showwavespic filter is a built-in FFmpeg tool that analyzes an audio input and renders its amplitude waveform into a single, static image frame. This is highly useful for generating audio previews, podcast covers, or visual assets for video editors.

Basic Command Usage

To generate a simple waveform image from an audio file, use the following command:

ffmpeg -i input.mp3 -filter_complex "showwavespic" -frames:v 1 output.png

In this command: * -i input.mp3 specifies your source audio file. * -filter_complex "showwavespic" calls the filter. * -frames:v 1 tells FFmpeg to output only a single video frame as the image. * output.png is the destination image file.

Customizing Image Resolution

You can adjust the width and height of the generated image by using the s (size) option. Specify the resolution in widthxheight format:

ffmpeg -i input.mp3 -filter_complex "showwavespic=s=1200x400" -frames:v 1 output.png

This command creates a wide waveform image with a resolution of 1200 pixels by 400 pixels.

Changing Waveform Colors

By default, the waveform is drawn in blue. You can change the color using the colors parameter, which accepts standard color names or hex codes:

ffmpeg -i input.mp3 -filter_complex "showwavespic=colors=green" -frames:v 1 output.png

To use a hex color code, format it like this:

ffmpeg -i input.mp3 -filter_complex "showwavespic=colors=0xff5500" -frames:v 1 output.png

Displaying Multiple Audio Channels

If your audio file has multiple channels (such as stereo), you can visualize them separately.

To assign different colors to each channel, separate the color names with a | (pipe) character:

ffmpeg -i input.mp3 -filter_complex "showwavespic=colors=red|blue" -frames:v 1 output.png

By default, channels will overlap. To split the channels into individual rows, set the split_channels parameter to 1:

ffmpeg -i input.mp3 -filter_complex "showwavespic=split_channels=1" -frames:v 1 output.png

Selecting Amplitude Scale

You can change how the amplitude of the audio waves is scaled. The default is linear (lin), but you can choose logarithmic (log), square root (sqrt), or cubic root (cbrt) scales.

To use a logarithmic scale (which is useful for visualizing quiet passages of audio more clearly), run:

ffmpeg -i input.mp3 -filter_complex "showwavespic=scale=log" -frames:v 1 output.png