Expected frame sizes of HEVC encoding result when a window is moving (VTCompressionSession on Mac)

26 Views Asked by At

On Mac, I'm encoding video using VTCompressionSession and HEVC (resolution 2,624 x 1,696) and trying to see if I can optimize the amount of data. I did a test where I show an unchanging screen, and the output data sizes are around 1k-2k. When I move a window slightly around the screen (nothing in the window is animating, or anything else that is visible) data is around 3k-13k (ignoring the really big frames that are probably key frames). The window that I am moving around is mostly black.

Based on my understanding of how HEVC works this seems like way too much data. Can anyone confirm that this is normal, and if so, why? Is there any ways to reduce the size of the data without getting significant degradation in quality? Changing the bit rate does seem to help but it seems like the algorithm, should detect I am moving a window around the screen and not need so much data.

Is there any special parameters I need to set to make the algorithm smarter about reusing data from previous frames? (Meaning that cases like where a window moves around the screen will result in very little data.)

I am using the following parameters:

kVTCompressionPropertyKey_AverageBitRate   15000000
kVTCompressionPropertyKey_DataRateLimits  15000000, 1
kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder  YES
kVTCompressionPropertyKey_RealTime  YES
kCVPixelBufferOpenGLCompatibilityKey  YES
kCVPixelBufferMetalCompatibilityKey  YES
kCVPixelBufferPixelFormatTypeKey     kCVPixelFormatType_32BGRA

I'm using a 2023 MacBook Pro M2 in case it matters for the encoder.

0

There are 0 best solutions below