rusty_aac
A pure-Rust AAC-LC decoder and encoder. Zero dependencies, no C, no FFI, Apache-2.0.
- Decoder — complete AAC-LC: long/short/transition windows with grouped scalefactors, all spectral Huffman codebooks, M/S and intensity stereo, PNS, TNS. Verified against FFmpeg: bit-exact on deterministic features.
- Encoder — to our knowledge the first pure-Rust AAC encoder on
crates.io (the alternatives,
fdk-aacand libxaac bindings, are C FFI). Psychoacoustic Bark-scale masking model, transient-driven block switching, per-band M/S stereo, and a two-phase bitrate rate loop. ~450× realtime / ~6× faster than FFmpeg's AAC encoder on a 24-core machine via frame-parallel encoding (~1.15× single-thread), with an N/4-FFT MDCT and AVX2 (opt-in AVX-512) quantize kernels. FFmpeg decodes its output at unity gain. --no-default-featuresturns off the runtime-detected SIMD kernels and gives a 100%-safe scalar build (#![forbid(unsafe)]-grade: everyunsafeblock in the crate is feature-gated SIMD).
Patents
AAC-LC is the oldest, largely-expired, lowest-risk corner of the AAC family — this crate implements only AAC-LC (no HE-AAC/SBR/PS, no xHE-AAC, which carry much younger patents). The code is independently written and Apache-2.0-licensed, but no patent license is granted or implied by the copyright license. If you distribute products commercially, consult IP counsel about your own position; see the main repo's patent notes. This is engineering context, not legal advice.
Decode
use ;
Encode
use ;
Features
| feature | default | effect |
|---|---|---|
simd |
yes | runtime-detected AVX2 quantize/x^0.75 kernels (bit-exact vs scalar) |
simd-avx512 |
no | adds an 8-lane AVX-512 tier (needs Rust ≥ 1.89; falls back at runtime) |
Part of Remade With Rust
rusty_aac is the standalone AAC engine of
remade_ffmpeg_rs — a
ground-up, permissively-licensed Rust rebuild of FFmpeg. Sister project:
FFAI — media for an AI-first
world. More at github.com/remade-with-rust.
Sibling codec crates: rusty_h264,
rusty_vp9,
rusty_mp3,
rusty-opus, rusty_vorbis, and the
rusty-av1-toolkit forks.
About Mata Network
Mata Network builds sovereign, self-hostable infrastructure. Remade With Rust is our open-source home for the permissively-licensed building blocks that work depends on.
License
Apache-2.0. See LICENSE.