Using Aurora4 with FFmpeg

Introduction

Aurora4 is a high-performance video encoder that integrates seamlessly with FFmpeg. To view the available private options for Aurora4, run the following command:

./ffmpeg -h encoder=aurora4

This will display the encoder's capabilities, supported pixel formats, and all configurable AVOptions, as shown below:

Encoder aurora4 []:
    General capabilities: delay threads
    Threading capabilities: other
    Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p nv12 nv16 nv21 gray yuv420p10le yuv422p10le yuv444p10le gray10le
aurora4 AVOptions:
  -preset            <string>     E..V....... Set the encoding preset  (default "medium")
  -tune              <string>     E..V....... Tune the encoding cfg
  -profile           <string>     E..V....... Set profile restrictions
  -wz264-params      <string>     E..V....... set extra cfg using a :-separated list of key=value parameters
  -crf               <float>      E..V....... Select the quality for constant quality mode (from -1 to FLT_MAX) (default -1)
  -crf_max           <float>      E..V....... In CRF mode, prevents VBV from lowering quality beyond this point. (from -1 to FLT_MAX) (default -1)
  -qp                <int>        E..V....... Constant quantization parameter rate control method (from -1 to INT_MAX) (default -1)
  -quality           <float>      E..V....... Visionular quality level (from -1 to FLT_MAX) (default -1)
  -udu_sei           <boolean>    E..V....... Use user data unregistered SEI if available (default false)
  -a53cc             <boolean>    E..V....... Use A53 Closed Captions (if available) (default true)
  -duration          <double>     E..V....... video duration (from -1 to DBL_MAX) (default -1)
  -insrc             <boolean>    E..V....... keep ref input src, free it by callback (default false)

Note:

  • For a complete list of parameters that can be configured via the wz264-params string, refer to the Aurora4 API Parameters documentation.
  • Detailed explanations of the -preset and -tune options listed above are available in the Presets and Tuning Options guide.

Q&A for Interlaced Encoding in Aurora4

Q1: Which interlaced encoding mode is supported in Aurora4 SDK?

Aurora4 supports only the PAFF (Picture Adaptive Frame-Field) interlaced encoding mode.

Q2: How should interlaced encoding be correctly configured in the Aurora4 SDK?

The Aurora4 encoder determines whether the output stream is encoded as frames or fields based on the interlace type setting. Interlace type can be configured in two ways:

  1. Via FFmpeg parameters: Use -wz264-params interlace=N, where N is an integer:
  2. 0: Progressive encoding (default)
  3. 1: Top-field first (TFF)
  4. 2: Bottom-field first (BFF)

For interlaced output, set -wz264-params interlace=1 or -wz264-params interlace=2.

  1. Via API interface: Configure through wz4_enc_cfg_t: cfg.interlace_type. Refer to the sample FFmpeg wrapper for implementation details.

The following examples demonstrate Aurora4+FFmpeg transcoding scenarios using the sample FFmpeg executable:

  1. Progressive Inputs → Interlaced Outputs: ./ffmpeg -i 1080P.mp4 -vcodec aurora4 -preset veryfast -b:v 1000k -wz264-params interlace=1 -y 1080I.mp4.
  2. Note: You can set interlace=2 for BFF output. Aurora4 supports converting progressive videos with heights that are multiples of 4 to interlaced format.
  3. Interlaced Inputs → Progressive Outputs: ./ffmpeg -i 1080I.mp4 -vcodec aurora4 -preset veryfast -b:v 1000k -y 1080P.mp4.
  4. Note: The encoder defaults to progressive output.
  5. Interlaced Inputs → Interlaced Outputs: ./ffmpeg -i 1080I.mp4 -vcodec aurora4 -preset veryfast -b:v 1000k -flags +ildct -y 1080P.mp4.
  6. Note: When using the ildct flag with the provided FFmpeg wrapper, the encoder automatically selects between BFF and TFF based on the input.