Understand Android encoder fallback behavior
masterOn some Android devices, the hardware H.264 encoder (h264_mediacodec) may fail to configure. The library automatically handles this via a transparent three-step fallback chain:
h264_mediacodec: Default hardware H.264. Fast, keeps source resolution.hevc_mediacodec: Hardware H.265/HEVC. Used if H.264 fails. Includes-tag:v hvc1for iOS compatibility.mpeg4 -q:v 3: Software MPEG-4 Part 2. Guaranteed to work but lower quality. Note: Output is downscaled to a maximum long side of1280pxto ensure compatibility with Android software decoders.
Monitoring Fallbacks:
- Logs are emitted via
onLog(tagVideoTrimmerUtil) asEncoder selected: <name>, etc. - If a hardware fallback occurs, a notice is emitted:
Hardware encoder failed; retrying with software encoder fallback. - If all attempts fail during
showEditorsave,onErroris emitted witherrorCode: "HARDWARE_ENCODER_FAILED".