3

I am trying to get about 24 frames per second for a 960x540 video using OpenH264 C++ library. I tried different parameters for SEncParamExt and I cannot get better codec performance instead of smaller encoded data. I get about 16-20 fps on my computer.

Here is my current config.

SEncParamExt param;
m_pEncoder->GetDefaultParams(&param);

param.fMaxFrameRate = 30;

param.bEnableFrameSkip = false;
param.iMinQp = 20;
param.iMaxQp = 30;
param.iPicWidth = m_frameFormat.GetWidth();
param.iPicHeight = m_frameFormat.GetHeight();
param.iTargetBitrate = 5000000;
param.bEnableDenoise = false;
param.iSpatialLayerNum = 1;
param.iTemporalLayerNum = 1;
param.bIsLosslessLink = false;
param.bEnableLongTermReference = true;
param.iEntropyCodingModeFlag = 0;
param.iMultipleThreadIdc = 2;
param.bUseLoadBalancing = true;

for (int i = 0; i < param.iSpatialLayerNum; i++)
{
    param.sSpatialLayers[i].iVideoWidth = m_frameFormat.GetWidth()  >> (param.iSpatialLayerNum - 1 - i);
    param.sSpatialLayers[i].iVideoHeight = m_frameFormat.GetHeight() >> (param.iSpatialLayerNum - 1 - i);
    param.sSpatialLayers[i].fFrameRate = 30;
    param.sSpatialLayers[i].iSpatialBitrate = param.iTargetBitrate;
    param.sSpatialLayers[i].sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
    param.sSpatialLayers[i].sSliceArgument.uiSliceNum = 2;
}

param.iTargetBitrate *= param.iSpatialLayerNum;

I tried different values for param.iComplexityMode and param.iRCMode and I get the necessary frame rate but a very bad picture quality. Also I played with quantization levels and it did not help.

Also I use VP8 codec. It easily produces 24 frames per second for the same video. The encoded data size is bigger (about 500Kb per second vs 200Kb per second in the case of OpenH264) but it is very convenient for me.

What am I doing wrong? What should I do to increase OpenH264 performance?

Eugen
  • 479
  • 5
  • 16

0 Answers0