After the header, a Shorten stream is a list of
commands, each a uvar(2). Six commands carry a block of samples for one channel.
Blocks arrive one channel at a time, in channel order, and the other four commands change
settings or end the stream.
The commands
| Value | Name | Arguments | Meaning |
|---|---|---|---|
| 0 | DIFF0 | Energy, residuals | A block with predictor order 0 |
| 1 | DIFF1 | Energy, residuals | A block with predictor order 1 |
| 2 | DIFF2 | Energy, residuals | A block with predictor order 2 |
| 3 | DIFF3 | Energy, residuals | A block with predictor order 3 |
| 4 | QUIT | None | The end of the stream |
| 5 | BLOCKSIZE | New size | Change the number of samples in later blocks |
| 6 | BITSHIFT | Shift | Change how far samples are shifted left |
| 7 | QLPC | Energy, order, coefficients, residuals | A block with linear prediction |
| 8 | ZERO | None | A block of zero samples |
| 9 | VERBATIM | Length, bytes | Bytes copied from the original file |
Any higher value is invalid, and FFmpeg stops decoding at it. The prediction page describes how the samples are rebuilt.
Audio commands
DIFF0 to DIFF3 and QLPC share this layout. ZERO has no arguments at all.
| Field | Code | Meaning |
|---|---|---|
| Energy | uvar(3) | The Rice parameter for the residuals. In version 0 subtract 1 from it. FFmpeg rejects values above 30 |
| Order | uvar(2) | QLPC only: the number of coefficients. Cannot exceed the wrap length |
| Coefficients | svar(5) each | QLPC only: the coefficients, with 5 fractional bits |
| Residuals | svar(energy) each | One for each sample in the block |
Setting commands
| Command | Field | Code | Meaning |
|---|---|---|---|
| BLOCKSIZE | New size | ulong from version 1, using uvar(⌊log₂ block size⌋) in version 0 | FFmpeg rejects an increase, and sizes of 0 or above 65,535 |
| BITSHIFT | Shift | uvar(2) | Samples are multiplied by 1 << shift. FFmpeg rejects a shift above 32; a shift of 32 gives zero samples |
| QUIT | The end of the stream |
Verbatim command
| Field | Code | Meaning |
|---|---|---|
| Length | uvar(5) | Bytes that follow |
| Bytes | uvar(8) each | One value per byte of the original file |