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Β
unsafeΒ is confined toΒ src/encoder.rsΒ andΒ src/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 requiresΒ unsafe; 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_STRINGΒ length); 64-bit WAV offset/seek (two-pass on files > 2 GB); broken-pipe-safe stdout (--print-formats | headΒ won’t panic).
- xWMA outputΒ with an accurateΒ
dpdsΒ seek table (total length exact; seek points sub-millisecond), validated by round-tripping through Microsoft’sΒ xwmaencode.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:
github.com/misgender/WMAEncode