Skip to content

Improve h265 encoder to choose a suitable profile

In h265, higher profile idc number does not mean better compression performance and may be not compatible with the lower profile idc. And more important, there are multi profiles with the same profile idc. Such as main-422-10, main-444 and main-444-10, they all have profile idc 4. So, it is not suitable to find the heighest idc for hw to ensure the compatibility.

When we need to add more profiles such as SCC related profiles, the old manner really can not work. The target is:

gst-launch-1.0 -v -f videotestsrc num-buffers=300 ! capsfilter caps=video/x-raw,format=NV12,framerate=30/1,width=640,height=360 ! vaapih265enc low-delay-b
=1 ! capsfilter caps=video/x-h265,profile="{ (string)main, (string)main-444, (string)main-444-10 }" ! filesink location=test265.bits

consider this command line, when the input is NV12, the encoder should choose MAIN. When the input is VUYA, it should choose MAIN-444. And when the input is Y410, it should choose MAIN-444-10. But if input is Y210, it should fail.

This can help a lot when we need to add SCC profiles.

Merge request reports