2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
동영상 인코딩 통계 내보내기
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Android 13부터 앱 클라이언트는 동영상 인코더에 각 인코딩된 동영상 프레임의 인코딩 통계를 내보내도록 요청할 수 있습니다. 동영상 인코더로부터 얻은 통계를 활용하면 앱은 인코딩 전에 멀티패스 인코딩 및 프레임 사전 처리와 같은 동영상 인코딩 작업을 최적화할 수 있습니다.
동영상 인코딩 통계를 내보내려면 SoC 공급업체가 동영상 인코더 드라이버 업데이트에 설명된 대로 동영상 인코더 드라이버를 변경해야 합니다.
동영상 인코딩 통계 데이터
Android 13에서는 동영상 인코더가 다음 표에 표시된 것처럼 통계 데이터를 내보냅니다.
인코더 통계 이름 |
설명 |
프레임당 평균 블록 QP
|
비트스트림으로 인코딩된 동영상 프레임의 모든 블록 QP의 평균입니다.
|
사진 유형
|
유형 I, P 또는 B
|
개발자는 MediaFormat
개발자 클래스를 사용하여 각 프레임의 통계 정보를 검색할 수 있습니다.
동영상 인코더 드라이버 업데이트
동영상 인코딩 통계 내보내기를 지원하려면 SoC 공급업체가 동영상 인코더 드라이버를 변경해야 합니다. 다음 키는 Android 13의 Codec 2.0 기반에 추가됩니다.
참조 구현은 VideoEncodingStatisticsTest
를 참고하세요.
확인
VideoEncodingStatisticsTest
CTS 테스트를 실행하여 동영상 인코딩 통계의 평균 QP 부분이 올바르게 작동하는지 확인: CTS는 동일한 입력 동영상의 두 가지 인코딩을 실행합니다. 하나는 비트 전송률이 높고, 다른 하나는 비트 전송률이 더 낮습니다. 그러면 CTS는 두 인코딩에서 내보낸 두 개의 평균 QP 값을 비교합니다. 비트 전송률이 낮은 인코딩의 평균 QP가 비트 전송률이 높은 인코딩의 평균 QP보다 높은 경우 CTS는 통과합니다.
동영상 인코딩 통계 내보내기 기능이 사용 설정된 경우 이를 사용 중지하는 기능을 확인하려면 VIDEO_ENCODING_STATISTICS_LEVEL_NONE
키를 다음과 같이 사용합니다.
format.setInteger(MediaFormat.KEY_VIDEO_ENCODING_STATISTICS_LEVEL, MediaFormat.VIDEO_ENCODING_STATISTICS_LEVEL_NONE);
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Export video encoding statistics\n\nStarting with Android 13, app clients can request the\nvideo encoder to export encoding statistics for each encoded video frame. With\nthe statistics obtained from the video encoder, apps can optimize their video\nencoding tasks such as multipass encoding and frame preprocessing prior to\nencoding.\n\nTo export video encoding statistics, SoC vendors must change the video encoder\ndriver as described in [Updates to the video encoder driver](#updates-encoder).\n\nVideo encoding statistics data\n------------------------------\n\nWith Android 13, the video encoder exports statistics\ndata as shown in the following table.\n\n| Name of encoder statistics | Description |\n|----------------------------|-------------------------------------------------------------------------------------|\n| Average block QP per frame | The average of all block QPs in the video frame that are encoded into the bitstream |\n| Picture type | Type I or P or B |\n\nDevelopers can retrieve statistics information for each frame by using the\n[`MediaFormat`](https://developer.android.com/reference/android/media/MediaFormat)\ndeveloper class.\n\nUpdates to the video encoder driver\n-----------------------------------\n\nTo support the export of video encoding statistics, SoC vendors must change the\nvideo encoder driver. The following keys are added in the Codec 2.0 base in\nAndroid 13:\n\n- [`KEY_VIDEO_QP_AVERAGE`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/media/java/android/media/MediaFormat.java;drc=5ad6db77423479d027abb791ad3c02da39513a2c;l=1154) describes the per-frame\n average block QP.\n\n The following rules apply to the implementation of the `KEY_VIDEO_QP_AVERAGE`\n key:\n - The SoC encoder must round the average of the block QPs to the nearest\n integer before emitting to Codec 2.0.\n\n - The average value is computed only from a luma plane.\n\n - The SoC encoder must return `INT_MAX` if all the blocks in the current\n frame are in the skipped mode. This condition occurs when no coefficients are\n encoded and no significant QP info is encoded in the frame.\n\n- [`KEY_PICTURE_TYPE`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/media/java/android/media/MediaFormat.java;drc=5ad6db77423479d027abb791ad3c02da39513a2c;l=1163)\n describes the picture type of the encoded frame as [`PICTURE_TYPE_I`](https://developer.android.com/reference/android/media/MediaFormat#PICTURE_TYPE_I),\n [`PICTURE_TYPE_P`](https://developer.android.com/reference/android/media/MediaFormat#PICTURE_TYPE_P),\n [`PICTURE_TYPE_B`](https://developer.android.com/reference/android/media/MediaFormat#PICTURE_TYPE_B),\n or [`PICTURE_TYPE_UNKNOWN`](https://developer.android.com/reference/android/media/MediaFormat#PICTURE_TYPE_UNKNOWN).\n\n- [`KEY_VIDEO_ENCODING_STATISTICS_LEVEL`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/media/java/android/media/MediaFormat.java;drc=5ad6db77423479d027abb791ad3c02da39513a2c;l=1122) describes the level of\n encoding statistics information emitted from video encoder, as follows:\n\n - When the encoder generates no information about encoding statistics,\n this key is set to [`VIDEO_ENCODING_STATISTICS_LEVEL_NONE`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/media/java/android/media/MediaFormat.java;drc=5ad6db77423479d027abb791ad3c02da39513a2c;l=1129).\n\n - When the encoder generates `KEY_VIDEO_QP_AVERAGE` and `KEY_PICTURE_TYPE`\n for each frame, this key is set to [`VIDEO_ENCODING_STATISTICS_LEVEL_1`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/media/java/android/media/MediaFormat.java;drc=5ad6db77423479d027abb791ad3c02da39513a2c;l=1136).\n\nSee [`VideoEncodingStatisticsTest`](https://cs.android.com/android/platform/superproject/+/android-latest-release:cts/tests/tests/media/codec/src/android/media/codec/cts/VideoEncodingStatisticsTest.java;drc=77bafd18279c8d6dad49fd74dac2e369fdc6ba69;l=56)\nfor a reference implementation.\n\nValidation\n----------\n\nRun the [`VideoEncodingStatisticsTest`](https://cs.android.com/android/platform/superproject/+/android-latest-release:cts/tests/tests/media/codec/src/android/media/codec/cts/VideoEncodingStatisticsTest.java;drc=77bafd18279c8d6dad49fd74dac2e369fdc6ba69;l=56)\nCTS test to validate that the average QP part of the video encoding statistics\nworks correctly: CTS runs two encodings of the same input video, one with a\nhigher bitrate, and another with a lower bitrate. CTS then compares the two\nexported average QP values from the two encodings. If the average QP from the encoding\nwith the lower bitrate is higher than the average QP from the encoding with the\nhigher bitrate, CTS passes.\n\nTo validate turning off the exporting video encoding statistics feature when\nenabled, use the `VIDEO_ENCODING_STATISTICS_LEVEL_NONE` key as follows: \n\n format.setInteger(MediaFormat.KEY_VIDEO_ENCODING_STATISTICS_LEVEL, MediaFormat.VIDEO_ENCODING_STATISTICS_LEVEL_NONE);"]]