Knowledge Base

What Is Sample Format?

sample-fmt

In audio and video files, and sometimes in other formats, you may find a value for Sample Format or sample_fmt. Find out what it is and what it tells you about your file.

Digital audio is a long list of measurements: the level of the sound, captured over and over again, thousands of times per second. Each of those measurements is called a sample. Sample Format describes how one sample is written down - how many bits it uses, and what kind of number it is.

Which files carry it and where the value comes from

The field belongs to audio data, so it turns up in audio files such as WAV, FLAC, MP3, AAC and OGG, and in the audio track of video files such as MP4, MOV and MKV. Many metadata reports shorten the name to sample_fmt, where fmt is simply short for format.

For uncompressed formats like WAV the value is a genuine property of the file, chosen by the recording device or the software that saved it. For compressed formats it describes the samples the decoder produces when the file is played back, which is why a plain MP3 often reports a floating point format even though nothing in the file itself looks like that.

What the values look like

Values are short codes made of a letter, a number and sometimes a trailing p:

  • u8 - unsigned 8 bit
  • s16 - signed 16 bit
  • s32 - signed 32 bit
  • flt - 32 bit floating point
  • dbl - 64 bit floating point
  • s16p, s32p, fltp, dblp - the same formats, stored planar

The letters tell you the kind of number: s for a signed whole number that can go above and below zero, u for an unsigned one, flt and dbl for floating point numbers, which handle very quiet and very loud passages without clipping and are what audio editors work in. The digits are the bits per sample. A report showing sample_fmt: s16 means each sample is a signed 16 bit number, the same format used on audio CDs. Audio recorded at 24 bit is usually carried in a 32 bit format, so s32 is a common sight.

The trailing p stands for planar. Without it the channels are interleaved, alternating left sample, right sample, left sample. With it each channel is kept in its own block. This makes no difference to what you hear; it only matters to the software reading the data.

Why it matters

More bits per sample means finer steps between the quietest and loudest sound the file can describe, so quiet detail survives better and there is less of the faint grainy noise that comes from rounding. That is why studios record at 24 bit and mix in floating point, then deliver 16 bit.

It also drives size. In an uncompressed file, moving from 16 bit to 24 bit makes the audio data half again as large, with no change to length or sample rate. And it affects compatibility: plenty of hardware players, CD burners and older programs accept only 16 bit whole numbers, so a floating point master usually has to be converted before it will play everywhere. The field says nothing about you, your location or your equipment.