diff --git a/codec/console/enc/src/welsenc.cpp b/codec/console/enc/src/welsenc.cpp index 21dac921..440ff952 100644 --- a/codec/console/enc/src/welsenc.cpp +++ b/codec/console/enc/src/welsenc.cpp @@ -626,7 +626,7 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE int FillSpecificParameters (SEncParamExt& sParam) { /* Test for temporal, spatial, SNR scalability */ sParam.iUsageType = CAMERA_VIDEO_REAL_TIME; - sParam.fMaxFrameRate = 30.0f; // input frame rate + sParam.fMaxFrameRate = 60.0f; // input frame rate sParam.iPicWidth = 1280; // width of picture in samples sParam.iPicHeight = 720; // height of picture in samples sParam.iTargetBitrate = 2500000; // target bitrate desired diff --git a/codec/encoder/plus/src/welsEncoderExt.cpp b/codec/encoder/plus/src/welsEncoderExt.cpp index 7417e16c..bbcf6122 100644 --- a/codec/encoder/plus/src/welsEncoderExt.cpp +++ b/codec/encoder/plus/src/welsEncoderExt.cpp @@ -559,7 +559,7 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid pStatistics->uiSkippedFrameCount += (kbCurrentFrameSkipped ? 1 : 0); int32_t iProcessedFrameCount = pStatistics->uiInputFrameCount - pStatistics->uiSkippedFrameCount; if (!kbCurrentFrameSkipped && iProcessedFrameCount != 0) { - pStatistics->fAverageFrameSpeedInMs += (kiCurrentFrameMs - pStatistics->fAverageFrameSpeedInMs)/iProcessedFrameCount; + pStatistics->fAverageFrameSpeedInMs += (kiCurrentFrameMs - pStatistics->fAverageFrameSpeedInMs) / iProcessedFrameCount; } // rate control related @@ -586,7 +586,7 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid const int32_t kiDeltaFrames = static_cast (pStatistics->uiInputFrameCount - m_pEncContext->iLastStatisticsFrameCount); - if (kiDeltaFrames > m_pEncContext->pSvcParam->fMaxFrameRate) { + if (kiDeltaFrames > (m_pEncContext->pSvcParam->fMaxFrameRate * 2)) { const int64_t kiTimeDiff = kiCurrentFrameTs - pStatistics->iStatisticsTs; if (kiTimeDiff) { pStatistics->fLatestFrameRate = static_cast ((pStatistics->uiInputFrameCount - @@ -596,6 +596,14 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid m_pEncContext->iLastStatisticsBytes) * 8 * 1000 / kiTimeDiff); } + if (m_pEncContext->pSvcParam->iRCMode == RC_QUALITY_MODE || m_pEncContext->pSvcParam->iRCMode == RC_BITRATE_MODE) { + if (WELS_ABS (pStatistics->fLatestFrameRate - m_pEncContext->pSvcParam->fMaxFrameRate) > 5) { + WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, + "Actual Input Framerate %f is different from framerate in setting %f, suggest to use other rate control modes", + pStatistics->fLatestFrameRate, m_pEncContext->pSvcParam->fMaxFrameRate); + } + } + // update variables pStatistics->iStatisticsTs = kiCurrentFrameTs; m_pEncContext->iLastStatisticsBytes = m_pEncContext->iTotalEncodedBytes; @@ -607,6 +615,13 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid if (m_pEncContext->iStatisticsLogInterval > 0) { const int64_t kiTimeDiff = kiCurrentFrameTs - m_pEncContext->iLastStatisticsLogTs; if ((kiTimeDiff > m_pEncContext->iStatisticsLogInterval) || (0 == pStatistics->uiInputFrameCount % 300)) { + + if (WELS_ABS (pStatistics->fAverageFrameRate - m_pEncContext->pSvcParam->fMaxFrameRate) > 30) { + WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, + "Actual Input Framerate %f is quite different from framerate in setting %f, please check setting or timestamp unit (ms)", + pStatistics->fAverageFrameRate, m_pEncContext->pSvcParam->fMaxFrameRate); + } + WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "EncoderStatistics: %dx%d, SpeedInMs: %f, fAverageFrameRate=%f, " "LastFrameRate=%f, LatestBitRate=%d, LastFrameQP=%d, uiInputFrameCount=%d, uiSkippedFrameCount=%d, "