whatsmybitrate
← All articles

Behind the scenes

How does WhatsMyBitrate work?

By Oren Cohen · Published · Updated

The question this site answers sounds simple: what's the real bitrate of this file? But you can't just read it off the label — a file that says "320 kbps" or "FLAC" might be lying. So instead of trusting the metadata, we look at the audio itself. Here's what happens when you drop a file in.

Step 1: Read the metadata

First we pull the basics with ffprobe (part of FFmpeg): the container format, codec, sample rate, channel layout, duration, and the stated bitrate. This is what the file claims to be. Keep in mind — metadata is just a label. Anyone can write anything in there.

This step still matters, because the claims are the baseline the measurements get compared against. The container tells us which codec family we're dealing with (FLAC and ALAC get lossless scrutiny; MP3, AAC get judged against their own cutoff tables). The sample rate sets the Nyquist ceiling everything else is measured against. And the stated bitrate is the number we're ultimately fact-checking — a file is only "suspicious" relative to what it asserts.

Occasionally metadata alone is a confession: an encoder tag naming an MP3 encoder inside a FLAC container, or a duration that disagrees with the stream length. Those files never make it past step one with their dignity intact.

Step 2: Decode the audio

Next we actually decode the file into raw audio samples. This is where we stop trusting and start measuring. Whatever the file says it is, the decoded waveform is the truth we get to analyze.

Decoding normalizes everything to the same playing field. A FLAC, a WAV, and an MP3 of the same recording all become plain PCM — the same stream of sample values — so every later step can be codec-agnostic. It also means the analysis works on anything FFmpeg can read, which is effectively every audio format in circulation: MP3, AAC, ALAC, FLAC, Ogg Vorbis, Opus, WavPack, AIFF, and the long tail of game, broadcast, and legacy formats.

One subtlety: for the spectral measurement we mix down to mono and work at the file's native sample rate. Resampling before measuring would blur exactly the cutoff we're looking for, so the analysis always happens in the file's own sample grid.

Step 3: Spectral analysis — the important part

This is the core of the whole thing. We run a spectral analysis on the audio (using FFT — a mathematical technique that breaks the signal down into its frequency components) and find the highest frequency that's actually present in the content.

Why does that matter? Because every lossy encoder leaves a fingerprint. Lossy compression works partly by throwing away high frequencies, and each bitrate has a characteristic ceiling:

So we measure the actual maximum frequency, compare it to the Nyquist limit, and compute a ratio. That ratio tells us which bitrate bracket the file really belongs to — regardless of what the extension or metadata claims. This is how we catch the classic scam: an MP3 that someone converted to FLAC. The container is lossless, but the frequency content still has that lossy haiircut. Some masters deliberately put a gentle low pass filter at 20kHz, but this tool accounts for that.

How the measurement itself works: the audio is chopped into short, overlapping windows — a few tens of milliseconds each — and every window is run through an FFT, which reports how much energy sits at each frequency. That gives a three-dimensional picture: time along one axis, frequency along the other, energy as the third. We then walk down from the theoretical top of the spectrum asking, for each frequency band, "is there real energy here, across enough of the track, above the noise?" The highest band that answers yes is the measured peak frequency.

Two details keep the measurement honest. First, the energy threshold is relative, not absolute — a whisper-quiet ambient track and a brickwalled metal master are judged against their own content, not a fixed number. Second, a brief burst of energy doesn't count: a single click or a synthesizer's ultrasonic aliasing shouldn't "extend" a file's bandwidth, so content has to persist across windows to qualify. Real music has sustained frequency rather than spikes.

A worked example, end to end

Say you drop in track07.flac, bought from a DJ pool you've never used. Step 1 reports: FLAC, 44.1 kHz, 16-bit, stereo, stated bitrate 812 kbps. Plausible — that's a normal FLAC number.

Step 2 decodes it. Step 3 sweeps the spectrum and finds sustained energy up to 19.8 kHz, then nothing — the peak-to-Nyquist ratio comes out at 0.90. Not terrible, but short of the ~1.0 a genuine CD rip shows. The spectrogram makes it visual: a level shelf at 19.8 kHz from the first second to the last, black above it.

Step 4 lines the evidence up. The shelf's height matches the 256 kbps AAC profile from the AAC table, and 812 kbps is suspiciously small for a FLAC of dense rock music — lossy-sourced audio compresses well, since the encoder already removed the detail FLAC would otherwise spend bits on. Verdict: lossless container, lossy content, most likely a transcoded 256 kbps store download. What you do with that information is between you and the seller.

Step 4: The verdict

Putting it together, you get: the stated bitrate (what the file claims), the estimated bitrate (what the spectrum shows), and whether the file is genuinely lossless. For known lossless codecs like FLAC or ALAC we also verify the content actually reaches the frequencies a real lossless file should — so upscaled fakes get flagged instead of passing.

The verdict is deliberately conservative. It only cries "fake" when the evidence is strong — a clear, sustained ceiling far below Nyquist, or an empty band above an upsampled sample rate. Borderline cases get reported as borderline, with the numbers shown, because a tool that overclaims is just the metadata problem in a new outfit. Every result ships with a debug log showing the measurements the verdict was computed from, so you can always trace why it said what it said.

Step 5: The spectrogram (optional)

If you tick the spectrogram box, we render a visual map of the full track: time on the horizontal axis, frequency on the vertical, and color intensity showing energy. It's genuinely useful — you can see a lossy cutoff as a hard horizontal line where the content suddenly stops — and honestly, it also just looks cool.

A few reading tips, since the image rewards a practiced eye. A flat horizontal shelf with empty space above is the classic lossy cutoff. A shelf that steps up and down with the music's density indicates a VBR encoder adjusting its lowpass with the bit budget. A ragged top edge that breathes with the track is what genuine content looks like. And a vast black region above 22 kHz in a file claiming 96 kHz is the upsampling signature from the WAV guide. The articles in the reading room walk through real examples of each.

Privacy, and the fine print

Your file is written to the server only for the few seconds this takes, then discarded. Nothing is stored, nothing is logged beyond anonymous usage counts, and no part of the audio is retained for training, profiling, or anything else. And since the whole project is open source, the analysis code is right there to read, and the GitHub version can scan entire folders of files at once if you want to audit a whole library without anything leaving your machine at all.

One honest caveat: spectral analysis is strong evidence, not absolute proof. A very quiet track or one mastered with a steep filter can look unusual, and a handful of edge cases exist.

Known limits

Since this page exists to explain the method, it should also own its blind spots. Three are worth knowing before you bet a refund on a result:

Opus at high quality. Modern encoders at high bitrates preserve nearly the full audible band, so a transcode from a good Opus or V0 file can pass the cutoff test. Whatsmybitrate therefore does not support OPUS files at this time. I am working on implementing an algorithm to this with no release date planned yet. If you would like to contribute an OPUS algorithm contact me.

Genuinely bandwidth-limited masters. Old tape, lo-fi production, deliberate filtering — a master can legitimately stop at 15 kHz with no encoder involved. The raggedness of the edge usually separates these from a codec's ruler-straight line, but "usually" is doing work in that sentence, and the debug log is there for the ambiguous cases.

Loudness-war brickwalling. Heavily limited masters slam so much energy into the top of the band that spectral edges can smear. The measurement handles this with the persistence rule, but extreme masters remain the noisiest input the analyzer sees.

Frequently asked questions

Why not just use the file's bitrate metadata? Because that's the claim, not the evidence. The entire premise of the tool is that labels lie — innocently through careless transcoding, or deliberately through upscaling. Anything stored about the audio can be edited; the audio itself is the only witness that was actually there.

How long does an analysis take? A few seconds for a typical track. Decoding is fast; the FFT sweep across the whole file is the bulk of the work. Spectrogram rendering adds the bulk of the additional time, since it's computing and drawing the full time-frequency map rather than a summary.

Can it analyze streaming links or playlists? No — it works on files you have, not streams, partly for technical reasons and partly because analyzing files you own is the unambiguous use case. For batch library audits, the GitHub version scans whole folders in one run and can even export the results in csv format or html format with the spectograms.

Does a "genuine" verdict guarantee good sound? No, and it's worth being precise: the tool verifies provenance — that the file contains the information its format implies. A genuine lossless rip of a bad recording is genuinely lossless and genuinely bad. The spectrograms and info generated by whatsmybitrate just give you the technical analysis not the mixing and mastering quality.

Try it yourself

Upload any audio file and see its true bitrate, codec, and frequency content in seconds. Free.

Analyze a File