Rate Control
Rate control modes
The Aurora5 encoder supports multiple rate control algorithms. Here are code snippets that demonstrate the different rate control modes using FFmpeg integrated with Aurora5.
- 1-pass ABR, averaged bitrate (by setting
-b:v
or by setting-wz265-params bitrate
) - 1-pass VBR, vbv-limited bitrate(by setting
-b:v 1000k -maxrate 2000k -bufsize 4000k
or by setting-wz265-params 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-wz265-params bitrate=1000:vbv-maxrate=1000:vbv-bufsize=1000
or by setting-wz265-params rc=3:bitrate=1000
) - 1-pass strict CBR (by setting
-wz265-params rc=3:bitrate=1000:strict-cbr=1
) - Constant quality mode(by setting
-crf
) - 2-pass ABR
Two-pass example
For two-pass, you need to run ffmpeg
twice as follows:
- In pass 1 and 2, use the
-wz265-params pass=1:statout=2pass.log
and-wz265-params pass=2:statin=2pass.log
options, respectively. - Make sure
statout
andstatin
is the same file. - 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 libwz265, the -pass
option is not applicable.
ffmpeg -y -i input -c:v libwz265 -b:v 2600k -wz265-params pass=1 -an -f null /dev/null && \
ffmpeg -i input -c:v libwz265 -b:v 2600k -wz265-params pass=2 -c:a aac -b:a 128k output.mp4
Note: Windows users should use NUL
instead of /dev/null
and ^
instead of \
.