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.

DM385: Bad video stream quality for small GOP sizes

Part Number: DM385

Hello,

i have a question regarding the qualitiy of the DM385 encoder.

I have used an software encoder to compare the quality of the DM385 encoder. It seems that the software encoder provides a better quality. I have tried to use the same configuration for both. Maybe I have forgotten something or it is yust not possible to make a comparison like this?

One of our customers complains about a bad quality of the video stream.

The main configuration is:
    Targetbitrate:   5MBit
    GOP size:        5
    Video:              1080p @ 60fps

Ofcourse the result is not perfect even with the software encoder due this hard constrains. But still better than the hardware Encoder. What GOP size and targetbitrate should be used to have a "good" qualitaty for video stream with 1080 @ 60fps.

For the test i have used the following settings for the software encoder in Linux:

ffmpeg   \
   -i ${INPUT_VIDEO} \
   -c:v libx264 \
   -strict -2 \
   -b:v 5000k \
   -x264opts bitrate=5000:vbv-maxrate=5000:vbv-bufsize=10000 \
   -nal-hrd cbr \
   -ss 15 -t 10 \
   -g 5 \
   -framerate 60 \
   -qmin 8 \
   -qmax 44 \
   -passlogfile ./enc_dummy.log \
   -crf 0 \
   ${OUTPUT_VIDEO}_cbr_5.mp4

for the hardware encoder DM385 i have used the following configurations:

 [m3video] --------- CH 0 : H264 ENC : Dynamic Params -------                  
 [m3video]                                                                     
 [m3video] videnc2DynamicParams -> inputHeight             : 1080              
 [m3video] videnc2DynamicParams -> inputWidth              : 1920              
 [m3video] videnc2DynamicParams -> refFrameRate            : 25000             
 [m3video] videnc2DynamicParams -> targetFrameRate         : 60000             
 [m3video] videnc2DynamicParams -> targetBitRate           : 5000000           
 [m3video] videnc2DynamicParams -> intraFrameInterval      : 5                 
 [m3video] videnc2DynamicParams -> generateHeader          : 0                 
 [m3video] videnc2DynamicParams -> captureWidth            : 1920              
 [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                            : -1            
 [m3video] rateControlParams -> qpMaxI                         : 44            
 [m3video] rateControlParams -> qpMinI                         : 8             
 [m3video] rateControlParams -> qpP                            : -1            
 [m3video] rateControlParams -> qpMaxP                         : 44            
 [m3video] rateControlParams -> qpMinP                         : 8             
 [m3video] rateControlParams -> qpOffsetB                      : 4             
 [m3video] rateControlParams -> qpMaxB                         : 44            
 [m3video] rateControlParams -> qpMinB                         : 10            
 [m3video] rateControlParams -> allowFrameSkip                 : 1             
 [m3video] rateControlParams -> removeExpensiveCoeff           : 0             
 [m3video] rateControlParams -> chromaQPIndexOffset            : 0             
 [m3video] rateControlParams -> IPQualityFactor                : 0             
 [m3video] rateControlParams -> initialBufferLevel             : 10000000      
 [m3video] rateControlParams -> HRDBufferSize                  : 10000000      
 [m3video] rateControlParams -> minPicSizeRatioI               : 0             
 [m3video] rateControlParams -> maxPicSizeRatioI               : 96            
 [m3video] rateControlParams -> minPicSizeRatioP               : 0             
 [m3video] rateControlParams -> maxPicSizeRatioP               : 0             
 [m3video] rateControlParams -> minPicSizeRatioB               : 0             
 [m3video] rateControlParams -> maxPicSizeRatioB               : 0             
 [m3video] rateControlParams -> enablePRC                      : 1             
 [m3video] rateControlParams -> enablePartialFrameSkip         : 1             
 [m3video] rateControlParams -> discardSavedBits               : 1             
 [m3video] rateControlParams -> VBRDuration                    : 8             
 [m3video] rateControlParams -> VBRsensitivity                 : 0             
 [m3video] rateControlParams -> skipDistributionWindowLength   : 5             
 [m3video] rateControlParams -> numSkipInDistributionWindow    : 2             
 [m3video] rateControlParams -> enableHRDComplianceMode        : 1             
 [m3video] rateControlParams -> frameSkipThMulQ5               : 0             
 [m3video] rateControlParams -> vbvUseLevelThQ5                : 0             
 [m3video]                                                                     
 [m3video] interCodingParams -> interCodingPreset  : 0                         
 [m3video] interCodingParams -> searchRangeHorP    : 144                       
 [m3video] interCodingParams -> searchRangeVerP    : 32                        
 [m3video] interCodingParams -> searchRangeHorB    : 144                       
 [m3video] interCodingParams -> searchRangeVerB    : 16                        
 [m3video] interCodingParams -> interCodingBias    : 1                         
 [m3video] interCodingParams -> skipMVCodingBias   : 1                         
 [m3video] interCodingParams -> minBlockSizeP      : 0                         
 [m3video] interCodingParams -> minBlockSizeB      : 0                         
 [m3video] interCodingParams -> meAlgoMode         : 0                         
 [m3video]                                                                     
 [m3video] intraCodingParams -> intraCodingPreset          : 0                 
 [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  : 1                         
 [m3video] sliceCodingParams -> sliceMode          : 416                       
 [m3video] sliceCodingParams -> sliceUnitSize      : 416                       
 [m3video] sliceCodingParams -> sliceStartOffset   : [-126 1 2]                
 [m3video] sliceCodingParams -> streamFormat       : 0                         
 [m3video]                                                                     
 [m3video] sliceGroupChangeCycle           : 3072                              
 [m3video] searchCenter                    : 0                                 
 [m3video] enableStaticMBCount             : 0                                 
 [m3video] enableROI                       : 262400  

 

How could we improve the quality of the video stream?

Thanks,

Andreas

  • Hi Andreas,
    Can you please give me the below detials?
    1. How is the input sequence? Does it have heavy motion?
    2. Can you increase the Intraframe interval?
    3. Thanks for sharing all the dynamic params. Can you also share the static params?
  • Hi Prashanth,

    Thanks for the fast reply.

    1. We are using the Big Buck Bunny video as input sequence and as reference. It is a cartoon movie. We can see the worst quality at the beginning scene, where much moving grass is shown.

    2. The quality gets much better on higher Intraframe interval. But we already know that, but the question is why is the quality not as good as for a software encoder for small gop sizes. It could be also possible, that we are trying to compare 2 complettly different things here. What is a good GOP size value to have a acceptable quality with a small bitrate (~5MBit)?

    3. Will follow soon...

  • Hi Andreas,

    Thanks for the detailed information. 

    For lower bitrates, smaller the GOP size quality will be good. Based on your use case take a decision on GOP size wrt to bitrate. I am intrested to know weather the bitrate is achieved in the software encoder?

    Mean while for point #3, you can try setting EncodingPreset = XDM_HIGH_QUALITY

  • Hi,

    Today we had another conversation with the customer. He told us that it is not a general problem of quality, but more an unusual effect, which also occurs on high GOP sizes. We also can reproduce that effect on our place. It seems, that at slow motion sences with detailed sharp pictures (like slow moving grass) the picture changes from a bad quality to a good quality in an unsmooth, very quickly, pulsing way. It looks as if the video jerks.

    Is there a possibility in this forum to upload an example clip, which shows that effect?

    #2 I will check if the target bitrate is achieved.

    #3 I will also check the effect when changing the encodingPreset from 3 to 1 (XDM_HIGH_QUALITY) tomorrow.

    By the way we are using the dvrrdk_04.00.00.03

    Current static params:

    /*  Default H264 Encoder Settings */
    1871   pASC->ENC.profile                = ASC_PROFILE_HIGH;
    1872   pASC->ENC.level                  = IH264_LEVEL_42;
    1873   pASC->ENC.encodingPreset         = 3;   //0=default, 1=high quality,
    1874                                           //2=high_speed, 3=User defined,
    1875                                           //4=high_speed_med_quality,
    1876                                           //5=med_speed-med_quality,
    1877                                           //6=med_speed_high_quality
    1878   pASC->ENC.maxBitRate             = -1;
    1879
    1880   // IVIDEO_USER_DEFINED activates rcAlg
    1881   // 1=LowDelay, 2=Storage, 3=Rsvd, 4=None, 5=UserDefined
    1882   pASC->ENC.rateControlPreset      = IVIDEO_USER_DEFINED;
    1883   pASC->ENC.rcAlg                  = IH264_RATECONTROL_PRC;   //0=VBR(=>IH264_RATECONTROL_PRC)
    1884                                                               //1=CBR(=>IH264_RATECONTROL_PRC_LOW_DELAY)
    1885   pASC->ENC.fieldMergeEncodeEnable = FALSE;
    1886   pASC->ENC.videoMaxDelayMs        = -1;
    1887   pASC->ENC.targetBitRate          = 5000 * 1000;  // bits/s
    1888   pASC->ENC.intraFrameInterval     = 5;            // GOP Size
    1889   pASC->ENC.interFrameInterval     = 1;            // only P-Frames
    1890   pASC->ENC.mvAccuracy             = IVIDENC2_MOTIONVECTOR_QUARTERPEL;
    1891   pASC->ENC.qpMin                  = 8;
    1892   pASC->ENC.qpMax                  = 44;
    1893   pASC->ENC.qpInit                 = -1;
    1894   pASC->ENC.vbrDuration            = 8;
    1895   pASC->ENC.vbrSensitivity         = 0;

    Does any static parameters, which are missing? I currently to do not have a function to print the static encoder settings so i have to copied it from the source.

    Thanks,

    Andreas

  • Hello Andreas,

    andreas.geissler said:
    Is there a possibility in this forum to upload an example clip, which shows that effect?

    Yes, you can attach the encoded sample video in the same thread.

    Thanks for the static params. Also make sure the below settings are done when rateControlPreset =  IVIDEO_USER_DEFINED;

    rateControlParamPreset   = 1;

    qpI = 10
    qpP = 5
    qpOffsetB = 4
    rcAlgo = 1
    qpMaxI = 18
    qpMinI = 1
    qpMaxP = 5
    qpMinP = 0
    qpMaxB = 5
    qpMinB = 0

    IF CBR, initialBufferLevel = 0.5 * TargetBitrate ;

    IF VBR, HRDBufferSize =  2 * TargetBitrate ;

    Can you also tell the me the encoder version which you are using, you can find it in Release notes of Encoder?

  • Hi Andreas,

    After looking into the streams shared by you privately, It looks like the params which you have set is not taken effect. PFA config file. try to set these params also take care about the RC params as I mentioned in last post. Can you please tell the encoder version, it will be in release notes? 

    Please make sure all these configs take effect(by printing them).Sample_Encoder_cofig_parameters.cfg

  • Hi Prashanth,

    Thanks a lot for that configuration file with a detailed description of all parameters. I will check the difference to our own configuration and give you a feedback, if that changes the quality. What we found is that the Profile were only configured as BASE and not as HIGH, which improved the quality already.

    Regards,

    Andreas

  • Hi,

    We received the confirmation from the customer that this problem is solved. So it was really the profile.

    Thanks for the greate and fast support.

    Regrads,

    Andreas

  • Hi Andreas,

    Thanks for the update & closing this thread.