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.

mpeg4enc bitrate control



 
I wonder if anyone can clarify something in the 'MPEG4 Simple Profile Encoder Codec on DM355' spec for me.
 
We are trying to configure mpeg4enc to give a constant (+/- 10%) bitrate.Also, this bitrate needs to be quite low, of course, as we'll be sending that data over a 3G, possibly 2G network.
 
So, in brief, my requirement is to:
 
1) Encode QCIF at 15 fps, with a constant bitrate of 64Kbps
2) Encode CIF    at 15 fps, with a constant bitrate of 64Kbps
 
With Number 1, we can achieve 64Kbps at 15 fps, but the bitrate varies a lot. Upto 100Kbps sometimes.
 
With Number 2, we get nowhere near. We still see that the bitrate is very variable, as above. Also, in order to get close to 64Kbps, we need to drop the frame rate down to around 8 fps.
 
I'm hoping that I have not understood the spec correctly, and it's a simple config issue!!!
 
Below are my params for VIDENC1_create and VIDENC1_control for CIF resolution : (please excuse the magic numbers, it's just to clarify my settings)
 
Extended params, to VIDENC1_create:
 
     params->videncParams.size = sizeof(IMP4VENC_Params) ;
     params->videncParams.encodingPreset = XDM_USER_DEFINED;
     params->videncParams.maxInterFrameInterval = XDM_DEFAULT;
     params->videncParams.reconChromaFormat = XDM_DEFAULT;
     params->videncParams.inputContentType = XDM_DEFAULT;
     params->videncParams.dataEndianness = XDM_DEFAULT;
     params->videncParams.inputChromaFormat = 4 ;
     params->videncParams.maxWidth    =   352 ;
     params->videncParams.maxHeight   =   288 ;
     params->videncParams.maxFrameRate  = 10000 ;
     params->videncParams.maxBitRate  = 64000 ;
 
     params->subWindowWidth   = params->videncParams.maxWidth;
     params->subWindowHeight  = params->videncParams.maxHeight;
 
     params->intraFrameInterval    =    30 ;
     params->rcQ_MAX      =    15 ;
     params->rcQ_MIN      =    12 ;
     params->intraDcVlcThr = 0 ;
     params->meRange = 31 ;
     params->intraThres = 200 ;
     params->intraAlgo = 1 ;
     params->numMBRows = 5 ;
     params->initQ = 0 ;
     params->rateFix = 1 ;
     params->rateFixRange = 1 ;
     params->rotation = 0 ;
     params->meAlgo = 0 ;
     params->SkipMBAlgo = 0 ;
     params->UMV = 0 ;
     params->videncParams.rateControlPreset = IVIDEO_LOW_DELAY ;
     params->IIDC = 0 ;
     params->InitQ_P = 0 ;
     params->VBV_size = 10000 ;
     params->SVH = 1 ;
Extended dynamic params, to VIDENC1_control:

 params->size                = sizeof(VIDENC1_DynamicParams);
 params->inputWidth          =    352;
 params->inputHeight         =    288;
 params->targetBitRate       =  64000;
 params->intraFrameInterval  =     30;
 params->targetFrameRate =  10000;
 params->refFrameRate    =  10000;
 params->generateHeader      = XDM_ENCODE_AU;
 params->captureWidth        = 0;
 
Any ideas will be really appreciated...
 
Thanks.
  • I am curious what version of the codecs you are working with? Note that there were some fixes to the bit rate management in the current version that comes with DVSDK 2.0 (DM355 codecs 1.13.000), so it is possible that you would have better bit rate control with a newer version.

    Your setup seems reasonable, IVIDEO_LOW_DELAY should have a constrained bit rate. You can lessen the variation of the bit rate with IVIDEO_LOW_DELAY by decreasing the size of the VBV buffer, however this is a trade off as though the bit rate becomes more solid you skip more frames.

    One side note on this, the lowest supported value for rateFixRange is actually 2, so the 1 you have would be a violation but since this is ignored in IVIDEO_LOW_DELAY it should not matter.

     

  • Thanks for the suggestion. 

    I'm affraid it's still the same.

    Am I being too ambitious? Is it reasonable to try and limit the bitrate to no more than 64Kbps? I noticed that all the others talk about Mbps.

    At the moment, i have CIF at 5 fps, to keep the bitrate that low...

    Help!

  • 64Kbps is very low but with a low enough resolution and frame rate it should be possible, in general for a good quality standard resolution video you would be measuring the bit rate in Mbps though. My understanding of the bit rate control is that the codec just skips frames to maintain a particular bit rate maximum, therefore it is possible that you just have to have 5 fps at CIF with your source material to maintain a 64Kbps stream.