Cropping input frames before encoding causes MFX_ERR_INCOMPATIBLE_VIDEO_PARAM

Cropping input frames before encoding causes MFX_ERR_INCOMPATIBLE_VIDEO_PARAM

Hi all,

I have been trying to crop input frames before encoding them. The current pipeline I've build consists of decode -> VPP -> encode. According to the developpers guide, I understand that this is possible with such values:

                   VPP Input                       VPP output

              W,H           X,Y,W,H         W,H       X,Y,W,H

Cropping 720x480 16,16,688,448 720x480 16,16,688,448

In my case, I tried this set of values.

VPPParams.vpp.In.Width=1920
VPPParams.vpp.In.Height=1088
VPPParams.vpp.In.CropW=960
VPPParams.vpp.In.CropH=544
VPPParams.vpp.Out.Width=1920
VPPParams.vpp.Out.Height=1088
VPPParams.vpp.Out.CropW=960
VPPParams.vpp.Out.CropH=544

However, I get an error MFX_ERR_INCOMPATIBLE_VIDEO_PARAM -14.

I did try other combinations without sucess. Can anyone confirm that's the right way to perform cropping operations? If not, is there a better way to do it?

Thanks !

 

 

 

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

Hi,

I assume you are seeing that error from the "encode" request.  What are your parameters to Encoding input?

The surface output of VPP will be vpp.Out.Width and vpp.Out.Height, so using your parameters, the VPP step is still making a 1080p surface (with video content in the crop region).  This should work if encode input is 1920x1088 and you really desire a 1080p stream, but...

I suspect that what you are trying to do (create 960x544 stream), should look more like

VPPParams.vpp.In.Width=1920
VPPParams.vpp.In.Height=1088
VPPParams.vpp.In.CropW=960
VPPParams.vpp.In.CropH=544
VPPParams.vpp.Out.Width=960
VPPParams.vpp.Out.Height=544
VPPParams.vpp.Out.CropW=960
VPPParams.vpp.Out.CropH=544

and

EncParams.vpp.In.Width=960
EncParams.vpp.In.Height=544

-Tony

Hi Tony,

Thanks for your reply !

Yes, your assumption is correct. I try to create a 960x544 stream representing 1/4 of a 1080p stream. The values you are suggesting make more sense to me as well although the documentation seems to say otherwise to my understanding (p.18 Region of Interest in API 1.7). Hence my confusion.

So I'm going to test with these values (VPP + Enc) and I'll get back to you.

In the meantime, I was also wondering what was the purpose of the crop sizes in the encoder initialisation. The documentation says H.264 cropped frame size. Would it be then possible to achieve the same result without implementing a VPP component (in case of H.264 encoding)?

Thanks !

 

Emmanuel

Hi Tony,

I have implemented the value you suggested.

At the initialisation step I have :

mfxDecParams.mfx.FrameInfo.Width=1920
mfxDecParams.mfx.FrameInfo.Height=1088
VPPParams.vpp.In.Width=1920
VPPParams.vpp.In.Height=1088
VPPParams.vpp.In.CropW=960
VPPParams.vpp.In.CropH=544
VPPParams.vpp.Out.Width=960
VPPParams.vpp.Out.Height=544
VPPParams.vpp.Out.CropW=960
VPPParams.vpp.Out.CropH=544
mfxEncParams.mfx.FrameInfo.Width=960
mfxEncParams.mfx.FrameInfo.Height=544
mfxEncParams.mfx.FrameInfo.CropW=960
mfxEncParams.mfx.FrameInfo.CropH=544

Which seems indeed what I want to achieve. Now the pipeline runs whitout error.

But the output bistream I have is just the 960x544 downscaled version of the 1080p input stream. It does not perform any cropping operation.

I further printed out some information during the DSK operations. Here they are :

// Decoded frames

pSurfaces[nIndex]->Info.Width=1920
pSurfaces[nIndex]->Info.Height=1088
pSurfaces[nIndex]->Info.CropW=1920
pSurfaces[nIndex]->Info.CropH=1080

// VPP configuration
par_vpp.vpp.In.Width=1920
par_vpp.vpp.In.Height=1088
par_vpp.vpp.In.CropW=960
par_vpp.vpp.In.CropH=544
par_vpp.vpp.Out.Width=960
par_vpp.vpp.Out.Height=544
par_vpp.vpp.Out.CropW=960
par_vpp.vpp.Out.CropH=544

// Encoded frames
pSurfaces2[nIndex2]->Info.Width=960
pSurfaces2[nIndex2]->Info.Height=544
pSurfaces2[nIndex2]->Info.CropW=960
pSurfaces2[nIndex2]->Info.CropH=544

Do you see what is wrong in this pipeline? Do I need to implement something in the SDK operations to make the cropping happen?

By the way, I still have this question about the documentation. What is the purpose of the crop sizes in the encoder initialisation. The documentation says H.264 cropped frame size, does it also perform a cropping operation?

Thanks a lot !

 

 

 

Hi all,

Has anyone ever tried to crop input streams? I am still struggling with it, no matter the crop parameters I use, at best I have a downscaled version...

Any help/pointers would be appreciated !

Thanks,

Emmanuel

I also get Downscaling problem (For Letterbox and crop to fit mode). so I used Thirdparty codec for appropriate downscale conversion. And giving that buffer for encoding

Leave a Comment

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