AnsweredAssumed Answered

why gopsize is unusable when using AMD Media SDK

Question asked by newjorchen on Jan 13, 2016

Hi all,

     I am implementing h264 hardware encoder via AMD Media SDK. everything is worked well except that setting the encode parameter "GopSize" isn't  usabled, since i need to got ouput h264 stream every 1 sec is an I frame. The platform and driver listed below:

     OS: window 7

     platform: Intel Core i5 & AMD Radeon HD 7700 series

     GPU driver Ver:  12.104.0.0 (2013/3/18)

     AMD Media SDK Ver: 1.1

 

the code of main parameters setting before called Init() listed below:

 

  result = AMFCreateComponent(m_context, AMFVideoEncoderVCE_AVC, &m_encoder);

  if (result != AMF_OK) {

  LOGE(TAG, "create AVC encoder failed\n");

  return false;

  }

  LOGV(TAG, "created AVC encoder component\n");

 

  CHECK_SET_PROPERTY(m_encoder, AMF_VIDEO_ENCODER_USAGE, usage);

  CHECK_SET_PROPERTY(m_encoder, AMF_VIDEO_ENCODER_TARGET_BITRATE, m_encodeParam.bitrate);

  CHECK_SET_PROPERTY(m_encoder, AMF_VIDEO_ENCODER_FRAMESIZE, ::AMFConstructSize(m_encodeParam.width, m_encodeParam.height));

  CHECK_SET_PROPERTY(m_encoder, AMF_VIDEO_ENCODER_FRAMERATE, ::AMFConstructRate(m_encodeParam.framerate, 1));

  CHECK_SET_PROPERTY(m_encoder, AMF_VIDEO_ENCODER_B_PIC_PATTERN, 0);

  CHECK_SET_PROPERTY(m_encoder, AMF_VIDEO_ENCODER_QUALITY_PRESET, AMF_VIDEO_ENCODER_QUALITY_PRESET_SPEED);

 

  result = m_encoder->Init(m_formatIn, m_encodeParam.width, m_encodeParam.height);

  if (result != AMF_OK) {

  LOGE(TAG, "init AVC encoder failed\n");

  return false;

  }

 

besides, referred to Media SDK reference manual,  setting dynamic parameter (gopsize, idrperiod, etc) every 30 frames before called SubmitInput() to submit encode frame, see below:

 

if (submitCount % m_encodeParam.framerate == 0) {

  CHECK_SET_PROPERTY(m_encoder, AMF_VIDEO_ENCODER_IDR_PERIOD, 0);

  CHECK_SET_PROPERTY(m_encoder, AMF_VIDEO_ENCODER_GOP_SIZE, m_encodeParam.gopSize);

  CHECK_SET_PROPERTY(m_encoder, AMF_VIDEO_ENCODER_FRAMERATE, ::AMFConstructRate(m_encodeParam.framerate, 1));

  CHECK_SET_PROPERTY(surfaceIn, AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE, L"I");

  }

 

result = m_encoder->SubmitInput(surfaceIn);

submitCount++;

 

 

unfortunately, the nal type of ouput encoded frame are always like this: sps, pps, idr , p, p, ...., p. 

 

please tell me which step is wrong.

 

hope for your help.

 

Thx

newjor

Outcomes