Need help setting up the mfxvideoparam for 422

Need help setting up the mfxvideoparam for 422

I am just getting started using this SDK and have been able to get the sample_encode VC project to compile and convert a 4:2:0 file.

What I am trying to do is encode 4:2:2 frames output from a DeltaCast sdi board and encode them to a h.264 / mp4 file. So to start off I thought the best thing to try was to get the Init function to work without errors. After days and days of messing around and failing miserably I finally got the 4:2:0 working using: MFX_FOURCC_NV12 and MFX_CHROMAFORMAT_YUV420 and copying the exact parameters used by sample_encode. Then I tried to use:MFX_FOURCC_YV12 and MFX_CHROMAFORMAT_YUV422 and have now gone back to failing miserably. No matter what I do it comes back with MFX_ERR_INVALID_VIDEO_PARAM.

When I use MFX_FOURCC_NV12 and MFX_CHROMAFORMAT_YUV422 it comes back with MFX_WRN_INCOMPATIBLE_VIDEO_PARAM which from what I can gather the params may have fixed themselves but what got fixed?

I have been through the mediaSDK_man.pdf which by the way needs a proper index and has multiple incorrect pointers. The document has very little useful information on what parameter combinations are necessary for the different formats. The .h file is of little use in this matter as well. 

What I need it a set of valid parameters that I can use as a baseline to encode 1080i (4:2:2) frames to h.264. Does anyone have a clue what are the necessary parameter settings might be? Or a document that has this kind of info?

I have not even attempted to get the surfaces initialized (much less understand what is going on), for I fear another nightmare in the making.

Please anyone, help me...

Thanks in advance,


5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Ted,

Media SDK supports YUV format NV12 (this is 4:2:0) natively. The SDK also supports 2 additional YUV formats: YV12 (this is 4:2:0) and YUY2 (this is 4:2:2). To use format YV12 or YUY2 a developer must first use VPP to convert format to NV12 before feeding the input frames to encoder.

So the issue you're facing is likely due to the fact that neither NV12 or YV12 are 4:2:2 formats. You can use YUY2 if that is the type of YUV data the camera delivers. If not, you will have to do the conversion from your YUV 4:2:2 format to NV12 yourself. If that is the case you may also explore Intel Integrated Performance Primitives (IPP) which supplies a wide range of color conversion routines, it may be that one of those fits your needs.


Thank you for the reply,
I finally realized that that I had to use the vpp to convert. The confusing part is why does the encoder have parameters that can't work? And more importantly is where is it documented?
I am trying to make the vpp initialize now with little success. But I will comb through it.
So what it seems I must do is:
Set the vpp in for:

And set the vpp out for:

Is that correct? So far these attempts have again failed miserably. It there something else that needs to be set to get any other status than -15?
I realize that I am not familiar enough with this to not cause myself grief, but there must be some sort of documentation to help get through this so at least one doesn't have to spend weeks fiddling around to get it to just initialize.
Thanks again,

Hi Ted,

Sorry to hear that you're having issues using this functionality.

There is a VPP sample (sample_vpp) part of the SDK the provides details on how to do color space conversion from YUY2 to NV12. Please take a look at this sample, it will hopefully provide some clarity, helping you progress.

Could you also please try to set ChromaFormat to MFX_CHROMAFORMAT_YUV420 also from YUY2. Does that make any difference?


Thanks so much for the reply,
Setting the YUY to NV12 is the first thing I tried because I can successfully init the encoder with those parameters. I will continue to use those params you suggest until I get a successful vpp init and then I will try to change the settings. I will look at the sample and see if it helps.
Again thanks,

Leave a Comment

Please sign in to add a comment. Not a member? Join today