Android mediacodec avc/h264 encoder always produces 1MB output buffer size

20 views Asked by At

I am trying to use the hardware encoder for AVC encoding on android OMX.qcom.video.encoder.avc

My format settings look like

AMediaFormat_setString(avc_format, AMEDIAFORMAT_KEY_MIME, "video/avc");
AMediaFormat_setInt32(avc_format, AMEDIAFORMAT_KEY_WIDTH, 1920);
AMediaFormat_setInt32(avc_format, AMEDIAFORMAT_KEY_HEIGHT, 1080);
AMediaFormat_setInt32(avc_format, AMEDIAFORMAT_KEY_BIT_RATE, 1000000);
AMediaFormat_setInt32(avc_format, AMEDIAFORMAT_KEY_I_FRAME_INTERVAL, 5);
AMediaFormat_setFloat(avc_format, AMEDIAFORMAT_KEY_FRAME_RATE, 15.0);
AMediaFormat_setInt32(avc_format, AMEDIAFORMAT_KEY_COLOR_FORMAT, 21);

When I try to deque the output buffer

  if (status >= 0) {
    bufsize = 0;
    uint8_t* buf = AMediaCodec_getOutputBuffer(avc_encoder_, status, &bufsize);
  }

The bufsize is always 1MB. I tried changing the bitrate and frame rate but I dont see any difference. Any idea why this could be happening?

I tried changing the bitrate and frame rate but I dont see any difference. Any idea why this could be happening?

0

There are 0 answers