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
| Algorithm specific "usage" value. More...
unsigned int | g_threads
| Maximum number of threads to use. More...
unsigned int | g_profile
| Bitstream profile to use. More...
unsigned int | g_w
| Width of the frame. More...
unsigned int | g_h
| Height of the frame. More...
vpx_bit_depth_t | g_bit_depth
| Bit-depth of the codec. More...
unsigned int | g_input_bit_depth
| Bit-depth of the input frames. More...
struct vpx_rational | g_timebase
| Stream timebase units. More...
vpx_codec_er_flags_t | g_error_resilient
| Enable error resilient modes. More...
enum vpx_enc_pass | g_pass
| Multi-pass Encoding Mode. More...
unsigned int | g_lag_in_frames
| Allow lagged encoding. More...
unsigned int | rc_dropframe_thresh
| Temporal resampling configuration, if supported by the codec. More...
unsigned int | rc_resize_allowed
| Enable/disable spatial resampling, if supported by the codec. More...
unsigned int | rc_scaled_width
| Internal coded frame width. More...
unsigned int | rc_scaled_height
| Internal coded frame height. More...
unsigned int | rc_resize_up_thresh
| Spatial resampling up watermark. More...
unsigned int | rc_resize_down_thresh
| Spatial resampling down watermark. More...
enum vpx_rc_mode | rc_end_usage
| Rate control algorithm to use. More...
vpx_fixed_buf_t | rc_twopass_stats_in
| Two-pass stats buffer. More...
vpx_fixed_buf_t | rc_firstpass_mb_stats_in
| first pass mb stats buffer. More...
unsigned int | rc_target_bitrate
| Target data rate. More...
unsigned int | rc_min_quantizer
| Minimum (Best Quality) Quantizer. More...
unsigned int | rc_max_quantizer
| Maximum (Worst Quality) Quantizer. More...
unsigned int | rc_undershoot_pct
| Rate control adaptation undershoot control. More...
unsigned int | rc_overshoot_pct
| Rate control adaptation overshoot control. More...
unsigned int | rc_buf_sz
| Decoder Buffer Size. More...
unsigned int | rc_buf_initial_sz
| Decoder Buffer Initial Size. More...
unsigned int | rc_buf_optimal_sz
| Decoder Buffer Optimal Size. More...
unsigned int | rc_2pass_vbr_bias_pct
| Two-pass mode CBR/VBR bias. More...
unsigned int | rc_2pass_vbr_minsection_pct
| Two-pass mode per-GOP minimum bitrate. More...
unsigned int | rc_2pass_vbr_maxsection_pct
| Two-pass mode per-GOP maximum bitrate. More...
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. More...
unsigned int | kf_min_dist
| Keyframe minimum interval. More...
unsigned int | kf_max_dist
| Keyframe maximum interval. More...
unsigned int | ss_number_layers
| Number of spatial coding layers. More...
int | ss_enable_auto_alt_ref [5]
| Enable auto alt reference flags for each spatial layer. More...
unsigned int | ss_target_bitrate [5]
| Target bitrate for each spatial layer. More...
unsigned int | ts_number_layers
| Number of temporal coding layers. More...
unsigned int | ts_target_bitrate [5]
| Target bitrate for each temporal layer. More...
unsigned int | ts_rate_decimator [5]
| Frame rate decimation factor for each temporal layer. More...
unsigned int | ts_periodicity
| Length of the sequence defining frame temporal layer membership. More...
unsigned int | ts_layer_id [16]
| Template defining the membership of frames to temporal layers. More...
unsigned int | layer_target_bitrate [12]
| Target bitrate for each spatial/temporal layer. More...
int | temporal_layering_mode
| Temporal layering mode indicating which temporal layering scheme to use. More...

## 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

Algorithm specific "usage" value.

Algorithms may define multiple values for usage, which may convey the intent of how the application intends to use the stream. If this value is non-zero, consult the documentation for the codec to determine its meaning.

## ◆ 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.

Note that not all codecs support this feature. All vpx VPx codecs do. For other codecs, consult the documentation for that algorithm.

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 bandwidth to use for this stream, in 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. To determine the range programmatically, call vpx_codec_enc_config_default() with a usage value of 0.

## ◆ 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. To determine the range programmatically, call vpx_codec_enc_config_default() with a usage value of 0.

## ◆ 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 agressive corrective measures are taken.

- Valid values in the range VP8:0-1000 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 agressive corrective measures are taken.

Valid values in the range VP8:0-1000 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.

## ◆ 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.

## ◆ 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.

## ◆ 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.

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

- vpx/vpx_encoder.h