How Android MediaCodec Exposes AV1 Decoders
This article provides an overview of how the Android MediaCodec framework identifies, prioritizes, and exposes both hardware and software AV1 video decoders to applications. It covers the underlying Codec 2.0 (C2) architecture, the standard component naming conventions, how developers query decoder capabilities via system APIs, and how Android manages fallback behavior between vendor hardware implementations and built-in software decoders like libgav1 and dav1d.
The Unified MIME Type Architecture
Android handles all AV1 decoding under a single standardized media
type: video/av01. When an application requests an AV1
decoder, the MediaCodec framework does not initially
require the app to know whether the processing will occur on a dedicated
hardware chip or through the CPU.
Instead, the framework acts as an abstraction layer over Android’s
Codec 2.0 (C2) framework (or the legacy OpenMAX IL layer on older
versions). The system maintains an internal media codec registry parsed
from system XML configuration files (such as
/vendor/etc/media_codecs.xml and
/system/etc/media_codecs.xml). When initialized,
MediaCodec reads these registries to index all available
AV1 decoder components, their performance ratings, and their supported
profiles.
Hardware vs. Software Naming Conventions
The MediaCodec framework distinguishes hardware and software decoders using standardized component names:
- Software Decoders: Typically prefixed with
c2.android.(for Codec 2.0) orOMX.google.(for OpenMAX). Android originally introduced AV1 software decoding viac2.android.av1.decoderusinglibgav1. In modern Android updates, Google has integrated VideoLAN’sdav1dsoftware decoder, exposing it via the Mainline Media modular system update framework under names such asc2.android.av1-dav1d.decoder. - Hardware Decoders: Prefixed by device
system-on-chip (SoC) vendors. Common examples include
c2.qti.av1.decoder(Qualcomm),c2.exynos.av1.decoder(Samsung), orc2.mtk.av1.decoder(MediaTek). Hardware implementations interact directly with dedicated visual processing units (VPUs) to minimize CPU usage and power consumption.
Discovery and Enumeration via MediaCodecList
Applications discover which AV1 decoders are present on a device
through the MediaCodecList class. Android exposes decoder
properties through MediaCodecInfo, allowing developers to
programmatic inspect the hardware status:
MediaCodecInfo.isHardwareAccelerated(): Returnstrueif the underlying component is a vendor-supplied hardware implementation.MediaCodecInfo.isSoftwareOnly(): Returnstrueif the component executes entirely on the CPU (e.g., standard Android C2 software fallbacks).MediaCodecInfo.isVendor(): Distinguishes OEM/SoC implementations from default Android open-source components.
When calling
MediaCodec.createDecoderByType("video/av01"), Android
automatically resolves the call by returning the component with the
highest internal ranking that supports the requested MIME type. The
framework systematically ranks hardware decoders higher than software
fallbacks, ensuring efficient decoding whenever dedicated hardware
support exists.
Profile, Level, and Capability Negotiation
AV1 decoders exposed via MediaCodec specify exact format limits
through MediaCodecInfo.CodecCapabilities. Android maps AV1
standard profiles (Main Profile, High Profile, and Professional Profile)
to integer constants defined within
MediaCodecInfo.CodecProfileLevel:
AV1ProfileMain8: 8-bit 4:2:0 content.AV1ProfileMain10: 10-bit 4:2:0 content, required for AV1-based High Dynamic Range (HDR) workflows including HDR10, HDR10+, and HLG.
Hardware decoders advertise specific performance constraints, such as
maximum supported resolution (e.g., 4K or 8K) and maximum frame rates,
through VideoCapabilities. If a requested video stream
exceeds the capabilities of a hardware decoder (such as a 4K 10-bit
stream on a chip that only supports 1080p AV1 hardware decoding),
MediaCodecList.findDecoderForFormat() allows an application
to selectively fall back to a software decoder capable of handling the
target configuration.