How to Decode WMA Professional Audio in FFmpeg
This article provides a quick overview of how to play back and convert Windows Media Audio (WMA) Professional and WMA Voice codecs using FFmpeg. While FFmpeg natively supports the standard WMA Pro decoder, handling specific voice profiles or multi-channel configurations requires precise command-line arguments to ensure compatible playback and high-quality audio conversion.
Decoding WMA Professional Audio
FFmpeg includes a native decoder for WMA Professional called
wmapro. In most cases, FFmpeg will automatically detect
this codec when reading a file. To verify if your FFmpeg installation
supports it, you can run the following command to check your
decoders:
ffmpeg -decoders | grep wmaIf wmapro is listed, FFmpeg can decode and play the file
natively. To play a WMA Pro file directly from your terminal using
FFplay, run:
ffplay input.wmaConverting WMA Pro to Compatible Formats
Because WMA Pro is not widely supported on non-Windows platforms, converting it to a standard format like AAC or MP3 is highly recommended for web playback or mobile device compatibility.
To convert a WMA Pro file to a high-quality AAC file, use the following command:
ffmpeg -i input.wma -c:a aac -b:a 192k output.m4aTo convert it to MP3:
ffmpeg -i input.wma -c:a libmp3lame -q:a 2 output.mp3Handling Multi-Channel WMA Pro Files
WMA Pro is frequently used for multi-channel (5.1 or 7.1 surround
sound) audio. If you are converting a multi-channel WMA Pro file for
playback on standard stereo speakers or mobile devices, you should
downmix the audio channels to stereo (2 channels) using the
-ac flag:
ffmpeg -i input.wma -c:a aac -ac 2 output.m4aAddressing WMA Voice Codec Compatibility
WMA Voice (often used for speech-heavy content and low-bitrate streams) is different from standard WMA Pro. FFmpeg has limited native decoding support for certain legacy WMA Voice codecs (specifically WMA9 Voice).
If you encounter an “unsupported codec” error when trying to process a WMA Voice file, you may need to use a Windows-based FFmpeg build that can access system-level DirectShow filters, or convert the file on a Windows environment using the system’s native Media Foundation decoders before importing it into FFmpeg.