Media3 Transformer
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Transformer 是一種編輯媒體的 API,可用於編輯媒體,包括轉換格式 (轉碼)、套用變更,例如將較長的影片剪輯成剪輯、剪裁影片影格的一部分、套用自訂效果及其他編輯作業。屬於 Jetpack Media3 的一部分。
Transformer 與 Android 5.0 Lollipop (API 級別 21) 以上版本相容,並提供相關解決方法,以便在 Android 版本和不同裝置上讓行為更加一致。這個 API 會在 MediaCodec
之上實作,用於硬體加速影片解碼和編碼;OpenGL 則用於圖像修改。Transformer 支援格式轉換和立即可用的多種編輯類型,但如果您需要進一步控制,也可以完全自訂或取代管道中的各種元件。舉例來說,影片編碼可以搭配預設設定使用,但您也可以傳遞自訂影片編碼器設定或替換編碼器工廠,完全掌控編碼器的使用方式。
您可以前往「開始使用」頁面,瞭解如何在應用程式中使用 Transformer,並試用試用版應用程式。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","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-26 (世界標準時間)。"],[],[],null,["# Media3 Transformer\n\nTransformer is an API for editing media, including converting between formats\n(transcoding), applying changes like trimming a clip from a longer video,\ncropping a portion of the video frame, applying custom effects, and other\nediting operations. It's part of [Jetpack Media3](/guide/topics/media/media3).\n\nTransformer is compatible with Android 5.0 Lollipop (API level 21) and higher,\nand includes workarounds to get more consistent behavior across Android versions\nand different devices. The API is implemented on top of `MediaCodec` for\nhardware-accelerated video decoding and encoding, and OpenGL for graphical\nmodifications. Transformer supports format conversions and several types of\nedits out of the box, but you can also customize or replace various components\nin the pipeline entirely if you need more control. For example, video encoding\nworks with default settings, but you can also pass custom video encoder settings\nor replace the encoder factory to get complete control over how encoders are\nused.\n\nLearn how to use Transformer in your app on the [getting\nstarted](/media/media3/transformer/getting-started) page, and try out the [demo app](/media/media3/transformer/demo-application)."]]