Enable system level decoding of Dolby AC3/EC3 in Chromium (Windows and macOS only for now).
English | 简体中文
AC3 and EC3 are Dolby's audio coding formats, it's Dolby's IP and can not be integrated into Chromium (Chromium use FFMPEG decode codec AAC/FLAC/WAV etc..).
Since Windows 8, Microsoft preload AC3/EC3 decoder in windows image as MFT(Media Foundation Transform). Third party can use it to decode ac3/ec3 audio by load MFT manually. This gives us a chance to use it in Chromium.
AC3 codec has been supported since macOS 10.2, and EC3 codec has been supported since macOS 10.11. Using AudioToolbox and CoreAudio, third party now have the ability to integrate the support without loyalty issue, and Chromium can also use this way to do the decoding job.
Natively Chromium use FFMPEG as it's decoder factory. And Chromium also support Mojo Audio Decoder, if target format is not supported by FFMPEG, Chromium will try to find platfrom decoder, it's a kind of Mojo Audio Decoder.
MediaFoundationAudioDecoder is an implementation of Mojo Audio Decoder on Windows, Dolby Audio Decoder MFT will be selected by input audio format internally.
AudioToolboxAudioDecoder is also an implementation of Mojo Audio Decoder on macOS, it will use system decoder to do the decoding job.
Even if code for support AC3/EC3 playback integrated in Chromium, but all of them are disabled by default.
Here are change lists:
- Add Dolby AC3, EC3 codec support on Windows Platform
- Implement AC3 / E-AC3 audio codec support for macOS
You have to turn build flag enable_platform_ac3_eac3_audio
enabled on your custom build.
Here is a sample GN args for build Chromium:
# //arg.gn
is_clang=true
enable_nacl=false
ffmpeg_branding="Chrome"
proprietary_codecs=true
enable_platform_ac3_eac3_audio = true
enable_platform_ac3_eac3_audio
is a new build flag for controlling AC3,EC3 support on or off.
Since build chromium will spend much time, We already created builds and attached them on Github. You can download them and try this feature.
Here is used full GN args, you can also use below args to build on your machine.
# Set build arguments here. See `gn help buildargs`.
is_debug=false
is_clang=true
is_component_build=false
is_official_build=true
enable_nacl=false
symbol_level=0
ffmpeg_branding="Chrome"
proprietary_codecs=true
enable_platform_ac3_eac3_audio = true
target_cpu = "x64"
const audioConfiguration = {
type: "media-source",
audio: {
// for AC3, use 'ac-3'
// for EC3, use 'ec-3'
contentType: 'audio/mp4; codecs="ac-3"',
// spatialRendering is not supported by Chromium.
// This field will be ignored internally.
spatialRendering: true
},
};
navigator.mediaCapabilities
.decodingInfo(audioConfiguration)
.then((result) => {
console.log(
`Dolby AC3 is ${result.supported ? "" : "not "}supported,`
);
})
.catch(() => {
console.log(`decodingInfo error: ${contentType}`);
});
// for AC3, use 'ac-3'
// for EC3, use 'ec-3'
if (MediaSource.isTypeSupported('audio/mp4; codecs="ac-3"')) {
console.log('Dolby AC3 is supported!');
}
// for AC3, use 'ac-3'
// for EC3, use 'ec-3'
let obj = document.createElement("video");
if (obj.canPlayType('audio/mp4; codecs="ac-3"') === 'probably') {
console.log('Dolby AC3 is supported!');
}
You can play below content on this readme page. If it can be play, means your browser support AC3/EC3 decoding.
bear-eac3-only-frag.mp4
bear-ac3-only-frag.mp4
bilibili supoorts stream EC3 content on Safari on macOS, if you change Chromium's user-agent to Safari's, it will stream EC3 content too.
If you have bilibili account, you can try it.
Change your user-agent: User-Agent Switcher and Manager
If on system decoding is working, the Dolby MFT will be loaded by Chromium. You can use some tool to dump Chromium loaded modules.
Take listdll.exe as example: Download listdll
listdll.exe chrome.exe
if module C:\Windows\System32\DolbyDecMFT.dll
is loaded, it means Dolby AC3/EC3 decoding worked.
If you have any problems when using this feature, please open an issue without hesitation! Thanks!