Aurora5 Sample Encoder

Introduction

wz265_sample_encoder is a simple encoder program demonstrating the use of the Aurora5 APIs.

The usage of wz265_sample_encoder shown as below:

Usage: ./wz265_sample_encoder <preset> <tune> <width> <height> <bit-depth> <fps-num> <in-yuv> <outfile> <keyframe-interval> <rc-type> <target-bitrate/crf/qp/quality> <threads> <frames to encode> [wz265-params] [debug-log]

preset: ultrafast superfast veryfast faster fast medium slow
tune: default ssim psnr vmaf screen movie game zerolatency universe

You can find more details listed as below for each parameter

  preset            <string>     ..... Set preset (supported presets listed in wz265enc.h) parameter    
  tune              <string>     ..... Set tune(default ssim psnr vmaf screen movie game zerolatency universe) parameter
  width             <int>        ..... Set frame width
  height            <int>        ..... Set frame height
  bit-depth         <int>        ..... Set bit depth(8 and 10 bit are supported)
  fps-num           <int>        ..... Set frame per seconds (from 1 to 120)
  in-yuv            <string>     ..... Set path of encoding sequence (only yuv is supported)
  outfile           <string>     ..... Set path of output file
  keyframe-interval <int>        ..... Set maximum keyframe intervals
  rc-type           <int>        ..... Set rate control type(0: cqp, 1: crf, 2: abr, 3: cbr) parameter
  target-bitrate/crf/qp/quality  <float>
                                 ..... Set target-bitrate(kbps) or crf values(from 1 to 51) or qp values(from 1 to 51) or quality (from 1 to 5)
  threads           <int>        ..... Set threads
  frames to encode  <int>        ..... Set frames to be encoded (from -1 to INT_MAX, -1 means maximal availabe frames)
  wz265-params      <string>     ..... Set extra configurations (use ":" to separate different params)
  debug-log         <int>        ..... Set whether output debug logs or not (1: enable, 0: disable, default is 0), can be skipped

For further explanations for -tune and -preset, please refer to the Tune and Preset Options page.

Note:

  • The executable is built from the file wz265_sample_encoder.c and header files declaring the API functions and the relevant structures.
  • The encoder is built from WZ265EncConfig which exposes the core parameters needed to set up the encoder.
  • Further parameters can be passed in an extra configuration string by wz265-params.
  • Parameters can be modified before each encode call by updating the configuration, but this may cause the encoder to be reset in some cases.

Please refer to the Aurora5 API Parameters page for a detailed explanation of all the parameters that can be used with Aurora5's APIs.

Building The wz265_sample_encoder

  • Step 1: The encoding configuration is open to you, please refer to samples/wz265_sample_encoder.c

    • Encoding configurations, such as vbv_max_rate, vbv_buffer_size etc. can be reset according to your requirements.
  • Step 2: Build your own sample encoder by executing the following commandlines -

Build: gcc samples/wz265_sample_encoder.c -I include/ -L lib/ -lwz265 -o wz265_sample_encoder
Run: LD_LIBRARY_PATH=`pwd`/lib/ ./wz265_sample_encoder ...

Running The wz265_sample_encoder

Here are some examples of running the wz265_sample_encoder in different rate-control modes.

  • Constant Quality Mode - suitable for on-demand application scenarios.
LD_LIBRARY_PATH=`pwd`/lib/ ./bin/wz265_sample_encoder slow default 1920 1080 8 30 input.yuv output.265 300 1 30 4 1000 vbv-maxrate=10000 0
  • Averaged Bitrate Mode - suitable for live broadcast application scenarios.
LD_LIBRARY_PATH=`pwd`/lib/ ./bin/wz265_sample_encoder fast default 1920 1080 8 30 input.yuv output.265 90 2 3000 8 1000 bframes=7:rc-lookahead=16 0
  • Constant Bitrate Mode - suitable for RTC application scenarios.
LD_LIBRARY_PATH=`pwd`/lib/ ./bin/wz265_sample_encoder veryfast zerolatency 1920 1080 8 30 input.yuv output.265 1000 3 2000 4 1000 psnr=1 0