Troubleshooting


Why can't I access local files in the demo app?

Scoped storage enforcement from Android 11 (API level 30) prevents direct file system access. For manual testing during development, it's possible to access local files by adding the manage external storage permission in the demo app manifest:

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

Then grant the permission via adb:

adb shell appops set --uid androidx.media3.demo.transformer \
    MANAGE_EXTERNAL_STORAGE allow

Why does exporting fail on a specific device?

Please file an issue on the Media3 issue tracker with enough information to reproduce the issue. Workarounds for device-specific issues can be added to the library to improve compatibility over time.

Does Transformer support transforming (or recording) remote media?

Transformer supports remote progressive streams, including media file containers like MP4.

In very poor network conditions, exporting may fail because buffering remote media for too long triggers checks in the muxer that are intended to identify that the pipeline is stuck. You can override the default behavior by changing the muxer configuration as follows:

Kotlin

Transformer.Builder(context)
    .setMuxerFactory(DefaultMuxer.Factory(/* maxDelayBetweenSamplesMs= */ C.TIME_UNSET))
    .build()

Java

new Transformer.Builder(context)
    .setMuxerFactory(new DefaultMuxer.Factory(/* maxDelayBetweenSamplesMs= */ C.TIME_UNSET))
    .build();

Passing in C.TIME_UNSET removes the timeout entirely, but if your app runs on chipsets where MediaCodec can get stuck you may want to set a larger non-zero timeout.

Does Transformer support 8k input?

Transformer is implemented in a format-agnostic way, so it doesn't limit handling of 8k video, but hardware capabilities on the device may mean that exporting can't succeed. For example, even on devices that can capture 8k, it might not be possible to decode and re-encode an 8k video due to exceeding the available hardware codec or RAM resources.

How does Transformer relate to platform compatible media transcoding?

Compatible media transcoding is an Android platform feature from Android 12 (API level 31) that converts media up to one minute in length into formats supported by the app. If you opt-in to using this feature, reading a media file in an incompatible format causes it to be transcoded on demand, and the result is cached for later read operations.

Transformer also supports format conversion, but it's available as a support library and the app has full control over the transcoding operation.

How can I reduce export latency or increase throughput?

Transformer relies on MediaCodec for hardware-accelerated decoding and encoding, and OpenGL for processing video frames. Based on our measurements on typical devices, the limiting factor in Transformer's throughput is hardware MediaCodec encoder throughput for use cases without heavyweight effects processing. This is likely to impact other implementations in the same way. For example, the platform compatible transcoding feature has similar performance to Transformer.

The demo app's debug preview significantly reduces throughput, so turn off the preview feature when testing with a release build of the demo app to get a realistic idea of performance.