[FFmpeg-cvslog] doc/encoders: Document mediacodec wrapper

Zhao Zhili git at videolan.org
Mon Jun 16 09:58:50 EEST 2025


ffmpeg | branch: master | Zhao Zhili <zhilizhao at tencent.com> | Fri Jun 13 19:43:38 2025 +0800| [e6fb8f373ea4e1f89fcdcf03578f85afbcaee23c] | committer: Zhao Zhili

doc/encoders: Document mediacodec wrapper

Reviewed-by: Marth64 <marth64 at proxyid.net>
Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e6fb8f373ea4e1f89fcdcf03578f85afbcaee23c
---

 doc/encoders.texi | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index f6f6c096ec..5595e57038 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -3342,6 +3342,75 @@ fastest.
 
 @end table
 
+ at section MediaCodec
+
+MediaCodec encoder wrapper enables hardware-accelerated video encoding on
+Android device. It supports H.264, H.265 (HEVC), VP8, VP9, MPEG-4, and AV1
+encoding (whether works or not is device dependent).
+
+Android provides two sets of APIs: Java MediaCodec and NDK MediaCodec. The
+MediaCodec encoder wrapper supports both. Note that the NDK MediaCodec API
+operates without requiring JVM, but may fail to function outside the JVM
+environment due to dependencies on system framework services, particularly
+after Android 15.
+
+ at table @option
+ at item ndk_codec @var{boolean}
+Use the NDK-based MediaCodec API instead of the Java API. Enabled by default
+if @code{av_jni_get_java_vm()} return NULL.
+
+ at item ndk_async @var{boolean}
+Use NDK MediaCodec in async mode. Async mode has less overhead than poll in a
+loop in sync mode. The drawback of async mode is AV_CODEC_FLAG_GLOBAL_HEADER
+doesn't work (use extract_extradata bsf when necessary). It doesn't work and
+will be disabled automatically on devices below Android 8.0.
+
+ at item codec_name @var{string}
+A codec type can have multiple implementations on a single device, this option
+specify which backend to use (via MediaCodec createCodecByName API). It's NULL
+by default, and encoder is created by createEncoderByType.
+
+ at item bitrate_mode @var{integer}
+
+Possible values:
+ at table @samp
+ at item cq
+Constant quality mode
+ at item vbr
+Variable bitrate mode
+ at item cbr
+Constant bitrate mode
+ at item cbr_fd
+Constant bitrate mode with frame drops
+ at end table
+
+ at item pts_as_dts @var{boolean}
+Use PTS as DTS. This is a workaround since MediaCodec API doesn't provide
+decoding timestamp. It is enabled automatically if B frame is 0.
+
+ at item operating_rate @var{integer}
+The desired operating rate that the codec will need to operate at, zero for
+unspecified. This is used for cases like high-speed/slow-motion video capture,
+where the video encoder format contains the target playback rate (e.g. 30fps),
+but the component must be able to handle the high operating capture rate (e.g.
+240fps). This rate will be used by codec for resource planning and setting the
+operating points.
+
+ at item qp_i_min @var{integer}
+Minimum quantization parameter for I frame.
+ at item qp_p_min @var{integer}
+Minimum quantization parameter for P frame.
+ at item qp_b_min @var{integer}
+Minimum quantization parameter for B frame.
+ at item qp_i_max @var{integer}
+Maximum quantization parameter for I frame.
+ at item qp_p_max @var{integer}
+Maximum quantization parameter for P frame.
+ at item qp_b_max @var{integer}
+Maximum quantization parameter for B frame.
+
+ at end table
+
 @section MediaFoundation
 
 This provides wrappers to encoders (both audio and video) in the



More information about the ffmpeg-cvslog mailing list