A command-line Windows Media Audio encoder for Windows — a Rust port of lvqcl’s WMAEncode, extended to also emit xWMA (the RIFF format used by XAudio2 in games, à la Microsoft’s xWMAEncode). It turns WAV / raw PCM into fully-working .wma or .xwma using the built-in Windows Media Format runtime (wmvcore.dll) — the same encoder Windows itself uses — so output is maximally compatible and DRM-free. It is bidirectional: a .wma input is decoded back to WAV.
WAV/PCM -> WMA via the built-in Windows Media Format SDK (wmvcore). Supports WMA Standard, Professional, Lossless, and Voice in CBR / VBR / two-pass modes, with tagging, raw-PCM input, stdin input, stdout piping, and .xwma output.
Highlights:
- Memory-safe at the boundary. All
unsafeis confined tosrc/encoder.rsandsrc/xwma.rs(the COM/FFI boundary); the crate root sets#![deny(unsafe_code)], so every other module is compiler-guaranteed unsafe-free. (Calling the Windows Media SDK requiresunsafe; it can only be isolated and audited, not removed.) - Bug fixes vs. the original C++: tag strings include the UTF-16 NUL terminator (
WMT_TYPE_STRINGlength); 64-bit WAV offset/seek (two-pass on files > 2 GB); broken-pipe-safe stdout (--print-formats | headwon’t panic). - xWMA output with an accurate
dpdsseek table (total length exact; seek points sub-millisecond), validated by round-tripping through Microsoft’sxwmaencode.exe. - Unicode-safe. Non-ASCII filenames and tags (incl. CJK) are handled without panic or mojibake; the console output code page is set to UTF-8 at startup.
- Bidirectional. Encodes WAV→WMA/xWMA and decodes WMA→WAV and xWMA→WAV.
github.com/MSIVST/WMAEncodeRS#wmaencoders
Resources:
