This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Dm816x ROI bitrate

Topic: ROI bitrate issue

At the moment we are using Region Of Interest(ROI) with DVRRDK_04.01.00.02.and codec library
REL.500.V.H264AVC.E.IVAHD.02.00.08.00. The issue we witness is a difficulty for the H.264
encoder to maintain the target bitrate when configured using a single ROI. As an example, we are using a signal of 720p50 with a small 240x180 ROI with priority 8,
type: Foreground. The target bitrate is set to 1000 kbps.
However when there is "high motion" in the scene then the bitrate goes up to 3000 kbps
and it takes a long time(several seconds after the motion has ended)
to get back to the target bitrate. Using the same scene without ROI the encoder is able to
maintain the desired target bitrate of 1000 kbps. Are there specific encoder settings or other settings we need to use in order to fix this issue ?
============================== Current Encoder settings ============================== [m3video] [m3video] --------- CH 0 : H264 ENC : Dynamic Params ------- [m3video] [m3video] videnc2DynamicParams -> inputHeight : 720 [m3video] videnc2DynamicParams -> inputWidth : 1280 [m3video] videnc2DynamicParams -> refFrameRate : 50000 [m3video] videnc2DynamicParams -> targetFrameRate : 50000 [m3video] videnc2DynamicParams -> targetBitRate : 1000000 [m3video] videnc2DynamicParams -> intraFrameInterval : 260 [m3video] videnc2DynamicParams -> generateHeader : 0 [m3video] videnc2DynamicParams -> captureWidth : 1280 [m3video] videnc2DynamicParams -> forceFrame : -1 [m3video] videnc2DynamicParams -> interFrameInterval : 1 [m3video] videnc2DynamicParams -> mvAccuracy : 2 [m3video] videnc2DynamicParams -> sampleAspectRatioHeight : 1 [m3video] videnc2DynamicParams -> sampleAspectRatioWidth : 1 [m3video] videnc2DynamicParams -> ignoreOutbufSizeFlag : 1 [m3video] videnc2DynamicParams -> lateAcquireArg : -1 [m3video] [m3video] rateControlParams -> rateControlParamsPreset : 1 [m3video] rateControlParams -> scalingMatrixPreset : 0 [m3video] rateControlParams -> rcAlgo : 0 [m3video] rateControlParams -> qpI : 25 [m3video] rateControlParams -> qpMaxI : 51 [m3video] rateControlParams -> qpMinI : 0 [m3video] rateControlParams -> qpP : 25 [m3video] rateControlParams -> qpMaxP : 51 [m3video] rateControlParams -> qpMinP : 0 [m3video] rateControlParams -> qpOffsetB : 4 [m3video] rateControlParams -> qpMaxB : 51 [m3video] rateControlParams -> qpMinB : 0 [m3video] rateControlParams -> allowFrameSkip : 0 [m3video] rateControlParams -> removeExpensiveCoeff : 0 [m3video] rateControlParams -> chromaQPIndexOffset : 0 [m3video] rateControlParams -> IPQualityFactor : 0 [m3video] rateControlParams -> initialBufferLevel : 2000000 [m3video] rateControlParams -> HRDBufferSize : 2000000 [m3video] rateControlParams -> minPicSizeRatioI : 0 [m3video] rateControlParams -> maxPicSizeRatioI : 0 [m3video] rateControlParams -> minPicSizeRatioP : 0 [m3video] rateControlParams -> maxPicSizeRatioP : 0 [m3video] rateControlParams -> minPicSizeRatioB : 0 [m3video] rateControlParams -> maxPicSizeRatioB : 0 [m3video] rateControlParams -> enablePRC : 1 [m3video] rateControlParams -> enablePartialFrameSkip : 0 [m3video] rateControlParams -> discardSavedBits : 0 [m3video] rateControlParams -> VBRDuration : 8 [m3video] rateControlParams -> VBRsensitivity : 0 [m3video] rateControlParams -> skipDistributionWindowLength : 5 [m3video] rateControlParams -> numSkipInDistributionWindow : 2 [m3video] rateControlParams -> enableHRDComplianceMode : 0 [m3video] rateControlParams -> frameSkipThMulQ5 : 0 [m3video] rateControlParams -> vbvUseLevelThQ5 : 0 [m3video] [m3video] interCodingParams -> interCodingPreset : 1 [m3video] interCodingParams -> searchRangeHorP : 144 [m3video] interCodingParams -> searchRangeVerP : 32 [m3video] interCodingParams -> searchRangeHorB : 144 [m3video] interCodingParams -> searchRangeVerB : 16 [m3video] interCodingParams -> interCodingBias : 1 [m3video] interCodingParams -> skipMVCodingBias : 4 [m3video] interCodingParams -> minBlockSizeP : 1 [m3video] interCodingParams -> minBlockSizeB : 1 [m3video] interCodingParams -> meAlgoMode : 0 [m3video] [m3video] intraCodingParams -> intraCodingPreset : 1 [m3video] intraCodingParams -> lumaIntra4x4Enable : 255 [m3video] intraCodingParams -> lumaIntra8x8Enable : 0 [m3video] intraCodingParams -> lumaIntra16x16Enable : 15 [m3video] intraCodingParams -> chromaIntra8x8Enable : 15 [m3video] intraCodingParams -> chromaComponentEnable : 1 [m3video] intraCodingParams -> intraRefreshMethod : 0 [m3video] intraCodingParams -> intraRefreshRate : 0 [m3video] intraCodingParams -> gdrOverlapRowsBtwFrames : 0 [m3video] intraCodingParams -> constrainedIntraPredEnable : 0 [m3video] intraCodingParams -> intraCodingBias : 0 [m3video] [m3video] sliceCodingParams -> sliceCodingPreset : 0 [m3video] sliceCodingParams -> sliceMode : 0 [m3video] sliceCodingParams -> sliceUnitSize : 0 [m3video] sliceCodingParams -> sliceStartOffset : [0 0 0] [m3video] sliceCodingParams -> streamFormat : 0 [m3video] [m3video] searchCenter.(x/y) : (32767/32767) [m3video] enableStaticMBCount : 0 [m3video] enableROI : 1 [m3video] [m3video] [m3video] NalUnit Control Params: naluControlPreset:1,
NaluPresMaskStartOfSeq:8608,
NaluPresMaskIDRPicture:8608, NaluPresMaskIntraPicture:8578,
NaluPresMaskNonIntraPic:2,
NaluPresMaskEndOfSeq:3072.
[m3video] Printing LoopFilter Params: LoopFilterPreset:0,
LoopfilterDisableIDC:0,
filterOffsetA:0,
filterOffsetB:0.
[m3video] Printing VUICoding Params: VUICodingPreset:1,
AspectRatioInfoPresentFlag:1,
AspectRatioIdc:1, VideoSignalTypePresentFlag:0,
VideoFormat:5,
VideoFullRangeFlag:0,
timingInfoPresentFlag:1, HrdParamsPresentFlag:0,
NumUnitsInTicks:1000.
[m3video] Printing StaticH264Enc Misc Params: Level:32,
Profile:66,
InterlaceCodingType:4,
BottomFieldIntra:0, GopStructureModel:0,
EntropyCodingMode:0,
TransformBlockSize:0,
log2MaxFramesNumMinus4:12, picOrderCntType:0,
enableWatermark:0,
IDRFrameInterval:1,
MaxIntraFrameInterval:260,
debugTraceLevel:0, LastNFramesToLog:0,
EnableAnalyticInfo:0,
EnableGMVSei:0,
ConstraintSetFlags:-128,
EnableRCDO:0, EnableLongTermRefFrame:0,
LTRPPeriod:0,
NumTemporalLayer:1,
ReferencePicMarking:1 ROI Settings ============ ROIParams.chId = 0; ROIParams.numOfRegion = 1; ROIParams.startX[0] = 360; ROIParams.startY[0] = 240; ROIParams.width[0] = 240; ROIParams.height[0] = 180; ROIParams.type[0] = IH264_FOREGROUND_OBJECT; ROIParams.roiPriority[0]= 8;


Thanks,

Louis

  • Hello,

    Have you tried to set maxBitRate as well?

    Best Regards,

    Margarita

  • Hi Margarita,

    We looked at the H.264_Encoder_HDVICP2_UserGuide annex N on HF-VBR where they talk about maxBitrate. According to user guide it seems that the maxBitrate needs to be 1.5X times the targetBitrate. Applying this in our example this means that the targetBitrate would be 666 kbps and the maxBitrate 1000 kbps. This seems to be working. The encoder does not exceed the maxBitrate when our ROI is enabled.

    However, often the output bitrate is closer to 666 kbps, we would like to get the average bitrate closer to 1000 kbps without overshooting too much.

    1) Can we configure maxBitrate to be 1.15X the targetBitrate will it work or will it be ignored ?

    2 ) What are the settings of maxBitrate, VBRDuration and VBRSensitivity to get the average bitrate closer to the maxBitrate ?

    Thanks,

    Louis-Pierre

  • Dear Louis,

    The maxBitRate set to a value less than 1.5 x targetBitRate is likely to be ignored. Also in the long run, the encoder always try to achieve targetBitRate and not maxBitRate.

    .

    Best Regards,

    Nandu.