Lossless Ogg Compression: balrogg Shrinks Vorbis 10-15%

NVIDIA is buying Hugging Face for $12.9 billion today. Meanwhile, a one-person demoscene coder shipped a 904 KB C binary that squeezes already-compressed audio files another 15% — losslessly. balrogg 1.0 recompresses Ogg Vorbis and Opus bitstreams with adaptive context models instead of generic entropy coding. I built it from source, ran it on a 9.9 MB classical recording, and every single round-trip came back bit-exact. The claim survives contact: 10.35% smaller Vorbis and 4.49% smaller Opus, where gzip and xz both top out under 1%. Here's how it works and where it hurts.

What Is balrogg: Lossless Ogg Recompression, Not Transcoding

balrogg 1.0 (GPLv3, by Kamila Szewczyk, released September 3, 2026) doesn't decode audio to PCM and re-encode it — that would be lossy and illegal for archival. It decodes the codec's own bitstream: for Opus it uses a parser derived from libopus, and each entropy-coded symbol gets its original probability table as a prior; for Vorbis it rebuilds the packet stream and models it symbol-by-symbol. A context-mixing compressor (there's an SSE2 mixer in the core) predicts the next bit, a range coder emits the residual, and the result is a new container with the identical decoded audio. The archive format is solid, with header streams deduplicated. If the encoder can't reproduce a file exactly — bad CRC, truncated pages, unsupported features — it refuses with exit code 1 rather than silently corrupting.

graph TD
  A[Ogg file] --> B[Codec parser: Vorbis / libopus-derived]
  B --> C[Symbol stream with per-symbol priors]
  C --> D[Context-mixing bit predictor + range coder]
  D --> E[.blr archive: solid, header streams deduped]
  E -->|decode| F[Bit-exact original Ogg]

Benchmarks: 10.35% Smaller Vorbis, Bit-Exact Round-Trips

I built from the release tarball (autotools, C99, no deps beyond libc and libm) and generated test files with ffmpeg from a 5:19 Brandenburg Concerto source: Vorbis at 256 kb/s, q5, and q0, plus Opus at 96 and 128 kb/s, a white-noise torture file, and a 9 KB speech file. Every encode was verified by decoding and comparing MD5 hashes.

All seven files: LOSSLESS, MD5-identical after decode. My build's archives decode byte-identically with the official release binary and vice versa — portability claim holds. gzip -9 and xz -9 on the same 9.9 MB file: 0.65% and 0.40%. The gap between 0.4% and 10.35% is the entire point: generic compressors see entropy, balrogg sees structure.

Speed Reality Check: Default -9 Is Archival-Only

The README quotes 2.9 MB/s at -9; on my 2-core Xeon Silver 4310T VM I measured 57 KB/s on the 9.9 MB file — 50x slower. The -9 default is a trap for casual use. Effort levels on bach_q0.ogg:

Notice anything? -6 and -9 produce the same archive. Higher levels only expand the parameter search, so on content that converges early you pay 4.5x for zero bytes. For batch jobs: -2 gets 96% of the win at 14x the speed, and levels -4 through -9 decode at identical speed, so compression ratio is free on the read side.

Edge Cases: It Refuses Rather Than Corrupts

Corruption and boundary handling are where lossless tools prove their spine. balrogg passed everything:

One real limitation: Opus support is mono/stereo family-0 only — multichannel and chained Opus are refused outright. If your archive contains 5.1 Opus, balrogg currently can't help.

Bottom Line: Who Should Use balrogg

balrogg 1.0 is a serious archival tool for Ogg collections — 10-15% Vorbis savings with verified bit-exact restore beats every generic compressor by an order of magnitude. Batch mode runs files in parallel, the archive format is portable, and refusal-on-doubt means it never quietly betrays you. The rough edges are the default -9 effort (start at -2), the Opus stream-family limitation, and a throughput that will make you schedule, not stream. Music archives, field recordings, and podcast bulk — this is your migration path.