10

As far as I understand, a frame consist of multiple samples and both are kind-of a point in a time series.

My questions are :

  • What's the difference between sample and frame?
  • Why define two different concepts? Why not just merge them into one?

2 Answers 2

15

A sample is the smallest usable quantum of digital audio. The term frame isn't formally defined in pure audio terms, but is often used in relation to video that may accompany an audio track. In that context a frame is the quantity of audio samples taken during a video frame interval.

If there are 30 video frames per second and 48000 audio samples per second, you could say that there are 48000 / 30 = 1600 samples per frame, or that an "audio frame" contains 1600 samples, but there literally is no audio frame, it's just a convention for talking about audio with respect to a video frame rate.

In some media encoding schemes like DPX, a frame can contain video and audio sample data, so it's convenient to call the contained audio samples an audio frame, but that's a property of the container and not a property of the audio itself.

3
  • 3
    For completeness, you should know that MPEG (MP3) and similar codecs also have the concept of a frame. See for example mp3-converter.com/mp3codec/frames.htm.
    – Jim Mack
    Commented Jun 23, 2017 at 2:24
  • Audio payload is stored as frames in most encoded bitstreams. FFmpeg will encapsulate decoded audio into frames as well internally. These audio frames (in files or data buffers) aren't coterminus with video frames.
    – Gyan
    Commented Jun 25, 2017 at 16:26
  • 1
    This is by far the best explanation I have come across in the last several days while reading different audio documentation. Thank you.
    – Darkwonder
    Commented Aug 9, 2019 at 8:31
4

The term 'frame' has several different meanings, dependent on the context. Beside the obvious meaning in video contexts, and the usage in audio codecs like MP3, a frame may also be used as a name for all the samples in a bundle with several channels, which belong to the same point in time. Yet another usage of the word is with communication protocols, where a frame is defined to be a collection of bits on the wire which together form an item of information that is sent as a whole, and often protected against transmission errors.

For example: The S/P-DIF interface transports a stereo signal, which consists of two channels, typically a left and a right side signal. Within this interface, a frame is defined to encompass all the bits that correspond to a single sampling instant. A frame consists of two subframes, one for each channel. A subframe holds the sample itself, and several additional bits which are used for synchronization, error detection and other sundry stuff. So there are three things to distinguish:

  • The sample itself (in this case up to 24 bits long)
  • The subframe, which adds some extra bits surrounding the sample
  • The frame, which encompasses a subframe for the left channel and one for the right channel.

With S/P-DIF, there's a fourth thing, the block, which holds 192 frames. This is only interesting for ancillary information ("metadata") that describes the audio to some extent.

If you only have one channel, and only the sample with no ancillary bits, then the terms 'frame' and 'sample' are synonymous.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.