[FFmpeg-user] Trouble selecting a pixel format/colorspace while trying to encode a video using ffmpeg and HW accelerated vaapi or qsv interfaces

caetano at vision.ime.usp.br caetano at vision.ime.usp.br
Sun Dec 11 23:44:26 EET 2022


  My question is not related to post-processing or color-space
transformation. It is about how to hardware encode using a pixel format
that provides high color accuracy for screen capture, differently from what
NV12 is capable of offering.

  Regarding hardware encoding support, accordingly to this:

https://github.com/intel/media-driver/blob/master/README.md

  Hardware support has been added since Ice Lake (2019, 10th generation) to
HEVC and VP9 codecs for 4:4:4 chroma for both 8 and 10 bits modes and also
for both encoding and decoding.

  This other page gives more details:

https://github.com/intel/media-driver/blob/master/README.md

  Accordingly to the above link , the following 4:4:4 formats are supported
for hardware decoding when using HEVC or VP9: AYUV (8 bits) and Y410 (10
bits) and the following  4:4:4 formats are supported for hardware encoding
when using HEVC or VP9: AYUV and RGB (8 bits) and Y410 (10 bits).

  I've found out that gstreamer in my system (ubuntu version 1.20.1) is
able to perform 4:4:4 10 bits encoding when using the Y410 format and the
following command (ffprobe for the generated file reports pixel format
as yuv444p10le):

====
gst-launch-1.0 ximagesrc display-name=:0.0 show-pointer=false
use-damage=false num-buffers=2400 ! video/x-raw,framerate=20/1 !
videoconvert ! video/x-raw,format=RGBx ! vaapipostproc !
video/x-raw,format=Y410 ! vaapih265enc rate-control=cqp quality-level=1
quality-factor=18 ! video/x-h265 ! h265parse ! matroskamux ! filesink
location=desktop.mkv
====

and hardware decoding of the above generated file can be achieved with the
following command:

====
gst-play-1.0 desktop.mkv
====

Unfortunately, gstreamer version I have has no support for the AYUV pixel
format with hardware acceleration, therefore I could not test 8 bits
hardware encoding and decoding, but at least for 10 bits it is working
properly and colors looks just great.

===========================

I believe it would be great to add support in ffmpeg for hardware encoding
and decoding for at least the following 4:4:4 pixel formats: AYUV, RGB
and Y410 as this is available in Intel hardware since 2019.



On Sat, 10 Dec 2022 at 17:00, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:

> I wanted to write "no hardware encoders support full chroma" and
> "no hardware encoders support RGB" - Wenbin's answer seems
> to indicate that I was wrong but in any case the qsv code in FFmpeg
> currently neither allows full-chroma encoding nor RGB encoding.
>
> I don't know if mxf (the library used for qsv encoding) support
> full-chroma and RGB.
>
> No idea how your question could be related to post-processing
> or colour-space transformation.


More information about the ffmpeg-user mailing list