WebM Codec SDK: vpx_codec_enc_cfg Struct Reference

WebM Codec SDK

Data Fields
vpx_codec_enc_cfg Struct Reference
Common Algorithm Interface » Encoder Algorithm Interface

Encoder configuration structure. More...

`#include <vpx_encoder.h>`

## Data Fields
unsigned int | g_usage
| Deprecated: Algorithm specific "usage" value.
unsigned int | g_threads
| Maximum number of threads to use.
unsigned int | g_profile
| Bitstream profile to use.
unsigned int | g_w
| Width of the frame.
unsigned int | g_h
| Height of the frame.
vpx_bit_depth_t | g_bit_depth
| Bit-depth of the codec.
unsigned int | g_input_bit_depth
| Bit-depth of the input frames.
struct vpx_rational | g_timebase
| Stream timebase units.
vpx_codec_er_flags_t | g_error_resilient
| Enable error resilient modes.
enum vpx_enc_pass | g_pass
| Multi-pass Encoding Mode.
unsigned int | g_lag_in_frames
| Allow lagged encoding.
unsigned int | rc_dropframe_thresh
| Temporal resampling configuration, if supported by the codec.
unsigned int | rc_resize_allowed
| Enable/disable spatial resampling, if supported by the codec.
unsigned int | rc_scaled_width
| Internal coded frame width.
unsigned int | rc_scaled_height
| Internal coded frame height.
unsigned int | rc_resize_up_thresh
| Spatial resampling up watermark.
unsigned int | rc_resize_down_thresh
| Spatial resampling down watermark.
enum vpx_rc_mode | rc_end_usage
| Rate control algorithm to use.
vpx_fixed_buf_t | rc_twopass_stats_in
| Two-pass stats buffer.
vpx_fixed_buf_t | rc_firstpass_mb_stats_in
| first pass mb stats buffer.
unsigned int | rc_target_bitrate
| Target data rate.
unsigned int | rc_min_quantizer
| Minimum (Best Quality) Quantizer.
unsigned int | rc_max_quantizer
| Maximum (Worst Quality) Quantizer.
unsigned int | rc_undershoot_pct
| Rate control adaptation undershoot control.
unsigned int | rc_overshoot_pct
| Rate control adaptation overshoot control.
unsigned int | rc_buf_sz
| Decoder Buffer Size.
unsigned int | rc_buf_initial_sz
| Decoder Buffer Initial Size.
unsigned int | rc_buf_optimal_sz
| Decoder Buffer Optimal Size.
unsigned int | rc_2pass_vbr_bias_pct
| Two-pass mode CBR/VBR bias.
unsigned int | rc_2pass_vbr_minsection_pct
| Two-pass mode per-GOP minimum bitrate.
unsigned int | rc_2pass_vbr_maxsection_pct
| Two-pass mode per-GOP maximum bitrate.
unsigned int | rc_2pass_vbr_corpus_complexity
| Two-pass corpus vbr mode complexity control Used only in VP9: A value representing the corpus midpoint complexity for corpus vbr mode. This value defaults to 0 which disables corpus vbr mode in favour of normal vbr mode.
enum vpx_kf_mode | kf_mode
| Keyframe placement mode.
unsigned int | kf_min_dist
| Keyframe minimum interval.
unsigned int | kf_max_dist
| Keyframe maximum interval.
unsigned int | ss_number_layers
| Number of spatial coding layers.
int | ss_enable_auto_alt_ref [5]
| Enable auto alt reference flags for each spatial layer.
unsigned int | ss_target_bitrate [5]
| Target bitrate for each spatial layer.
unsigned int | ts_number_layers
| Number of temporal coding layers.
unsigned int | ts_target_bitrate [5]
| Target bitrate for each temporal layer.
unsigned int | ts_rate_decimator [5]
| Frame rate decimation factor for each temporal layer.
unsigned int | ts_periodicity
| Length of the sequence defining frame temporal layer membership.
unsigned int | ts_layer_id [16]
| Template defining the membership of frames to temporal layers.
unsigned int | layer_target_bitrate [12]
| Target bitrate for each spatial/temporal layer.
int | temporal_layering_mode
| Temporal layering mode indicating which temporal layering scheme to use.
int | use_vizier_rc_params
| A flag indicating whether to use external rate control parameters. By default is 0. If set to 1, the following parameters will be used in the rate control system.
vpx_rational_t | active_wq_factor
| Active worst quality factor.
vpx_rational_t | err_per_mb_factor
| Error per macroblock adjustment factor.
vpx_rational_t | sr_default_decay_limit
| Second reference default decay limit.
vpx_rational_t | sr_diff_factor
| Second reference difference factor.
vpx_rational_t | kf_err_per_mb_factor
| Keyframe error per macroblock adjustment factor.
vpx_rational_t | kf_frame_min_boost_factor
| Keyframe minimum boost adjustment factor.
vpx_rational_t | kf_frame_max_boost_first_factor
| Keyframe maximum boost adjustment factor, for the first keyframe in a chunk.
vpx_rational_t | kf_frame_max_boost_subs_factor
| Keyframe maximum boost adjustment factor, for subsequent keyframes.
vpx_rational_t | kf_max_total_boost_factor
| Keyframe maximum total boost adjustment factor.
vpx_rational_t | gf_max_total_boost_factor
| Golden frame maximum total boost adjustment factor.
vpx_rational_t | gf_frame_max_boost_factor
| Golden frame maximum boost adjustment factor.
vpx_rational_t | zm_factor
| Zero motion power factor.
vpx_rational_t | rd_mult_inter_qp_fac
| Rate-distortion multiplier for inter frames. The multiplier is a crucial parameter in the calculation of rate distortion cost. It is often related to the qp (qindex) value. Rate control parameters, could be set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.
vpx_rational_t | rd_mult_arf_qp_fac
| Rate-distortion multiplier for alt-ref frames. The multiplier is a crucial parameter in the calculation of rate distortion cost. It is often related to the qp (qindex) value. Rate control parameters, could be set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.
vpx_rational_t | rd_mult_key_qp_fac
| Rate-distortion multiplier for key frames. The multiplier is a crucial parameter in the calculation of rate distortion cost. It is often related to the qp (qindex) value. Rate control parameters, could be set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## Detailed Description

Encoder configuration structure.

This structure contains the encoder settings that have common representations across all codecs. This doesn't imply that all codecs support all features, however.

## Field Documentation

## ◆ g_usage

unsigned int vpx_codec_enc_cfg::g_usage

Deprecated: Algorithm specific "usage" value.

This value must be zero.

## ◆ g_threads

unsigned int vpx_codec_enc_cfg::g_threads

Maximum number of threads to use.

For multi-threaded implementations, use no more than this number of threads. The codec may use fewer threads than allowed. The value 0 is equivalent to the value 1.

## ◆ g_profile

unsigned int vpx_codec_enc_cfg::g_profile

Bitstream profile to use.

Some codecs support a notion of multiple bitstream profiles. Typically this maps to a set of features that are turned on or off. Often the profile to use is determined by the features of the intended decoder. Consult the documentation for the codec to determine the valid values for this parameter, or set to zero for a sane default. profile of bitstream to use

## ◆ g_w

unsigned int vpx_codec_enc_cfg::g_w

Width of the frame.

This value identifies the presentation resolution of the frame, in pixels. Note that the frames passed as input to the encoder must have this resolution. Frames will be presented by the decoder in this resolution, independent of any spatial resampling the encoder may do.

## ◆ g_h

unsigned int vpx_codec_enc_cfg::g_h

Height of the frame.

This value identifies the presentation resolution of the frame, in pixels. Note that the frames passed as input to the encoder must have this resolution. Frames will be presented by the decoder in this resolution, independent of any spatial resampling the encoder may do.

## ◆ g_bit_depth

vpx_bit_depth_t vpx_codec_enc_cfg::g_bit_depth

Bit-depth of the codec.

This value identifies the bit_depth of the codec, Only certain bit-depths are supported as identified in the vpx_bit_depth_t enum.

## ◆ g_input_bit_depth

unsigned int vpx_codec_enc_cfg::g_input_bit_depth

Bit-depth of the input frames.

This value identifies the bit_depth of the input frames in bits. Note that the frames passed as input to the encoder must have this bit-depth.

## ◆ g_timebase

struct vpx_rational vpx_codec_enc_cfg::g_timebase

Stream timebase units.

Indicates the smallest interval of time, in seconds, used by the stream. For fixed frame rate material, or variable frame rate material where frames are timed at a multiple of a given clock (ex: video capture), the RECOMMENDED method is to set the timebase to the reciprocal of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the pts to correspond to the frame number, which can be handy. For re-encoding video from containers with absolute time timestamps, the RECOMMENDED method is to set the timebase to that of the parent container or multimedia framework (ex: 1/1000 for ms, as in FLV).

## ◆ g_error_resilient

vpx_codec_er_flags_t vpx_codec_enc_cfg::g_error_resilient

Enable error resilient modes.

The error resilient bitfield indicates to the encoder which features it should enable to take measures for streaming over lossy or noisy links.

## ◆ g_pass

enum vpx_enc_pass vpx_codec_enc_cfg::g_pass

Multi-pass Encoding Mode.

This value should be set to the current phase for multi-pass encoding. For single pass, set to VPX_RC_ONE_PASS.

## ◆ g_lag_in_frames

unsigned int vpx_codec_enc_cfg::g_lag_in_frames

Allow lagged encoding.

If set, this value allows the encoder to consume a number of input frames before producing output frames. This allows the encoder to base decisions for the current frame on future frames. This does increase the latency of the encoding pipeline, so it is not appropriate in all situations (ex: realtime encoding).

Note that this is a maximum value – the encoder may produce frames sooner than the given limit. Set this value to 0 to disable this feature.

## ◆ rc_dropframe_thresh

unsigned int vpx_codec_enc_cfg::rc_dropframe_thresh

Temporal resampling configuration, if supported by the codec.

Temporal resampling allows the codec to "drop" frames as a strategy to meet its target data rate. This can cause temporal discontinuities in the encoded video, which may appear as stuttering during playback. This trade-off is often acceptable, but for many applications is not. It can be disabled in these cases.

This threshold is described as a percentage of the target data buffer. When the data buffer falls below this percentage of fullness, a dropped frame is indicated. Set the threshold to zero (0) to disable this feature.

## ◆ rc_resize_allowed

unsigned int vpx_codec_enc_cfg::rc_resize_allowed

Enable/disable spatial resampling, if supported by the codec.

Spatial resampling allows the codec to compress a lower resolution version of the frame, which is then upscaled by the encoder to the correct presentation resolution. This increases visual quality at low data rates, at the expense of CPU time on the encoder/decoder.

## ◆ rc_scaled_width

unsigned int vpx_codec_enc_cfg::rc_scaled_width

Internal coded frame width.

If spatial resampling is enabled this specifies the width of the encoded frame.

## ◆ rc_scaled_height

unsigned int vpx_codec_enc_cfg::rc_scaled_height

Internal coded frame height.

If spatial resampling is enabled this specifies the height of the encoded frame.

## ◆ rc_resize_up_thresh

unsigned int vpx_codec_enc_cfg::rc_resize_up_thresh

Spatial resampling up watermark.

This threshold is described as a percentage of the target data buffer. When the data buffer rises above this percentage of fullness, the encoder will step up to a higher resolution version of the frame.

## ◆ rc_resize_down_thresh

unsigned int vpx_codec_enc_cfg::rc_resize_down_thresh

Spatial resampling down watermark.

This threshold is described as a percentage of the target data buffer. When the data buffer falls below this percentage of fullness, the encoder will step down to a lower resolution version of the frame.

## ◆ rc_end_usage

enum vpx_rc_mode vpx_codec_enc_cfg::rc_end_usage

Rate control algorithm to use.

Indicates whether the end usage of this stream is to be streamed over a bandwidth constrained link, indicating that Constant Bit Rate (CBR) mode should be used, or whether it will be played back on a high bandwidth link, as from a local disk, where higher variations in bitrate are acceptable.

## ◆ rc_twopass_stats_in

vpx_fixed_buf_t vpx_codec_enc_cfg::rc_twopass_stats_in

Two-pass stats buffer.

A buffer containing all of the stats packets produced in the first pass, concatenated.

## ◆ rc_firstpass_mb_stats_in

vpx_fixed_buf_t vpx_codec_enc_cfg::rc_firstpass_mb_stats_in

first pass mb stats buffer.

A buffer containing all of the first pass mb stats packets produced in the first pass, concatenated.

## ◆ rc_target_bitrate

unsigned int vpx_codec_enc_cfg::rc_target_bitrate

Target data rate.

Target bitrate to use for this stream, in kilobits per second. Internally capped to the smaller of the uncompressed bitrate and 1000000 kilobits per second.

## ◆ rc_min_quantizer

unsigned int vpx_codec_enc_cfg::rc_min_quantizer

Minimum (Best Quality) Quantizer.

The quantizer is the most direct control over the quality of the encoded image. The range of valid values for the quantizer is codec specific. Consult the documentation for the codec to determine the values to use.

## ◆ rc_max_quantizer

unsigned int vpx_codec_enc_cfg::rc_max_quantizer

Maximum (Worst Quality) Quantizer.

The quantizer is the most direct control over the quality of the encoded image. The range of valid values for the quantizer is codec specific. Consult the documentation for the codec to determine the values to use.

## ◆ rc_undershoot_pct

unsigned int vpx_codec_enc_cfg::rc_undershoot_pct

Rate control adaptation undershoot control.

VP8: Expressed as a percentage of the target bitrate, controls the maximum allowed adaptation speed of the codec. This factor controls the maximum amount of bits that can be subtracted from the target bitrate in order to compensate for prior overshoot. VP9: Expressed as a percentage of the target bitrate, a threshold undershoot level (current rate vs target) beyond which more aggressive corrective measures are taken.

- Valid values in the range VP8:0-100 VP9: 0-100.

## ◆ rc_overshoot_pct

unsigned int vpx_codec_enc_cfg::rc_overshoot_pct

Rate control adaptation overshoot control.

VP8: Expressed as a percentage of the target bitrate, controls the maximum allowed adaptation speed of the codec. This factor controls the maximum amount of bits that can be added to the target bitrate in order to compensate for prior undershoot. VP9: Expressed as a percentage of the target bitrate, a threshold overshoot level (current rate vs target) beyond which more aggressive corrective measures are taken.

Valid values in the range VP8:0-100 VP9: 0-100.

## ◆ rc_buf_sz

unsigned int vpx_codec_enc_cfg::rc_buf_sz

Decoder Buffer Size.

This value indicates the amount of data that may be buffered by the decoding application. Note that this value is expressed in units of time (milliseconds). For example, a value of 5000 indicates that the client will buffer (at least) 5000ms worth of encoded data. Use the target bitrate (rc_target_bitrate) to convert to bits/bytes, if necessary.

## ◆ rc_buf_initial_sz

unsigned int vpx_codec_enc_cfg::rc_buf_initial_sz

Decoder Buffer Initial Size.

This value indicates the amount of data that will be buffered by the decoding application prior to beginning playback. This value is expressed in units of time (milliseconds). Use the target bitrate (rc_target_bitrate) to convert to bits/bytes, if necessary.

## ◆ rc_buf_optimal_sz

unsigned int vpx_codec_enc_cfg::rc_buf_optimal_sz

Decoder Buffer Optimal Size.

This value indicates the amount of data that the encoder should try to maintain in the decoder's buffer. This value is expressed in units of time (milliseconds). Use the target bitrate (rc_target_bitrate) to convert to bits/bytes, if necessary.

## ◆ rc_2pass_vbr_bias_pct

unsigned int vpx_codec_enc_cfg::rc_2pass_vbr_bias_pct

Two-pass mode CBR/VBR bias.

Bias, expressed on a scale of 0 to 100, for determining target size for the current frame. The value 0 indicates the optimal CBR mode value should be used. The value 100 indicates the optimal VBR mode value should be used. Values in between indicate which way the encoder should "lean."

## ◆ rc_2pass_vbr_minsection_pct

unsigned int vpx_codec_enc_cfg::rc_2pass_vbr_minsection_pct

Two-pass mode per-GOP minimum bitrate.

This value, expressed as a percentage of the target bitrate, indicates the minimum bitrate to be used for a single GOP (aka "section")

## ◆ rc_2pass_vbr_maxsection_pct

unsigned int vpx_codec_enc_cfg::rc_2pass_vbr_maxsection_pct

Two-pass mode per-GOP maximum bitrate.

This value, expressed as a percentage of the target bitrate, indicates the maximum bitrate to be used for a single GOP (aka "section")

## ◆ kf_mode

enum vpx_kf_mode vpx_codec_enc_cfg::kf_mode

Keyframe placement mode.

This value indicates whether the encoder should place keyframes at a fixed interval, or determine the optimal placement automatically (as governed by the kf_min_dist and kf_max_dist parameters)

## ◆ kf_min_dist

unsigned int vpx_codec_enc_cfg::kf_min_dist

Keyframe minimum interval.

This value, expressed as a number of frames, prevents the encoder from placing a keyframe nearer than kf_min_dist to the previous keyframe. At least kf_min_dist frames non-keyframes will be coded before the next keyframe. Set kf_min_dist equal to kf_max_dist for a fixed interval.

## ◆ kf_max_dist

unsigned int vpx_codec_enc_cfg::kf_max_dist

Keyframe maximum interval.

This value, expressed as a number of frames, forces the encoder to code a keyframe if one has not been coded in the last kf_max_dist frames. A value of 0 implies all frames will be keyframes. Set kf_min_dist equal to kf_max_dist for a fixed interval.

## ◆ ss_number_layers

unsigned int vpx_codec_enc_cfg::ss_number_layers

Number of spatial coding layers.

This value specifies the number of spatial coding layers to be used.

## ◆ ss_enable_auto_alt_ref

int vpx_codec_enc_cfg::ss_enable_auto_alt_ref[5]

Enable auto alt reference flags for each spatial layer.

These values specify if auto alt reference frame is enabled for each spatial layer.

## ◆ ss_target_bitrate

unsigned int vpx_codec_enc_cfg::ss_target_bitrate[5]

Target bitrate for each spatial layer.

These values specify the target coding bitrate to be used for each spatial layer. (in kbps)

## ◆ ts_number_layers

unsigned int vpx_codec_enc_cfg::ts_number_layers

Number of temporal coding layers.

This value specifies the number of temporal layers to be used.

## ◆ ts_target_bitrate

unsigned int vpx_codec_enc_cfg::ts_target_bitrate[5]

Target bitrate for each temporal layer.

These values specify the target coding bitrate to be used for each temporal layer. (in kbps)

## ◆ ts_rate_decimator

unsigned int vpx_codec_enc_cfg::ts_rate_decimator[5]

Frame rate decimation factor for each temporal layer.

These values specify the frame rate decimation factors to apply to each temporal layer.

## ◆ ts_periodicity

unsigned int vpx_codec_enc_cfg::ts_periodicity

Length of the sequence defining frame temporal layer membership.

This value specifies the length of the sequence that defines the membership of frames to temporal layers. For example, if the ts_periodicity = 8, then the frames are assigned to coding layers with a repeated sequence of length 8.

## ◆ ts_layer_id

unsigned int vpx_codec_enc_cfg::ts_layer_id[16]

Template defining the membership of frames to temporal layers.

This array defines the membership of frames to temporal coding layers. For a 2-layer encoding that assigns even numbered frames to one temporal layer (0) and odd numbered frames to a second temporal layer (1) with ts_periodicity=8, then ts_layer_id = (0,1,0,1,0,1,0,1).

## ◆ layer_target_bitrate

unsigned int vpx_codec_enc_cfg::layer_target_bitrate[12]

Target bitrate for each spatial/temporal layer.

These values specify the target coding bitrate to be used for each spatial/temporal layer. (in kbps)

## ◆ temporal_layering_mode

int vpx_codec_enc_cfg::temporal_layering_mode

Temporal layering mode indicating which temporal layering scheme to use.

The value (refer to VP9E_TEMPORAL_LAYERING_MODE) specifies the temporal layering mode to use.

## ◆ active_wq_factor

vpx_rational_t vpx_codec_enc_cfg::active_wq_factor

Active worst quality factor.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## ◆ err_per_mb_factor

vpx_rational_t vpx_codec_enc_cfg::err_per_mb_factor

Error per macroblock adjustment factor.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## ◆ sr_default_decay_limit

vpx_rational_t vpx_codec_enc_cfg::sr_default_decay_limit

Second reference default decay limit.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## ◆ sr_diff_factor

vpx_rational_t vpx_codec_enc_cfg::sr_diff_factor

Second reference difference factor.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## ◆ kf_err_per_mb_factor

vpx_rational_t vpx_codec_enc_cfg::kf_err_per_mb_factor

Keyframe error per macroblock adjustment factor.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## ◆ kf_frame_min_boost_factor

vpx_rational_t vpx_codec_enc_cfg::kf_frame_min_boost_factor

Keyframe minimum boost adjustment factor.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## ◆ kf_frame_max_boost_first_factor

vpx_rational_t vpx_codec_enc_cfg::kf_frame_max_boost_first_factor

Keyframe maximum boost adjustment factor, for the first keyframe in a chunk.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## ◆ kf_frame_max_boost_subs_factor

vpx_rational_t vpx_codec_enc_cfg::kf_frame_max_boost_subs_factor

Keyframe maximum boost adjustment factor, for subsequent keyframes.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## ◆ kf_max_total_boost_factor

vpx_rational_t vpx_codec_enc_cfg::kf_max_total_boost_factor

Keyframe maximum total boost adjustment factor.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## ◆ gf_max_total_boost_factor

vpx_rational_t vpx_codec_enc_cfg::gf_max_total_boost_factor

Golden frame maximum total boost adjustment factor.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## ◆ gf_frame_max_boost_factor

vpx_rational_t vpx_codec_enc_cfg::gf_frame_max_boost_factor

Golden frame maximum boost adjustment factor.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

## ◆ zm_factor

vpx_rational_t vpx_codec_enc_cfg::zm_factor

Zero motion power factor.

Rate control parameters, set from external experiment results. Only when |use_vizier_rc_params| is set to 1, the pass in value will be used. Otherwise, the default value is used.

The documentation for this struct was generated from the following file:

- vpx/vpx_encoder.h