H.264 sample encode for quality parameter

H.264 sample encode for quality parameter

Hi all,

I'm using Media SDK for the H.264 encoder by sample code(sample_encode).

As the document menstined =>[-q quality] - quality parameter for JPEG codec. In range [1,100]. 100 is the best quality.

But when I trace the source code, I can not find any parameter for the quality parameter.

Does Media SDK create the interface for "quality parameter" ?  thanks !

5 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Hi Lu,

The "sample_encode" sample code handles the MJPEG quality parameter both in sample_encode.cpp (when parsing the cmd line) and in pipeline_encode.cpp (in InitMfxEncParams() when setting the Media SDK API parameter named Quality).

Please check the sample source code again. I'm assuming you are using Media SDK 2013 release?


Hi Petter, 

Thanks for your reply.

Yes, I'm using Media SDK 2013.

I also check the "sampe_encode.cpp" for parsing the cmd line and  "pipeline_encode.cpp" for InitMfxEncParams.

But I can not find anu related parameter for processing the quality.

Ex: I can find the code for parsing the bit rate or frame rate in "sampe_encode.cpp".  But it's without the quality parameter.

case MSDK_CHAR('b'):
pParams->nBitRate = (mfxU16)msdk_strtol(strArgument, &stopCharacter, 10);

And in "pipeline_encode.cpp" , I can find the "m_mfxEncParams.mfx.TargetKbps." for bit rate setting. But it's still without quality parameter.

Do I miss the other items?  Thanks. 

I was curious, so I looked:

On lines 211-214 of sample_encode.cpp, you will find:

case MSDK_CHAR('q'):
pParams->nQuality = (mfxU16)msdk_strtol(strArgument, &stopCharacter, 10);

and this is where it is used to setup the appropriate element in the mfxVideoParam struct.

pipeline_encode.cpp(381): m_mfxEncParams.mfx.Quality = pInParams->nQuality;

Are you aware of the mouse right click -> find all references in VS2010/VS2012? 

While editing a successfully compiling solution, such as sample_encode, right click with the mouse on an element such as 'nQuality' and select 'find all references', it should show you all the lines the symbol in question is used on.

That's how I found that reference mentioned above.


Hi camkego,

Thanks for your help.

I think I found the root cause. I use Media SDK R3 (Version 3.5.915.45249), it's without the prarameter as you menstioned.

But when I upgrade it to Version 4.0.0000554.52230, it appears  "pParams->nQuality" and" m_mfxEncParams.mfx.Quality" these two parameters.

Now, it's working. Thanks for your help again.

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui