Rate Control Modes

The Aurora4 encoder supports multiple rate control algorithms. Here are code snippets that demonstrate the different rate control modes using FFmpeg integrated with Aurora4.

  • 1-pass ABR, averaged bitrate (by setting -b:v 1000k or by setting -wz264-params rc=2:bitrate=1000)
  • 1-pass VBR, vbv-limited bitrate(by setting -b:v 1000k -maxrate 2000k -bufsize 4000k or by setting -wz264-params rc=2:bitrate=1000:vbv-maxrate=2000:vbv-bufsize=4000)
  • 1-pass CBR, constant bitrate(by setting -b:v 1000k -maxrate 1000k -bufsize 1000k or by setting -wz264-params rc=2:bitrate=1000:vbv-maxrate=1000:vbv-bufsize=1000)
  • 1-pass CBR, constant bitrate with Non-CBR NAL HRD (by setting -wz264-params rc=2:bitrate=1000:vbv-maxrate=1000:vbv-bufsize=1000:hrd=1)
  • 1-pass hard CBR, constant bitrate with filler (by setting -wz264-params rc=2:bitrate=1000:vbv-maxrate=1000:vbv-bufsize=1000:strict-cbr=1)
  • 1-pass hard CBR, constant bitrate with filler and CBR NAL HRD (by setting -wz264-params rc=2:bitrate=1000:vbv-maxrate=1000:vbv-bufsize=1000:strict-cbr=1:hrd=1)
  • Constant quality mode(by setting -crf 23 or by setting -wz264-params rc=1:crf=23)
  • 2-pass ABR

Two-pass example

For two-pass, you need to run ffmpeg twice, with almost the same settings, except for:

  • In pass 1 and 2, use the -wz264-params pass=1:stats=aurora4_2pass.log and -wz264-params pass=2:stats=aurora4_2pass.log options, respectively.
  • The default value of stats is “aurora4_2pass.log”
  • In pass 1, output to a null file descriptor, not an actual file. (This will generate a logfile that ffmpeg needs for the second pass.)
  • In pass 1, you can leave audio out by specifying -an.

For aurora4, the -pass option is not applicable.

ffmpeg -y -i input -c:v aurora4 -b:v 2600k -wz264-params pass=1 -an -f null /dev/null && \
ffmpeg -i input -c:v aurora4 -b:v 2600k -wz264-params pass=2 -c:a aac -b:a 128k output.mp4

Note: Windows users should use NUL instead of /dev/null and ^ instead of \.