ffmpeg -i in.mp4 -lavfi showspectrumpic=s=1024x512 spectrogram.png draws a whole track as frequency over time. The axes make it 1308x640; legend=0 keeps it at 1024x512. ReelSDK makes one for under a fifth of a cent ($0.02 per compute minute).

Make a spectrogram with ffmpeg

One filter, showspectrumpic, draws every frequency over time; ReelSDK's API drew this one in under 4 seconds. It shows what a bitrate hides: audio that went through a 24 kHz sample rate stops dead at 12 kHz.

GuidesUpdated

spectrogram
ffmpeg -i in.mp4 -lavfi showspectrumpic=s=1024x512 spectrogram.png

s sets the plot area; the time and frequency axes are added around it, so the PNG comes out at 1308x640.

Variations

The other commands you will need

  1. Exactly the size you ask for

    legend=0 drops the axes: 1024x512, nothing around it. Use this when the image goes into a layout of its own.

    no legend
    ffmpeg -i in.mp4 -lavfi showspectrumpic=s=1024x512:legend=0 plot.png
  2. Zoom into speech

    A log frequency scale gives the low range, where voices live, most of the height; stop ends the plot at 12 kHz.

    log scale
    ffmpeg -i in.mp4 -lavfi showspectrumpic=s=1024x512:fscale=log:stop=12000 speech.png
  3. A scrolling spectrogram video

    overlap=0.9 makes enough columns to fill the frame; fps=30 turns them into normal video next to the audio.

    scrolling
    ffmpeg -i in.mp4 -filter_complex \
      "[0:a]showspectrum=s=1080x1080:slide=scroll:overlap=0.9,fps=30,format=yuv420p[v]" \
      -map "[v]" -map 0:a -c:v libx264 -crf 20 -c:a copy spectrum.mp4

The flags

The options in these commands

The options in these commands
FlagWhat it doesUsed here
-lavfiRuns a filter graph that may change the stream type, here audio to imageImages
s=1024x512Size of the plot areaImages
legend=0Leaves out the axes; showspectrumpic draws them by defaultNo legend
fscale=logLogarithmic frequency axis instead of linearLog scale
stop=12000Highest frequency on the plot, in HzLog scale
slide=scrollVideo mode: the picture scrolls left as new columns arriveScrolling
overlap=0.9Overlaps the analysis windows so more columns are made; the default is 0Scrolling
fps=30Turns the column rate into a steady 30 fpsScrolling

Sources: ffmpeg filters: showspectrumpic, ffmpeg filters: showspectrum, checked November 2026.

Reading the picture

Time runs left to right, frequency bottom to top, and brightness is how loud each frequency is. Speech shows up as stacked bands that move with the voice, with gaps where the speaker breathes.

The useful part is often what is missing. Our clip has nothing above 12 kHz across its whole length; we measured the band just above that line at close to silence. A flat ceiling like that means the audio was cut off before it reached us. A sampled signal holds frequencies only up to half its sample rate, so audio that passed through 24 kHz stops at 12 kHz, and lossy encoders cut the top end on purpose. A file that claims to be high quality but shows a low ceiling was likely made from a worse copy.

Why the image is bigger than you asked

showspectrumpic draws axes and a color scale by default, outside the plot. We asked for 1024x512 and got 1308x640. Set legend=0 when you need exact pixels, as in a page layout or another overlay.

Why a scrolling spectrogram crawls

In video mode, showspectrum makes one column per analysis window and, at the default overlap of 0, one frame per column. For our clip that was about 22 frames per second, so by the end the scroll had crossed only about a fifth of a 1080-pixel frame.

With overlap=0.9 the windows overlap and the filter made about ten times as many columns, enough to cross the frame in under 5 seconds. Its own frame rate is then very high, so fps=30 brings it back to normal video that plays next to the audio.

Without installing ffmpeg

The same command as one API call

Send the same args to POST /v1/ffmpeg with the file URL in inputs. Each job runs ffmpeg 8.1 on a fresh machine at $0.02 per compute minute, billed per second; this one finished in a few seconds and cost under a fifth of a cent.

terminalTry it
curl "https://api.reelsdk.com/v1/ffmpeg?wait=60" \
  -H "Authorization: Bearer $REELSDK_KEY" \
  --json '{
    "inputs": {
      "in.mp4": "https://api.reelsdk.com/f/lib/demo/clip.mp4"
    },
    "args": [
      "-i", "in.mp4", "-lavfi", "showspectrumpic=s=1024x512",
      "spectrogram.png"
    ],
    "outputs": ["spectrogram.png"]
  }'
ReelSDK video API: Spectrogram of a voice clip: bright bands of speech below 12 kHz and nothing above it
The voice clip as a spectrogram: time left to right, frequency bottom to top, loudness as color. Nothing above 12 kHz.Input: 10.7-second clip

FAQ

Questions, answered

How do I make a spectrogram with ffmpeg?

Run ffmpeg -i in.mp4 -lavfi showspectrumpic=s=1024x512 spectrogram.png. It writes one PNG of the whole track with time and frequency axes.

Why is my spectrogram PNG not the size I set?

The legend is drawn outside the plot area. With s=1024x512 the file came out 1308x640; add legend=0 to get exactly 1024x512.

How can a spectrogram show a fake high-quality file?

Look for a hard ceiling across the whole track. Audio with nothing above 12 kHz or so came from a low sample rate or a lossy encode, whatever the file's bitrate says now.

Can I make spectrograms with an API?

Yes. POST the same args to https://api.reelsdk.com/v1/ffmpeg with the audio or video URL in inputs and spectrogram.png in outputs. It runs ffmpeg 8.1 for $0.02 per compute minute, billed per second.

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains