Media3 Transformer is actively under development and we are looking to hear from you! We welcome your feedback, feature requests and bug reports in the
issue tracker. Follow the
ExoPlayer blog for the latest updates.
Tone mapping - Supporting HDR and SDR content
Stay organized with collections
Save and categorize content based on your preferences.
When working with Transformer, it is important to consider the compatibility
between HDR and SDR content. HDR displays content with greater color detail,
color and contrast, giving users a better visual experience. However, due to the
difference in color ranges between HDR and SDR, combining the two types of
content could lead to compatibility issues.
As you are building a
Composition
,
you have the option to setHdrMode
for HDR video inputs. By default, Transformer sets this value to
HDR_MODE_KEEP_HDR
,
which ensures the output is kept in the HDR format. If the device does not
support the HDR format, Transformer automatically attempts to use
HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_OPEN_GL
instead.
In some cases, you may be combining both HDR and SDR assets. For example, you
might have SDR overlays on top of HDR videos and images, or you might have a mix
of HDR and SDR videos. In this case, you have the following options:
|
Advantages |
Disadvantages |
Tone map with MediaCodec |
Best visual quality output if supported on device and API combination. |
Only supported on API 31+ on certain devices and on API 33+ for devices
with HDR capture support. If not supported, Transformer throws an
ExportException . |
Tone map with OpenGL |
Supported on API 29+, with generally wider support across devices. Produces more consistent results. |
May produce mild differences compared to output from using
HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_MEDIACODEC . |
Interpret HDR as SDR |
Most widely supported option. |
Contents will likely have a washed out look and may be displayed incorrectly. |
Current limitations
The following are unsupported for multi-asset compositions:
- SDR to HDR tone mapping
- SDR and HDR content sequences that start with an HDR asset
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-09 UTC."],[],[],null,["# Tone mapping - Supporting HDR and SDR content\n\nWhen working with Transformer, it is important to consider the compatibility\nbetween HDR and SDR content. HDR displays content with greater color detail,\ncolor and contrast, giving users a better visual experience. However, due to the\ndifference in color ranges between HDR and SDR, combining the two types of\ncontent could lead to compatibility issues.\n\nAs you are building a\n[`Composition`](/reference/androidx/media3/transformer/Composition.Builder),\nyou have the option to [`setHdrMode`](/reference/androidx/media3/transformer/Composition.Builder#setHdrMode(int))\nfor HDR video inputs. By default, Transformer sets this value to\n[`HDR_MODE_KEEP_HDR`](/reference/androidx/media3/transformer/Composition#HDR_MODE_KEEP_HDR()),\nwhich ensures the output is kept in the HDR format. If the device does not\nsupport the HDR format, Transformer automatically attempts to use\n[`HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_OPEN_GL`](/reference/androidx/media3/transformer/Composition#HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_OPEN_GL()) instead.\n\nIn some cases, you may be combining both HDR and SDR assets. For example, you\nmight have SDR overlays on top of HDR videos and images, or you might have a mix\nof HDR and SDR videos. In this case, you have the following options:\n\n| | Advantages | Disadvantages |\n|--------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Tone map with MediaCodec](/reference/androidx/media3/transformer/Composition#HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_MEDIACODEC()) | Best visual quality output if supported on device and API combination. | Only supported on API 31+ on certain devices and on API 33+ for devices with HDR capture support. If not supported, `Transformer` throws an `ExportException`. |\n| [Tone map with OpenGL](/reference/androidx/media3/transformer/Composition#HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_OPEN_GL()) | Supported on API 29+, with generally wider support across devices. Produces more consistent results. | May produce mild differences compared to output from using `HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_MEDIACODEC`. |\n| [Interpret HDR as SDR](/reference/androidx/media3/transformer/Composition#HDR_MODE_EXPERIMENTAL_FORCE_INTERPRET_HDR_AS_SDR()) | Most widely supported option. | Contents will likely have a washed out look and may be displayed incorrectly. |\n\nCurrent limitations\n-------------------\n\nThe following are unsupported for multi-asset compositions:\n\n- SDR to HDR tone mapping\n- SDR and HDR content sequences that start with an HDR asset"]]