How to Create Audio Spectrum Visuals with FFmpeg

Video Content

FFmpeg is a powerful command-line application able to record, stream, and convert multimedia files between multiple file types. This is great for compatibility with audio platforms with different format requirements. And don’t forget users who prefer lossless formats – e.g. FLAC and OGG. Some creators provide multiple audio format options on their live broadcasting website.

But it can be beneficial to share audio work on video platforms as well. Just as vloggers can benefit from creating audio-only content for podcast platforms, podcasters can do the same with video platforms. YouTube is the second most popular search engine as of 2019. Vimeo and some other video platforms have small but active communities.

But what’s the best option for converting your audio to video? There are a few common options for podcasts, music, and other audio-only content:

Showwaves Screenshot
  • Image with title info
  • Image slideshow
  • Video to support mood of the audio (sometimes unrelated)
  • Spectrum visuals

We’re going to focus on that last option – spectrum visuals. FFmpeg can create many audio spectrum visuals. We’re going to focus on the commonly seen sample waveform view called showwaves in FFmpeg.

Below we’ll cover how to create a FFmpeg showwaves multimedia filter.

FFmpeg is available for installation on all InMotion VPS Hosting plans.

Showwaves Visuals

  1. Log in to SSH or cPanel Terminal
  2. List FFmpeg-supported file types with the command ffmpeg -formats
  3. (Optional) Filter the results for a specific format for faster results: ffmpeg -formats | grep mp3
  4. List supported codecs with the command ffmpeg -codecs
  5. Navigate to your media files directory with cd command
  6. Type the following command, one line at a time, and remember to rename song-1.mp3 to the file name and file type and song-1.mp4 to your specified file name:
    ffmpeg -i song-1.mp3 -filter_complex \
    command, input , file name, prepare a filter function
    "[0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" \
    alpha radius set to 0, filter, screen resolution, frame rate per second (FPS), output color format
    -map "[v]" -map 0:a song-1.mp4
    “map” channels from input to output, remove V color channel component, alpha radius set to 0, output file

    If you’d rather use a single command:
    ffmpeg -i song-1.mp3 -filter_complex "[0:a]showwaves=s=1280x720:mode=line:rate=25,
    format=yuv420p[v]" -map "[v]" -map 0:a song-1.mp4
FFmpeg in Action

Once you create the file, open the file URL in your browser to see your results. You can use this file as is with the audio included. Or you can import it into a video editor for further customization.

See more examples of audio spectrum visuals made with FFmpeg from FFmpeg documentation and this popular StackExchange forum.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+