色調映射 - 支援 HDR 和 SDR 內容
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
使用 Transformer 時,請務必考量相容性
HDR 和 SDR 內容之間的差別HDR 技術可以呈現更豐富的色彩細節
色彩和對比,為使用者提供更良好的視覺體驗。不過,由於
HDR 和 SDR 的色彩範圍差異,合併
都可能造成相容性問題
當您建立生成式 AI 時
Composition
,
你可以選用 setHdrMode
會用於 HDR 影片輸入裝置根據預設,轉換器會將此值設為
HDR_MODE_KEEP_HDR
,
確保輸出內容會保存為 HDR 格式。如果裝置不支援
支援 HDR 格式,Transformer 會自動嘗試使用
HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_OPEN_GL
。
在某些情況下,您可以合併 HDR 和 SDR 資產。舉例來說,
除了 HDR 影片和圖像以外
你也可以讓影片
HDR 和 SDR 影片的內容在這種情況下,您可以選擇下列做法:
|
優點 |
缺點 |
使用 MediaCodec 建立地圖 |
以裝置與 API 組合搭配時,呈現最佳視覺效果。 |
僅支援特定裝置的 API 31 以上版本和 API 33 以上版本 (裝置)
支援 HDR 拍攝功能如果不支援,Transformer 會擲回
ExportException 。 |
使用 OpenGL 建立地圖 |
支援 API 29 以上版本,可支援更廣泛的多種裝置。產生的結果更加一致。 |
相較於使用
HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_MEDIACODEC 。 |
將 HDR 解讀為 SDR |
支援最廣泛的選項。 |
內容看起來可能看起來已完全褪色,以錯誤的方式顯示。 |
目前限制
多資產樂曲不支援以下做法:
- 從 SDR 到 HDR 的色調映射
- 以 HDR 資產開頭的 SDR 和 HDR 內容序列
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],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"]]