Hi Matt,

The intel-vaapi-driver only supports YUV420 (and it'z 10 bit variant too) chroma for encoding except JPEG encode.
Actually restriction is not just YUV420, it only support NV12 format (and the 10 bit variant too).

But driver has a work around to convert any non-NV12 format to NV12 internally. So ideally other input formats can work too.
Unfortunately there is a performance issue here: the internal conversion using an AVS sampler for Color space conversion which is not optimal
when comparing with explicit VPP which uses 3D sampler.
So I would recommend to use an explicit vpp (eg: vaapipostproc in gstreamer) for colorspace conversion before encode.

On 09/25/2017 09:33 AM, Matt Fischer wrote:
This is a question about gstreamer-vaapi as well as libva-intel-driver.  I hope this is the right list for those components...if not, please let me know where I ought to ask it instead.

I have a situation where I'd like to encode video using the gstreamer-vaapi plugins that's in plain RGBA format (it's coming out of an OpenGL rendering pipeline).  As it stands now, though, the encoder plugins refuse to set up a pipeline for any format other than YUV 4:2:0/4:2:2.  This is enforced both by an explicit check in gstvaapiencoder.c (the is_chroma_type_supported() function), as well as by querying the VAConfigAttribRTFormat attribute from the underlying vaDisplay.

Just for curiosity's sake, I tried adding the RGB32 format both into the gstreamer check, as well as into the list of allowed chroma formats down in libva-intel-driver (in i965_drv_video.c in the i965_get_default_chroma_formats() function).  To my surprise, this seemed to work correctly.  The encoded video played back with correct colors, suggesting that the underlying i965 encoding hardware is capable of accepting RGB formats and doing the appropriate color conversions.

If this is true, is there any chance of adding official support for RGB formats in the way that my hack did?  It's quite useful to be able to connect OpenGL rendering into the VAAPI pipeline, and the addition of RGBA support appears to make that possible.  Are there limitations that would make this difficult, or is the lack of RGBA support thus far just an oversight?


intel-vaapi-media mailing list