How to enable mediacodec encoding using ffmpeg?

421 Views Asked by At

From the ffmpeg docs, it looks like hw accel media encoding using mediacodec is supported from version 6.0. How do I use it? I compiled the library with media_codec_enabled and enable-jni flags and I do see h264_mediacodec as one of the encoders. Will the media codec encoders be used automatically or do I have to do something?

Doing avcodec_find_encoder_by_name("h264_mediacodec") gives the codec id as H264.

Presently, I am calling avformat_alloc_output_context2() and adding the h264 video encoding to AVFormatContext which then added to av_interleaved_write_frame().

Example on how to encode using h264_mediacodec

0

There are 0 best solutions below