H264Layer Class

Describes the settings to be used when encoding the input video into a desired output bitrate layer with the H.264 video codec.

All required parameters must be populated in order to send to Azure.

Inheritance
azure.mgmt.media.models._models_py3.VideoLayer
H264Layer

Constructor

H264Layer(*, bitrate: int, width: str | None = None, height: str | None = None, label: str | None = None, max_bitrate: int | None = None, b_frames: int | None = None, frame_rate: str | None = None, slices: int | None = None, adaptive_b_frame: bool | None = None, profile: str | _models.H264VideoProfile | None = None, level: str | None = None, buffer_window: timedelta | None = None, crf: float | None = None, reference_frames: int | None = None, entropy_mode: str | _models.EntropyMode | None = None, **kwargs)

Keyword-Only Parameters

Name Description
width
str

The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input.

height
str

The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input.

label
str

The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file.

bitrate
int

The average bitrate in bits per second at which to encode the input video when generating this layer. This is a required field. Required.

max_bitrate
int

The maximum bitrate (in bits per second), at which the VBV buffer should be assumed to refill. If not specified, defaults to the same value as bitrate.

b_frames
int

The number of B-frames to be used when encoding this layer. If not specified, the encoder chooses an appropriate number based on the video profile and level.

frame_rate
str

The frame rate (in frames per second) at which to encode this layer. The value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame rates based on the profile and level. If it is not specified, the encoder will use the same frame rate as the input video.

slices
int

The number of slices to be used when encoding this layer. If not specified, default is zero, which means that encoder will use a single slice for each frame.

adaptive_b_frame

Whether or not adaptive B-frames are to be used when encoding this layer. If not specified, the encoder will turn it on whenever the video profile permits its use.

profile

We currently support Baseline, Main, High, High422, High444. Default is Auto. Known values are: "Auto", "Baseline", "Main", "High", "High422", and "High444".

level
str

We currently support Level up to 6.2. The value can be Auto, or a number that matches the H.264 profile. If not specified, the default is Auto, which lets the encoder choose the Level that is appropriate for this layer.

buffer_window

The VBV buffer window length. The value should be in ISO 8601 format. The value should be in the range [0.1-100] seconds. The default is 5 seconds (for example, PT5S).

crf

The value of CRF to be used when encoding this layer. This setting takes effect when RateControlMode of video codec is set at CRF mode. The range of CRF value is between 0 and 51, where lower values would result in better quality, at the expense of higher file sizes. Higher values mean more compression, but at some point quality degradation will be noticed. Default value is 23.

reference_frames
int

The number of reference frames to be used when encoding this layer. If not specified, the encoder determines an appropriate number based on the encoder complexity setting.

entropy_mode

The entropy mode to be used for this layer. If not specified, the encoder chooses the mode that is appropriate for the profile and level. Known values are: "Cabac" and "Cavlc".

Variables

Name Description
width
str

The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input.

height
str

The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input.

label
str

The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file.

bitrate
int

The average bitrate in bits per second at which to encode the input video when generating this layer. This is a required field. Required.

max_bitrate
int

The maximum bitrate (in bits per second), at which the VBV buffer should be assumed to refill. If not specified, defaults to the same value as bitrate.

b_frames
int

The number of B-frames to be used when encoding this layer. If not specified, the encoder chooses an appropriate number based on the video profile and level.

frame_rate
str

The frame rate (in frames per second) at which to encode this layer. The value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame rates based on the profile and level. If it is not specified, the encoder will use the same frame rate as the input video.

slices
int

The number of slices to be used when encoding this layer. If not specified, default is zero, which means that encoder will use a single slice for each frame.

adaptive_b_frame

Whether or not adaptive B-frames are to be used when encoding this layer. If not specified, the encoder will turn it on whenever the video profile permits its use.

profile

We currently support Baseline, Main, High, High422, High444. Default is Auto. Known values are: "Auto", "Baseline", "Main", "High", "High422", and "High444".

level
str

We currently support Level up to 6.2. The value can be Auto, or a number that matches the H.264 profile. If not specified, the default is Auto, which lets the encoder choose the Level that is appropriate for this layer.

buffer_window

The VBV buffer window length. The value should be in ISO 8601 format. The value should be in the range [0.1-100] seconds. The default is 5 seconds (for example, PT5S).

crf

The value of CRF to be used when encoding this layer. This setting takes effect when RateControlMode of video codec is set at CRF mode. The range of CRF value is between 0 and 51, where lower values would result in better quality, at the expense of higher file sizes. Higher values mean more compression, but at some point quality degradation will be noticed. Default value is 23.

reference_frames
int

The number of reference frames to be used when encoding this layer. If not specified, the encoder determines an appropriate number based on the encoder complexity setting.

entropy_mode

The entropy mode to be used for this layer. If not specified, the encoder chooses the mode that is appropriate for the profile and level. Known values are: "Cabac" and "Cavlc".