Re: [FFmpeg-user] Trouble selecting a pixel format/colorspace while trying to encode a video using ffmpeg and HW accelerated vaapi or qsv interfaces
Am Do., 8. Dez. 2022 um 20:32 Uhr schrieb <caetano@vision.ime.usp.br>:
Stream #0:0: Video: hevc (Rext), gbrp
Completely unrelated: Do all your video players play above file?
ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -v verbose -f x11grab -draw_mouse 0 -framerate 20 -probesize 42M -video_size 1920x1200 -thread_queue_size 1000 -vcodec rawvideo -i ":0.0" -an -vf 'hwupload=extra_hw_frames=64,scale_qsv=format=bgra' -c:v hevc_qsv -preset veryslow -global_quality 17 -look_ahead 1 -y /tmp/output.mkv
(-vcodec rawvideo looks wrong) When asking for support on this mailing list, always provide the command line you tested together with the complete, uncut console output.
As you can see, in the first example, libx265 SW encoder based, the output is generated with the "gbrp" colorspace while in the second example, hevc_qsv HW encoder based, the output is generated with the "yuvj420p" pixel format.
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. Carl Eugen
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@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.
participants (2)
-
caetano@vision.ime.usp.br -
Carl Eugen Hoyos