PCM Sample Formats
PCM sample formats specify how audio sample values are represented and arranged in memory or storage.
A transcoding log changes from an AAC track to fltp. The sound has not acquired a new compression codec: the decoder has produced floating-point samples for processing, arranged in separate channel planes.
A sample format specifies how numbers are represented and laid out. A codec specifies how encoded information reconstructs sound. Keeping those two jobs separate makes a processing log readable.
| FFmpeg working format | Number representation | Channel storage |
|---|---|---|
| s16 | Signed 16-bit integers | Interleaved |
| s32 | Signed 32-bit integer words | Interleaved |
| flt | 32-bit floating point | Interleaved |
| fltp | 32-bit floating point | Planar |
| dblp | 64-bit floating point | Planar |
FFmpeg's native working sample formats use the host machine's byte order. Stored PCM codec names and container properties can additionally specify a particular byte order.
Repack the same stereo samples
Consider three stereo time positions:
| Time position | Left | Right |
|---|---|---|
| 0 | 0.10 | −0.10 |
| 1 | 0.20 | −0.20 |
| 2 | 0.30 | −0.30 |
An interleaved array stores 0.10, −0.10, 0.20, −0.20, 0.30, −0.30. A planar arrangement stores a left plane 0.10, 0.20, 0.30 and a right plane −0.10, −0.20, −0.30.
Every value and its time/channel association remain the same. Correctly repacking these arrays changes memory organization without changing audio. Misreading the planar arrays as interleaved would instead assign values to the wrong channel and time.
Planar processing is convenient for algorithms that operate on one channel at a time. Interleaving is convenient for interfaces that consume complete multichannel sample frames. A pipeline can legitimately convert between them several times.
Convert integer values to float
For signed 16-bit PCM, dividing a code by 32,768 maps it to the customary nominal floating-point range. Code +16,384 becomes +0.5; −32,768 becomes −1; +32,767 becomes approximately +0.9999695.
The integer format has an asymmetric positive endpoint. It is normal for its largest positive code to map slightly below +1. A reverse conversion must handle the endpoints, rounding, and any values beyond the permitted integer range.
Floating-point numbers combine a significand with an exponent. This allows processing results such as +1.2 to remain representable even though they exceed nominal audio full scale. A later stage can reduce gain before converting them to a bounded output format. If instead +1.2 reaches a stage that clips at +1, the numerical convenience of float has not prevented output distortion.
Float processing also supplies fractional precision for mixing or gain operations. It is not a claim that the original recording contained 32 useful integer bits.
Valid bits, storage width, and byte order
A system can store 24 valid bits inside a 32-bit word. For example, WAVEFORMATEXTENSIBLE describes valid precision independently from its storage container. The unused positions are not new recorded detail. A working-format label such as s32 can therefore describe the storage of decoded 24-bit audio.
Byte order is another axis. The 16-bit value 0x1234 has bytes 34 12 in little-endian order and 12 34 in big-endian order. Reading the wrong order turns 0x1234, decimal 4,660, into 0x3412, decimal 13,330. Every byte can arrive intact while the sample value is wrong.
Channel roles are independently described by the channel layout and order. Correct byte order and storage format do not identify which samples belong to the center or surrounds.
When following an Emby processing log, read a chain such as encoded AAC → planar float → downmix → integer PCM output as successive representations and operations. The working format explains the arithmetic at that stage; the input codec and output presentation tell you where those values came from and how they will be played.