HAL HEVC encode ignores properties?

I'm trying to get things buttoned up in our app for high sierra launch, but I'm seeing discrepancies between the hardware accelerated HEVC encoder and the software one. I'm using a VTCompressionSession to encode sample to HEVC. If I've enabled hardware accelration via kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder later calls to VTSessionSetProperty to set kVTCompressionPropertyKey_AverageBitRate do nothing. The same call does produce a chnage in the output samples relative bitrate if hardware encode is not enabled.

Is this expected behavior? The h264 encoder seems to have feature parity between software and hardware versions.


Replies

Yes, seems like HEVC hardware encoder is broken for bitrate control.


kVTCompressionPropertyKey_AverageBitRate or kVTCompressionPropertyKey_DataRateLimits have no effect on the encoding bitrate. I tried on iPhone 7 ios11.0.3.

I did some more investigation and here is what I found. The HEVC encoder does honor the bitrate if the bitrate is set only once or the value is not changed. If I call kVTCompressionPropertyKey_AverageBitRate with same value, things work fine. I guess Encoder would simply ignore kVTCompressionPropertyKey_AverageBitRate if this is same as before, so its like I called kVTCompressionPropertyKey_AverageBitRate only once. As soon as I call kVTCompressionPropertyKey_AverageBitRate with a different value on the same compression session, it seems like bitrate mode goes crazy. Almost as if encoder goes into constant quality mode. This dynamic bitrate updates work fine with H264 encoder, but it could be that my understanding is wrong how to use kVTCompressionPropertyKey_AverageBitRate to adjust bitrate on the fly.

It seems like setting kVTCompressionPropertyKey_ExpectedFrameRate fixes the issues.

we have set property kVTCompressionPropertyKey_DataRateLimits for HEVC encoder, which return kVTPropertyNotSupportedErr, this means iOS 11 do not support dynamic bit rate control, not like H264.


Still do not know when apple support this property for HEVC encoder.

this setting doesn't help resolve this isuse,