Unified · Split
| @@ -3342,6 +3342,75 @@ fastest. · 3341 unmodified lines | |||
| 3342 | 3342 | ||
| 3343 | @end table | 3343 | @end table |
| 3344 | 3344 | ||
| 3345 | @section MediaCodec | ||
| 3346 | |||
| 3347 | MediaCodec encoder wrapper enables hardware-accelerated video encoding on | ||
| 3348 | Android device. It supports H.264, H.265 (HEVC), VP8, VP9, MPEG-4, and AV1 | ||
| 3349 | encoding (whether works or not is device dependent). | ||
| 3350 | |||
| 3351 | Android provides two sets of APIs: Java MediaCodec and NDK MediaCodec. The | ||
| 3352 | MediaCodec encoder wrapper supports both. Note that the NDK MediaCodec API | ||
| 3353 | operates without requiring JVM, but may fail to function outside the JVM | ||
| 3354 | environment due to dependencies on system framework services, particularly | ||
| 3355 | after Android 15. | ||
| 3356 | |||
| 3357 | @table @option | ||
| 3358 | @item ndk_codec @var{boolean} | ||
| 3359 | Use the NDK-based MediaCodec API instead of the Java API. Enabled by default | ||
| 3360 | if @code{av_jni_get_java_vm()} return NULL. | ||
| 3361 | |||
| 3362 | @item ndk_async @var{boolean} | ||
| 3363 | Use NDK MediaCodec in async mode. Async mode has less overhead than poll in a | ||
| 3364 | loop in sync mode. The drawback of async mode is AV_CODEC_FLAG_GLOBAL_HEADER | ||
| 3365 | doesn't work (use extract_extradata bsf when necessary). It doesn't work and | ||
| 3366 | will be disabled automatically on devices below Android 8.0. | ||
| 3367 | |||
| 3368 | @item codec_name @var{string} | ||
| 3369 | A codec type can have multiple implementations on a single device, this option | ||
| 3370 | specify which backend to use (via MediaCodec createCodecByName API). It's NULL | ||
| 3371 | by default, and encoder is created by createEncoderByType. | ||
| 3372 | |||
| 3373 | @item bitrate_mode @var{integer} | ||
| 3374 | |||
| 3375 | Possible values: | ||
| 3376 | @table @samp | ||
| 3377 | @item cq | ||
| 3378 | Constant quality mode | ||
| 3379 | @item vbr | ||
| 3380 | Variable bitrate mode | ||
| 3381 | @item cbr | ||
| 3382 | Constant bitrate mode | ||
| 3383 | @item cbr_fd | ||
| 3384 | Constant bitrate mode with frame drops | ||
| 3385 | @end table | ||
| 3386 | |||
| 3387 | @item pts_as_dts @var{boolean} | ||
| 3388 | Use PTS as DTS. This is a workaround since MediaCodec API doesn't provide | ||
| 3389 | decoding timestamp. It is enabled automatically if B frame is 0. | ||
| 3390 | |||
| 3391 | @item operating_rate @var{integer} | ||
| 3392 | The desired operating rate that the codec will need to operate at, zero for | ||
| 3393 | unspecified. This is used for cases like high-speed/slow-motion video capture, | ||
| 3394 | where the video encoder format contains the target playback rate (e.g. 30fps), | ||
| 3395 | but the component must be able to handle the high operating capture rate (e.g. | ||
| 3396 | 240fps). This rate will be used by codec for resource planning and setting the | ||
| 3397 | operating points. | ||
| 3398 | |||
| 3399 | @item qp_i_min @var{integer} | ||
| 3400 | Minimum quantization parameter for I frame. | ||
| 3401 | @item qp_p_min @var{integer} | ||
| 3402 | Minimum quantization parameter for P frame. | ||
| 3403 | @item qp_b_min @var{integer} | ||
| 3404 | Minimum quantization parameter for B frame. | ||
| 3405 | @item qp_i_max @var{integer} | ||
| 3406 | Maximum quantization parameter for I frame. | ||
| 3407 | @item qp_p_max @var{integer} | ||
| 3408 | Maximum quantization parameter for P frame. | ||
| 3409 | @item qp_b_max @var{integer} | ||
| 3410 | Maximum quantization parameter for B frame. | ||
| 3411 | |||
| 3412 | @end table | ||
| 3413 | |||
| 3345 | @section MediaFoundation | 3414 | @section MediaFoundation |
| 3346 | 3415 | ||
| 3347 | This provides wrappers to encoders (both audio and video) in the | 3416 | This provides wrappers to encoders (both audio and video) in the |