API Parameters

wz_encoder_config_t

  • Reopen encoder: if updated, these parameters will cause the encoder to reopen itself.
  • No: not safe or no effect
  • Yes: safe to update

Basic configuration parameters are preset (fast, faster, etc.) and tune (camera/screen/adaptive). Available values are specifid in wzav1enc.h or in Presets and Tuning Options.

Recommended values for low complexity RTC applications are between superfast and ultrafast.

type name Description Safe for update config
const char * preset codec preset for speed level Reopen encoder
const char * tune codec tune for scene Reopen encoder
const char * rc_type rate control method type. Reopen encoder
int32_t adaptive_vq_bias bias towards higher quality high motion/camera frames when using tune=adaptive [0-9] No
int32_t width image origin width Reopen encoder
int32_t width_max image maximum width Reopen encoder
int32_t height image origin height Reopen encoder
int32_t height_max image maximum height Reopen encoder
int32_t threads encoder threads number Reopen encoder
int32_t frame_rate_num frame rate numerator Yes
int32_t frame_rate_den frame rate denominator Yes
int32_t time_base_num time base numerator, default should be 1 Yes
int32_t time_base_den time base denominator, time scale of pts Yes
int32_t bitratekbps bit rate kbps per second, valid when rc type is "vbr", "cbr" Yes
int32_t vbv_buffer_size buffer size of vbv, 0 means vbv not enabled,default 0 Yes
int32_t vbv_max_rate max rate of vbv, 0 means vbv not enabled,default 0 Yes
int32_t frame_kbits_limit frame max kbits limit for rc, if qpmax is also set,the actual frame bit may exceed this Yes
int32_t max_intra_kbits maximum allowed bitrate(kbps) for any intra frame, default 0 Yes
int32_t crf crf for video quality, only valid when rc_type is "crf" No
int32_t qp qp , only valid when rc_type is "q" No
int32_t qpmin minimal qp, valid when rc_type is not "q", 1~qpmax No
int32_t qpmax maximal qp, valid when rc_type is not "q", 1~255 No
int32_t max_keyframe_dist max dist between key frames(<=0: no periodically I frame insertion) No
int32_t min_keyframe_dist min dist between key frames No
int32_t s_frame_dist min dist between S frames No
int32_t gop_size (number of b frames) + 1, [1, 16] No
int32_t b_pyramid pyramid b-frames, default 5 No
int32_t lookahead lookahead depth [0, 65] No
int32_t log_level log level, [-1,2] debug info warn error, default is info No
int32_t enable_scalability enable svc (will overwrite gop_size and lookahead) Yes
wz_scalability_mode_t scalability_mode svc mode, [0, 1] Yes
int32_t enable_frame_skip max continuous skipped frame for rate control,default 0 Yes
int32_t tile_cols tile cols, [1, 64], default 1 Reopen encoder
int32_t tile_rows tile rows, [1, 64], default 1 Reopen encoder
int32_t enable_frame_id enable frame_id_numbers_present_flag No
int32_t scenecut scenecut threshold Yes
int32_t fpp frame parallel threads, default 0(disable) Reopen encoder

extra_cfg

The API allows a number of additional parameters to be passed through to the encoder in string format. This can be done at setup and during encoding as an update.

The following table lists the encoding tools that can be configured through "extra_cfg", and you can use "key=value" to set these tools, with colon delimiters (":"). For example, psnr=1:summary=1

Params DataType,{Value} Description Safe for update config
psnr Int, {0, 1} Show PSNR Yes
ssim Int, {0, 1} Show SSIM Yes
summary Int, {0, 1} Show some information after encoding Yes
refs Int, {0 - 7} Maximum reference frames to be used , 0:auto Yes
rr Int, {0,1,2,3} Rate control level, 0: frame level, 1: constrained frame level, 2: block level, 3: hard frame block level; default is 3. No
strict_vbv Int, {0,1} Strict VBV based rate control default is 0. No
error_resilient_mode Int, {0,1} Turn error resilient mode on/off. Default is 0. No
imaxq Int, {1 - 255} Maximal qp value for key frames, default is -1(means equal to qpmax) No
iminq Int, {1 - 255} minimal qp value for key frames, default is -1(means equal to qpmin) No
layer_maxq Int, {1 - 255} Maximal qp value for each scalable layer, comma-separated No
layer_maxq Int, {1 - 255} Maximal qp value for each scalable layer, comma-separated No
tsbr string, {value1, value2,...} Target bitrate(kbps) for each temporal layer, comma-separated Yes
lry int, {0 - 2} Loop restoration level for luma No
lruv int, {0 - 2} Loop restoration level for chroma No
sfrs Int Static frame refresh level Yes
init_frame_id Int, {0 - 2^15} Init value of frame_id No
sc_level Int, {0,2} Screen content detect level Yes
force_ref Int Set a specific frame_id to be used for reference when only 1 reference frame is used Yes
td_obu Int,{0, 1} Enable temporal_delimiter OBU, default is 1 No
sbrow_tx_thr Int Reduce complexity for huge frames, default is INT_MAX Yes
obu_extension Int,{0, 1} Enable obu header extension, default is 1 No
svc_meta_obu Int,{0, 1} Enable svc metadata OBU, default is 0 No
max_qindex_reduce Int,{0 - 255} Max qindex reduction from last layer 0 frame, default is 40 Yes
dup_frame_detect Int,{0, 1, 2} Detect duplicate frames and re-show instead of coding 0:off, 1: strong test 2: weaker test default is 2 Yes
aq_mode Int, {0,3} Adaptive Quantization model, default is speed/preset-dependent Yes
aq_strength Int Adaptive Quantization strength, default is speed/preset-dependent Yes
adaptive_resolution Int {0-15} Adaptive resolution control flags, default 0 No
qindex_switch_up Int, {0 - 255} QIndex at which resolution is switched up Yes
qindex_switch_down Int, {0 - 255} QIndex at which resolution is switched down: Yes
gfi Golden frame interval Frame distance between golden frames, default is speed/preset dependent Yes
gfb / gfbtf Golden frame boost Boost for golden frames or temporally filtered golden frames Yes
cbr_decay Int, {1 - 99} Speed of rate adaptation Yes

Flags

Flags can also be passed in each encoder call to set frame-specific features (e.g. force a keyframe). The available flags are:

WZ_FORCE_KEYFRAME_FLAG        ..... Force this frame to be a key frame
WZ_FORCE_SFRAME_FLAG          ..... Force this frame to be a switch frame
WZ_FORCE_INTRAONLY_FLAG       ..... Force this frame to be an intra-only frame
WZ_SET_SVC_TID_FLAG           ..... Set this frame to have a specific temporal ID (must be in range for the scalability preset - see below)
WZ_SET_SVC_SID_FLAG           ..... Set this frame to have a specific spatial ID (must be in range for the scalability preset - see below)

The layer ID values are set within the respective bit positions e.g. (tid << WZ_SVC_TID_SHIFT). Note there is potential conflicts between the set layer IDs and other flags and settings (such as frame skip) which may cause the encoded layer ID to be different. The output layer ID should always be checked.

Region of Interest (ROI) encoding

ROI rectangles may be passed with the frame structure with each call to the encoder. This is an experimental feature.

Film Grain Support

Aurora1-RTC does not support Film Grain Synthesis.

Screen Content Coding

Aurora1-RTC has extensive support for encoding optimised for screen content. It can be accessed via the screen preset.