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.

Large encoded bistream size for a static video

Dear Experts,

We are using DVR_RDK 3.5.

Our system flow is:

Camcorder output SDI signal-->DM8148. We try to use H264 codec to encode SDI signal.

We meet a special video.
When we playback this video and pause it ('pause' means video is static, no moving action), the encoded bitstream size is large.

If we set encode ouput format is 1280x720/GOP 60/9Mbps: I=670kB P=4kB.
If we set encode ouput format is HD 1080/GOP 60/9Mbps : I=270kB P=46kB.

This might be an abnormal situation.

In RDK setting,
#define UTILS_ENCDEC_GET_BITBUF_SIZE(width,height,bitrate,framerate) should be (((width) * (height))/2).
But in this case, The encoded bitstream is larger then BITBUF_SIZE.
We have to increase this size.

My question is:

1) Which situation will cause the large encoded bitstream even if video is static??

2) Why does the output format affect I/P frame encoded size? Is it correct behavior??

--------------------------------------
Below is my encode parameter:
[ 1781.920] [m3video]  
[ 1781.920] [m3video] --------- CH 1 : H264 ENC : enclink_h264_print_status ( Dynamic Params ) -------
[ 1781.920] [m3video]  
[ 1781.920] [m3video] videnc2DynamicParams -> inputHeight             : 720
[ 1781.920] [m3video] videnc2DynamicParams -> inputWidth              : 1280
[ 1781.920] [m3video] videnc2DynamicParams -> refFrameRate            : 30000
[ 1781.920] [m3video] videnc2DynamicParams -> targetFrameRate         : 30000
[ 1781.920] [m3video] videnc2DynamicParams -> targetBitRate           : 9000000
[ 1781.920] [m3video] videnc2DynamicParams -> intraFrameInterval      : 60
[ 1781.920] [m3video] videnc2DynamicParams -> generateHeader          : 0
[ 1781.920] [m3video] videnc2DynamicParams -> captureWidth            : 1920
[ 1781.920] [m3video] videnc2DynamicParams -> forceFrame              : -1
[ 1781.920] [m3video] videnc2DynamicParams -> interFrameInterval      : 1
[ 1781.920] [m3video] videnc2DynamicParams -> mvAccuracy              : 2
[ 1781.920] [m3video] videnc2DynamicParams -> sampleAspectRatioHeight : 1
[ 1781.920] [m3video] videnc2DynamicParams -> sampleAspectRatioWidth  : 1
[ 1781.920] [m3video] videnc2DynamicParams -> ignoreOutbufSizeFlag    : 1
[ 1781.920] [m3video] videnc2DynamicParams -> lateAcquireArg          : -1
[ 1781.920] [m3video]  
[ 1781.920] [m3video] rateControlParams -> rateControlParamsPreset        : 1
[ 1781.921] [m3video] rateControlParams -> scalingMatrixPreset            : 0
[ 1781.921] [m3video] rateControlParams -> rcAlgo                         : 0
[ 1781.921] [m3video] rateControlParams -> qpI                            : -1
[ 1781.921] [m3video] rateControlParams -> qpMaxI                         : 49
[ 1781.921] [m3video] rateControlParams -> qpMinI                         : 10
[ 1781.921] [m3video] rateControlParams -> qpP                            : -1
[ 1781.921] [m3video] rateControlParams -> qpMaxP                         : 49
[ 1781.921] [m3video] rateControlParams -> qpMinP                         : 10
[ 1781.921] [m3video] rateControlParams -> qpOffsetB                      : 0
[ 1781.921] [m3video] rateControlParams -> qpMaxB                         : 49
[ 1781.921] [m3video] rateControlParams -> qpMinB                         : 49
[ 1781.921] [m3video] rateControlParams -> allowFrameSkip                 : 1
[ 1781.921] [m3video] rateControlParams -> removeExpensiveCoeff           : 0
[ 1781.921] [m3video] rateControlParams -> chromaQPIndexOffset            : 0
[ 1781.921] [m3video] rateControlParams -> IPQualityFactor                : 0
[ 1781.921] [m3video] rateControlParams -> initialBufferLevel             : 18000000
[ 1781.921] [m3video] rateControlParams -> HRDBufferSize                  : 18000000
[ 1781.921] [m3video] rateControlParams -> minPicSizeRatioI               : 0
[ 1781.921] [m3video] rateControlParams -> maxPicSizeRatioI               : 640
[ 1781.921] [m3video] rateControlParams -> minPicSizeRatioP               : 0
[ 1781.921] [m3video] rateControlParams -> maxPicSizeRatioP               : 0
[ 1781.921] [m3video] rateControlParams -> minPicSizeRatioB               : 0
[ 1781.922] [m3video] rateControlParams -> maxPicSizeRatioB               : 0
[ 1781.922] [m3video] rateControlParams -> enablePRC                      : 1
[ 1781.922] [m3video] rateControlParams -> enablePartialFrameSkip         : 1
[ 1781.922] [m3video] rateControlParams -> discardSavedBits               : 1
[ 1781.922] [m3video] rateControlParams -> VBRDuration                    : 8
[ 1781.922] [m3video] rateControlParams -> VBRsensitivity                 : 0
[ 1781.922] [m3video] rateControlParams -> skipDistributionWindowLength   : 5
[ 1781.922] [m3video] rateControlParams -> numSkipInDistributionWindow    : 2
[ 1781.922] [m3video] rateControlParams -> enableHRDComplianceMode        : 1
[ 1781.922] [m3video] rateControlParams -> frameSkipThMulQ5               : 0
[ 1781.922] [m3video] rateControlParams -> vbvUseLevelThQ5                : 0
[ 1781.922] [m3video]  
[ 1781.922] [m3video] interCodingParams -> interCodingPreset  : 0
[ 1782.258] [m3video] interCodingParams -> searchRangeHorP    : 144
[ 1782.258] [m3video] interCodingParams -> searchRangeVerP    : 32
[ 1782.258] [m3video] interCodingParams -> searchRangeHorB    : 144
[ 1782.259] [m3video] interCodingParams -> searchRangeVerB    : 16
[ 1782.259] [m3video] interCodingParams -> interCodingBias    : 1
[ 1782.259] [m3video] interCodingParams -> skipMVCodingBias   : 1
[ 1782.259] [m3video] interCodingParams -> minBlockSizeP      : 0
[ 1782.259] [m3video] interCodingParams -> minBlockSizeB      : 0
[ 1782.259] [m3video] interCodingParams -> meAlgoMode         : 0
[ 1782.259] [m3video]  
[ 1782.259] [m3video] intraCodingParams -> intraCodingPreset          : 0
[ 1782.259] [m3video] intraCodingParams -> lumaIntra4x4Enable         : 255
[ 1782.259] [m3video] intraCodingParams -> lumaIntra8x8Enable         : 0
[ 1782.259] [m3video] intraCodingParams -> lumaIntra16x16Enable       : 15
[ 1782.259] [m3video] intraCodingParams -> chromaIntra8x8Enable       : 15
[ 1782.259] [m3video] intraCodingParams -> chromaComponentEnable      : 1
[ 1782.259] [m3video] intraCodingParams -> intraRefreshMethod         : 0
[ 1782.259] [m3video] intraCodingParams -> intraRefreshRate           : 0
[ 1782.259] [m3video] intraCodingParams -> gdrOverlapRowsBtwFrames    : 0
[ 1782.259] [m3video] intraCodingParams -> constrainedIntraPredEnable : 0
[ 1782.259] [m3video] intraCodingParams -> intraCodingBias            : 0
[ 1782.259] [m3video]  
[ 1782.259] [m3video] sliceCodingParams -> sliceCodingPreset  : 0
[ 1782.259] [m3video] sliceCodingParams -> sliceMode          : 0
[ 1782.259] [m3video] sliceCodingParams -> sliceUnitSize      : 0
[ 1782.259] [m3video] sliceCodingParams -> sliceStartOffset   : [0 0 0]
[ 1782.259] [m3video] sliceCodingParams -> streamFormat       : 0
[ 1782.259] [m3video]  
[ 1782.260] [m3video] searchCenter                    : 32767
[ 1782.260] [m3video] enableStaticMBCount             : 0
[ 1782.260] [m3video] enableROI                       : 0
[ 1782.260] [m3video]  
[ 1782.260] [m3video]  
[ 1782.260] [m3video]  
[ 1782.260] [m3video] --------- H264 ENC : Static Params -------
[ 1782.260] [m3video]  
[ 1782.260] [m3video] videnc2Params -> encodingPreset                : 3
[ 1782.260] [m3video] videnc2Params -> rateControlPreset             : 5
[ 1782.260] [m3video] videnc2Params -> maxHeight                     : 720
[ 1782.260] [m3video] videnc2Params -> maxWidth                      : 1280
[ 1782.260] [m3video] videnc2Params -> maxInterFrameInterval         : 1
[ 1782.260] [m3video] videnc2Params -> maxBitRate                    : 9000000
[ 1782.260] [m3video] videnc2Params -> minBitRate                    : 0
[ 1782.260] [m3video] videnc2Params -> inputChromaFormat             : 9
[ 1782.260] [m3video] videnc2Params -> inputContentType              : 0
[ 1782.260] [m3video] videnc2Params -> operatingMode                 : 1
[ 1782.260] [m3video] videnc2Params -> profile                       : 77
[ 1782.260] [m3video] videnc2Params -> level                         : 40
[ 1782.260] [m3video] videnc2Params -> inputDataMode                 : 3
[ 1782.260] [m3video] videnc2Params -> outputDataMode                : 3
[ 1782.260] [m3video] videnc2Params -> numInputDataUnits             : 1
[ 1782.260] [m3video] videnc2Params -> numOutputDataUnits            : 1
[ 1782.261] [m3video] videnc2Params -> metadataType                  : 965422528
[ 1782.261] [m3video] videnc2Params -> fmoCodingParams.fmoCodingPreset : 0
[ 1782.261] [m3video] videnc2Params->interlaceCodingType              : 3
[ 1782.261] [m3video] videnc2Params->bottomFieldIntra                : 0
[ 1782.261] [m3video] videnc2Params->gopStructure                   : 0
[ 1782.261] [m3video] videnc2Params->entropyCodingMode             : 1
[ 1782.261] [m3video] videnc2Params->transformBlockSize                 : 0
[ 1782.597] [m3video] videnc2Params->log2MaxFNumMinus4                 : 10
[ 1782.597] [m3video] videnc2Params->picOrderCountType                  : 0
[ 1782.597] [m3video] videnc2Params->enableWatermark                   : 0
[ 1782.597] [m3video] videnc2Params->IDRFrameInterval                   : 1
[ 1782.597] [m3video] videnc2Params->pConstantMemory                   : 0
[ 1782.597] [m3video] videnc2Params->maxIntraFrameInterval                  : 2147483640
[ 1782.597] [m3video] videnc2Params->debugTraceLevel                       : 0
[ 1782.597] [m3video] videnc2Params->lastNFramesToLog                     : 0
[ 1782.597] [m3video] videnc2Params->enableAnalyticinfo                  : 0
[ 1782.597] [m3video] videnc2Params->enableGMVSei                         : 0
[ 1782.597] [m3video] videnc2Params->constraintSetFlags                  : 0
[ 1782.597] [m3video] videnc2Params->enableRCDO                            : 0
[ 1782.597] [m3video] videnc2Params->enableLongTermRefFrame               : 0
[ 1782.597] [m3video] videnc2Params->LTRPPeriod                              : 0
[ 1782.597] [m3video] videnc2Params->numTemporalLayer                       : 1
[ 1782.597] [m3video] videnc2Params->referencePicMarking                         : 1
[ 1782.598] [m3video] videnc2Params->nalUnitControlParams.naluControlPreset    :1
[ 1782.598] [m3video] videnc2Params->nalUnitControlParams.naluPresentMaskEndOfSequence    :3072
[ 1782.598] [m3video] videnc2Params->nalUnitControlParams.naluPresentMaskIDRPicture    :9184
[ 1782.598] [m3video] videnc2Params->nalUnitControlParams.naluPresentMaskIntraPicture    :8962
[ 1782.598] [m3video] videnc2Params->nalUnitControlParams.naluPresentMaskNonIntraPicture    :578
[ 1782.598] [m3video] videnc2Params->nalUnitControlParams.naluPresentMaskStartOfSequence    :9120
[ 1782.598] [m3video] videnc2Params->vuiCodingParams.vuiCodingPreset                 :1
[ 1782.598] [m3video] videnc2Params->vuiCodingParams.hrdParamsPresentFlag         :0
[ 1782.598] [m3video] videnc2Params->vuiCodingParams.timingInfoPresentFlag         :0

This is my video image: (This is first video frame)

this is last video frame

Plz help ~ thx ~

HB

  • Dear Experts,
    By the way, I have questions.

    There might be two possible answer to avoid this issue.

    Method 1:
    Change #define UTILS_ENCDEC_GET_BITBUF_SIZE(width,height,bitrate,framerate) from (((width) * (height))/2)  to (((width) * (height) * 3)/2).

    Method 2:
    maxPicSizeRatioI = 30 -> 20 or 0 (Setting this to 0 will enable encoder chosen ratio)
    maxPicSizeRatioP = 0 -> 20 or 0 or increase minPicSizeRatioP.


    Could you plz provide suggestion value for both methods?

    We need suitable setting of UTILS_ENCDEC_GET_BITBUF_SIZE, maxPicSizeRatioI, and maxPicSizeRatioP.


    thx

    HB

  • Dear HB,

    Changing the maxPicSizeRatio will be one way to try to control the pic sizes. But the codec might not strictly follow this value.

    Could you please let us know if all the parameters except the resolution are exactly the same for both 1280x720 and HD 1080 ?


    Best Regards,
    Nandu Krishnan.
  • Dear Nandu,

    GOP 60
    Target Bitrate is 9Mbps.

    Difference is
    1280x720 is 29.97fps progressive output format.
    HD 1080 is 59.94fps interlace output format.
    1280x720 qp=0,40,-1 = HD 1080 qp=0,47,-1.

    We want to confirm:
    1) why does it have large encode data under the progressive encoded using still picture??

    2) if 1) is normal situation or possible, it has to clear encoder parameter and buffer size. Can you provide suggestion of
    UTILS_ENCDEC_GET_BITBUF_SIZE / maxPicSizeRatioI / maxPicSizeRatioP ?

    thx ~

    HB

  • Dear HB,

    Is it possible for you to share the streams for analysis?

    Best Regards,

    Nandu.

  • Dear Nandu,

    Yes, I can share it to you.

    Can TI provide FTP or space to put this stream for you?

    HB

  • Dear Nandu,
    Sorry ~
    But this stream is camcorder file ( It is MXF file, 217MB) ~
    Can you use this format?

    HB
  • Dear Nandu,
    Plz down stream asap, it is temp link and will be deleted in short time.
    https://mega.co.nz/#!IEQQgaoa!2Eyjnw9B1lt8Tci8gauEiBaGAf3JPLHO97qAmXyffcU

    thx

    HB

  • Hi HB,

    I'll download it now.

    Regards,
    Nandu.
  • Dear Nandu,

    We are still waiting your reply, do you have any progress?

    thx ~

  • Dear HB,

    We analyzed the stream. First of all the content is not static, there is continuous motion throughout (the ball is rotating). 

    Also we didn't observe any overshoot in the whole period except for the last but one frame. Is that the case you are asking about?

    Best Regards,

    Nandu.

  • Dear Nandu,

    Yes, the video content is not static.

    But our signal output device is Camcorder, thus, we can "pause" video and let video content is static to DM8148.

    Camcorder (pause video as static output) --> SDI Interface --> DM8148.

    In this video, it will cause large encode bitstream size even we pause the video.

    We want to confirm the value of maxPicsizeRatioI/maxPicsizeRatioP in this case.

    In our experimental, maxPicsizeRatioI=20, maxPicsizeRatioP=20 seems ok.

    Are these suitable value? or any suggestion value?

    thx ~

    HB

  • Dear HB,

    These parameters can be given different values based on the circumstances. There is no general suggestion values for them.

    Is the bit rate during static content much larger than the provided target bit rate ?

    Best Regards,

    Nandu.

  • Dear Nandu,

    >>If we set encode ouput format is 1280x720/GOP 60/9Mbps: I=670kB P=4kB.
    >>If we set encode ouput format is HD 1080/GOP 60/9Mbps : I=270kB P=46kB.

    Our original buffer setting is 512K. Almost in most case, 512K should be enough.
    However, we can adjust buffer size.
    But we need to know what is the root cause and what is suggestion value.

    Do you have any idea that why this video (we pause it to static output) cause larger bitrate?

    And you don't have suggestion value for us about " maxPicsizeRatioI/maxPicsizeRatioP", right?

    thx ~

    HB
  • Hi HB,

    The information you have shared speaks about the individual frame sizes and not the bitrate. Bitrate is measured with respect to seconds; number of bits consumed per second. The encoder will try to achieve the target bit rate provided even when the content is static.

    The individual frame sizes, however, if works fine with the values for max pic size ratios you found in the experiments, you can continue with that.

    Best Regards,
    Nandu.