<p>If you are working in a video editing app like Premiere or Final Cut, when you specify a sample rate, you are specifying the audio sampling rate.  This is how many times per second the audio is going to be converted into a numeric value and stored.  So typically with video, it is 48,000 times per second (a frequency of 48kHz), or 44,100 = 44.1kHz. You need two samples to correctly measure a frequency. This means that the maximum frequency you can record in an uncompressed audio recording is usually just under half the sample rate.  This is called the <a href="https://en.wikipedia.org/wiki/Nyquist_frequency" rel="nofollow noreferrer">Nyquist frequency</a>.  So at a sample rate of 48kHz, you cannot correctly record any frequencies about 24kHz without hearing alias frequencies (incorrectly recorded lower frequencies appearing in error in your recording).</p>
<p>Pixels are not commonly referred to as samples, and a frame (whether defined as an audio frame in a file format, or as a frame of video) is different to a sample.</p>
<p>It would improve your question to say which program your code snippet comes from - someone might be able to help directly.</p>
<p>Also - bit depth is not the same as sampling - sampling is how often you measure something. Bit depth is how many numbers you use to record the measurement.  So most audio is recorded at 16, 24, or 32 bits.  So each sample in a 16 bit recording could be measured between zero and 65,536 amplitude levels.</p>

CC BY-SA 4.0
2021-02-24T16:47:16.330Z
2021-02-24T16:47:16.330Z
tomh
<p>It depends on the context. For video, it’s usually one frame. But very rarely could mean one pixel. For audio, it most often a single number that represents the instantaneous power value in the wav. Audio sample rate is the number of samples per seconds. I.e. 48000, meaning 48000 numbers are needed to play back one second of one channel of audio. Audio samples are usually 16 bit integers, or 32 bit floats, but really could be anything.</p>
<p>Open an audio file in audacity, and you can see every sample.</p>
<p>But sometimes (for example in mp4) a sample may refer to an audio “frame”. An audio frame in this context is more that one audio sample compressed into a packet. The number of samples per frame is dependent on the codec (aac is 1024 for example)</p>

CC BY-SA 4.0
2020-09-28T06:05:13.737Z
I wouldn't say that it's very rare to call a pixel a sample. Most codecs have the number of bits per sample (meaning pixel) as part of their definition, or the ratio of chroma samples to luma (e.g. the 4:2:2 in ProRes 422). Also might be worth noting that in the context of music production a sample can also refer to a sound used as a source by a sampler, for example a drum sound or note on a piano, or a loop such as the "amen break" https://www.youtube.com/watch?v=qwQLk7NcpO4
stib
CC BY-SA 4.0
2020-09-27T02:11:49.383Z
2020-09-27T02:11:49.383Z
SlimSCSI
<p>I'm studying on video processing/encoding and doing so I started looking source code of some popular related tools. And all of them has some reference to &quot;Sample&quot;</p>
<p>For example an arbitrary code has the following lines</p>
<p><code>processor::readSample()</code> <code>peocessor::sampleRate() </code></p>
<p>Now when I Google search I get fully irrelevant results.</p>
<p>Can you explain what exactly  &quot;Sample&quot; means? (It certainly is not a demo/test video file type thing)</p>

<encoding>
What exactly is a "sample" in audio/video context?
Sayem Prodhan Ananta
# What exactly is a "sample" in audio/video context?

(Asked by: username_0 on 2020-09-26)

I'm studying on video processing/encoding and doing so I started looking source code of some popular related tools. And all of them has some reference to "Sample"

For example an arbitrary code has the following lines

`processor::readSample()` `peocessor::sampleRate()`

Now when I Google search I get fully irrelevant results.

Can you explain what exactly "Sample" means? (It certainly is not a demo/test video file type thing)

**Tags:** encoding


---

## 2 answers

### Answer by username_1 on 2021-02-24. Score: 1

If you are working in a video editing app like Premiere or Final Cut, when you specify a sample rate, you are specifying the audio sampling rate. This is how many times per second the audio is going to be converted into a numeric value and stored. So typically with video, it is 48,000 times per second (a frequency of 48kHz), or 44,100 = 44.1kHz. You need two samples to correctly measure a frequency. This means that the maximum frequency you can record in an uncompressed audio recording is usually just under half the sample rate. This is called the [Nyquist frequency](https://en.wikipedia.org/wiki/Nyquist_frequency). So at a sample rate of 48kHz, you cannot correctly record any frequencies about 24kHz without hearing alias frequencies (incorrectly recorded lower frequencies appearing in error in your recording).

Pixels are not commonly referred to as samples, and a frame (whether defined as an audio frame in a file format, or as a frame of video) is different to a sample.

It would improve your question to say which program your code snippet comes from - someone might be able to help directly.

Also - bit depth is not the same as sampling - sampling is how often you measure something. Bit depth is how many numbers you use to record the measurement. So most audio is recorded at 16, 24, or 32 bits. So each sample in a 16 bit recording could be measured between zero and 65,536 amplitude levels.


---

### Answer by username_2 on 2020-09-27. Score: -1

It depends on the context. For video, it’s usually one frame. But very rarely could mean one pixel. For audio, it most often a single number that represents the instantaneous power value in the wav. Audio sample rate is the number of samples per seconds. I.e. 48000, meaning 48000 numbers are needed to play back one second of one channel of audio. Audio samples are usually 16 bit integers, or 32 bit floats, but really could be anything.

Open an audio file in audacity, and you can see every sample.

But sometimes (for example in mp4) a sample may refer to an audio “frame”. An audio frame in this context is more that one audio sample compressed into a packet. The number of samples per frame is dependent on the codec (aac is 1024 for example)

> **Comments:**
> **username_3**: I wouldn't say that it's very rare to call a pixel a sample. Most codecs have the number of bits per sample (meaning pixel) as part of their definition, or the ratio of chroma samples to luma (e.g. the 4:2:2 in ProRes 422). Also might be worth noting that in the context of music production a sample can also refer to a sound used as a source by a sampler, for example a drum sound or note on a piano, or a loop such as the "amen break" https://www.youtube.com/watch?v=qwQLk7NcpO4  

---

