Entropy coding and bitrate
Entropy coding is one reason compressed media does not naturally use the same number of bits for every moment.
Short version
Huffman coding and related entropy coders turn symbols into compact bit patterns. Easy-to-describe material usually needs fewer bits. Hard-to-describe material usually needs more bits. Bitrate modes such as CBR, VBR, and ABR are ways for an encoder to manage that uneven demand.
Two different layers
It helps to separate two ideas:
| Layer | Question it answers | Example |
|---|---|---|
| Entropy coding | How many bits are needed to write these symbols? | Huffman coding, CAVLC, CABAC, arithmetic/range coding. |
| Rate control | How many bits should this frame, block, or second be allowed to use? | CBR, VBR, ABR, bitrate ladders. |
Entropy coding is the packing mechanism. Rate control is the budget manager. They affect each other, but they are not the same thing.
MP3 as an example
In MP3, audio is analysed, transformed, quantized, and then Huffman-coded. If a frame is complex, the encoder may need more bits to code it cleanly. If it is simple, it may need fewer bits.
That is why VBR and ABR can be useful. VBR lets the file spend bits where they are most useful. ABR also allows variation, but steers the whole encode toward a chosen average bitrate.
Not all modern codecs use Huffman
Huffman coding is one of the classic entropy coders, but later media codecs often use other methods. H.264 can use CAVLC or CABAC. HEVC uses CABAC. AV1 uses newer entropy coding. The shared idea remains the same: use statistical structure to spend fewer bits.