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.
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?
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
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)?
I have implemented the value you suggested.
At the initialisation step I have :
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
// VPP configuration
// Encoded frames
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 !
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 !
I have the exact same issue! When I try to crop, it will just resize the video using the cropping values. I am using FFmpeg for my tests, with all the decoding/vpp/encoding chain remaining as MFX_IOPATTERN_OUT_VIDEO_MEMORY memory. When I use a dummy FFmpeg soft filter (yadiff for instance), it then uses MFX_IOPATTERN_OUT_SYSTEM_MEMORY and the cropping works as expected.
Any clue ?