VkVideoEncodeRateControlInfoKHR(3)

# VkVideoEncodeRateControlInfoKHR(3) Manual Page

## Name

VkVideoEncodeRateControlInfoKHR - Structure to set encode stream rate control parameters

Loading… please wait.

## C Specification

The `VkVideoEncodeRateControlInfoKHR` structure is defined as:

    // Provided by VK_KHR_video_encode_queue
    typedef struct VkVideoEncodeRateControlInfoKHR {
        VkStructureType                                sType;
        const void*                                    pNext;
        VkVideoEncodeRateControlFlagsKHR               flags;
        VkVideoEncodeRateControlModeFlagBitsKHR        rateControlMode;
        uint32_t                                       layerCount;
        const VkVideoEncodeRateControlLayerInfoKHR*    pLayers;
        uint32_t                                       virtualBufferSizeInMs;
        uint32_t                                       initialVirtualBufferSizeInMs;
    } VkVideoEncodeRateControlInfoKHR;

## Members

- `sType` is a VkStructureType value identifying this structure.

- `pNext` is `NULL` or a pointer to a structure extending this structure.

- `flags` is reserved for future use.

- `rateControlMode` is a VkVideoEncodeRateControlModeFlagBitsKHR value specifying the encode stream rate control mode.

- `layerCount` specifies the number of rate control layers in the video encode stream.

- `pLayers` is a pointer to an array of VkVideoEncodeRateControlLayerInfoKHR structures specifying the rate control configurations of `layerCount` rate control layers.

- `virtualBufferSizeInMs` is the leaky bucket model virtual buffer size in milliseconds, with respect to peak bitrate. Valid when rate control mode is `VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR` or `VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR`. For example, virtual buffer size is (`virtualBufferSizeInMs` × `maxBitrate` / 1000).

- `initialVirtualBufferSizeInMs` is the initial occupancy in milliseconds of the virtual buffer in the leaky bucket model. Valid when rate control mode is `VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR` or `VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR`.

## Description

Including this structure in the `pNext` chain of VkVideoCodingControlInfoKHR and including `VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR` in VkVideoCodingControlInfoKHR::`flags` will define stream rate control settings for video encoding.

Additional structures providing codec-specific rate control parameters may need to be included in the `pNext` chain of `VkVideoCodingControlInfoKHR` depending on the codec profile the bound video session was created with and the parameters specified in `VkVideoEncodeRateControlInfoKHR` (see Video Coding Control).

To ensure that the video session is properly initialized with stream-level rate control settings, the application must call vkCmdControlVideoCodingKHR with stream-level rate control settings at least once in execution order before the first vkCmdEncodeVideoKHR command that is executed after video session reset. If not provided, default implementation-specific stream rate control settings will be used.

Stream rate control settings can also be re-initialized during an active video encoding session. The re-initialization takes effect whenever the `VkVideoEncodeRateControlInfoKHR` structure is included in the `pNext` chain of the VkVideoCodingControlInfoKHR structure in the call to vkCmdControlVideoCodingKHR, and only impacts vkCmdEncodeVideoKHR operations that follow in execution order.

Valid Usage (Implicit)

- VUID-VkVideoEncodeRateControlInfoKHR-sType-sType
  `sType` must be `VK_STRUCTURE_TYPE_VIDEO_ENCODE_RATE_CONTROL_INFO_KHR`

- VUID-VkVideoEncodeRateControlInfoKHR-flags-zerobitmask
  `flags` must be `0`

- VUID-VkVideoEncodeRateControlInfoKHR-rateControlMode-parameter
  If `rateControlMode` is not `0`, `rateControlMode` must be a valid VkVideoEncodeRateControlModeFlagBitsKHR value

- VUID-VkVideoEncodeRateControlInfoKHR-pLayers-parameter
  If `layerCount` is not `0`, `pLayers` must be a valid pointer to an array of `layerCount` valid VkVideoEncodeRateControlLayerInfoKHR structures

## See Also

VK_KHR_video_encode_queue, VkStructureType, VkVideoEncodeRateControlFlagsKHR, VkVideoEncodeRateControlLayerInfoKHR, VkVideoEncodeRateControlModeFlagBitsKHR

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0