Skip to content

Latest commit

 

History

History
967 lines (828 loc) · 80.1 KB

quality.rst

File metadata and controls

967 lines (828 loc) · 80.1 KB

Video Quality

In this document we describe the methodology which is used to measure video quality of Intel® Media SDK Sample Multi-Transcode and ffmpeg-qsv (Intel® Media SDK integration into FFmpeg) codecs. A video quality measuring tool which implements this methodology is provided as a part of Media Delivery Software Stack. In addition, a performance measuring tool is provided for allowing users to evaluate performance (see performance methodology documentation).

Peak signal-to-noise ratio (PSNR) is the most widely used objective image quality metric. We use arithmetic average PSNR of the luminance frames (PSNR-Y) as the basic quality assessment metric. Since PSNR fails to capture certain perceptual quality traits, we also make use of the following additional quality metrics: VMAF, SSIM, and MS-SSIM.

To compare quality with different codecs and/or coding options, we compute the Bjøntegaard-Delta bitrate (BD-rate) measure, in which negative values indicate how much the bitrate is reduced, and positive values indicate how much the bitrate is increased for the same PSNR-Y. A minimum of 4 distinct points are needed for a successful BD-rate measure, so a minimum of 4 distinct bitrates need to be used for each sequence being tested. We resort to measuring quality using 5 target bitrates in order to capture a variety of encoding scenarios. However, instead of using a single 5-point BD-rate measure, we use an average of two 4-point BD-rate measures instead, where the lowest 4 of 5 points are used as the low bitrates BD-rate measure and the highest 4 of 5 points are used as the high bitrates BD-rate measure.

We evaluate encoding quality on the following 27 video sequences:

  • 1080p 8-bit YUV 4:2:0
Sequence Resolution FPS Frames MD5 Checksum Source
BasketBallDrive 1920x1080 50 500 e18034a26708a3c534a3b03d3bf82d61 MPEG Test Suite
BQTerrace 1920x1080 60 600 cc17d5957b732ec5eab9234d6f5318e3 MPEG Test Suite
Cactus 1920x1080 50 500 3fddb71486f209f1eb8020a0880ddf82 MPEG Test Suite
CrowdRun 1920x1080 50 500 da34812b5b2c316d40481c7b6c841e41 https://media.xiph.org/video/derf/
DinnerScene 1920x1080 60 600 d1260db74160c61b72d7e1cee00e1ec2 https://media.xiph.org/video/derf/
Kimono 1920x1080 24 240 4a83005bc719012ac148dd3898e5e4ed MPEG Test Suite
ParkJoy 1920x1080 50 300 37dc2f9b6a2d1f4e50ac6cc432112733 https://media.xiph.org/video/derf/
RedKayak 1920x1080 30 570 2901bec44d6f43af3e8316b94d8af02b https://media.xiph.org/video/derf/
RushFieldCuts 1920x1080 30 570 055207f6a5819f3a1dc216a64f8634f9 https://media.xiph.org/video/derf/
  • 720p 8-bit YUV 4:2:0
Sequence Resolution FPS Frames MD5 Checksum Source
Boat 1280x720 60 300 45207fbd760394f011cff2af34d59ddc https://media.xiph.org/video/derf/
CrowdRun 1280x720 50 500 371e4d129556b27e17b1bc92c16a69d4 https://media.xiph.org/video/derf/
FoodMarket 1280x720 60 300 f41cb6ddaaaae9fec392da4e2e47b07e https://media.xiph.org/video/derf/
Kimono 1280x720 24 240 e6bbaf876f00fe1709f5e8e1ec8da967 MPEG Test Suite
ParkJoy 1280x720 50 500 ef5868b66118c7fcbfdca069efdac684 https://media.xiph.org/video/derf/
ParkScene 1280x720 24 240 d56b03ba9bf0afeac2800af9ab18c9eb MPEG Test Suite
PierSeaside 1280x720 60 600 ffd18a73e6d694097613cfd5228ec6c1 https://media.xiph.org/video/derf/
Tango 1280x720 60 294 8ba856e08c3eefbe495a68f4df7ee0f5 https://media.xiph.org/video/derf/
TouchDownPass 1280x720 30 570 db92db55a027922f7ea7276ae680f819 MPEG Test Suite
  • Synthetic/Animation Test Content 1080p 8-bit YUV 4:2:0
Sequence Resolution FPS Frames MD5 Checksum Source
Bunny 1920x1080 24 600 987f1923ccf93d26271324b21c39ec45 https://media.xiph.org/video/derf/
CSGO 1920x1080 60 600 5a7575d1c403a08347cffe88bcbc1805 https://media.xiph.org/video/derf/
DOTA2 1920x1080 60 600 a3a7d5e1c9964e5aa6f5e3e520320c32 https://media.xiph.org/video/derf/
GTAV 1920x1080 60 600 22ad590c3f624ac0884062a68674ef4a https://media.xiph.org/video/derf/
Hearthstone 1920x1080 60 600 d5eb7157f37386d5a2df0e789aed8909 https://media.xiph.org/video/derf/
Minecraft 1920x1080 60 600 3bc4b5a002b5b4140e45bb0ded4a3620 https://media.xiph.org/video/derf/
MrFox_BlueBird 1920x1080 30 300 30801242685c4ed75c9eb748d5a4d0e7 VQEG Test Suite
Sintel_offset537n480 1920x1080 24 480 1229ca7e98831ca85e6411e1bce12757 https://media.xiph.org/video/derf/
Witcher 1920x1080 60 600 cc082ec495a47085ba1c08b99e4de2e4 https://media.xiph.org/video/derf/

Quality assessment with Intel® Media Delivery solution is provided for 2 different encoding/transcoding use cases:

  1. High Quality (HQ) - targets applications such as video archiving and storage (e.g. Blu-ray), and video streaming with a tolerable delay (e.g. video-on-demand). These applications have very few restrictions on the use of encoding tools such as look-ahead and B-frames, and can tolerate a larger delay (typically > 0.5 seconds).
  2. Low Delay (LD) - is used in live streaming applications such as game streaming, user generated content streaming or events broadcasting. In these types of application the maxium tolerable delay is only a few frames (i.e. less than 0.5 seconds), and the use of advanced encoding prediction tools is limited (no B-frames, no look-ahead, etc).

HQ use case is set as a default in Media Delivery Software Stack quality measure. Details of the quality assessment methodology for HQ use case are described next. On the other hand, to learn more about quality assessment methodology for LD use case, please refer to quality-lowdelay.

The following table shows specific target bitrates used in quality evaluation of our H.264/AVC, H.265/HEVC and AV1 GPU based video encoders (for HQ use case). Note that 5 bitrates are given: the lowest 4 are used for the low BD-rate measure while the largest 4 are used for the high BD-rate measure.

Sequence Resolution Bitrates (Mb/s)
H.264/AVC H.265/HEVC AV1
BasketBallDrive 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
BQTerrace 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
Cactus 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
CrowdRun * 1920x1080 15, 20, 25, 30, 35 15, 20, 25, 30, 35 15, 20, 25, 30, 35
DinnerScene * 1920x1080 1, 1.5, 2, 3, 4 3, 7, 11, 15, 20 3, 7, 11, 15, 20
Kimono 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
ParkJoy * 1920x1080 15, 20, 25, 30, 35 15, 20, 25, 30, 35 15, 20, 25, 30, 35
RedKayak 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
RushFieldCuts 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
Boat 1280x720 1, 1.5, 3, 6, 12 1, 1.5, 3, 4.5, 7.5 1, 1.5, 3, 4.5, 7.5
CrowdRun * 1280x720 6, 8, 10, 12, 15 6, 8, 10, 12, 15 6, 8, 10, 12, 15
FoodMarket 1280x720 1, 1.5, 3, 6, 12 1, 1.5, 3, 4.5, 7.5 1, 1.5, 3, 4.5, 7.5
Kimono 1280x720 1, 1.5, 3, 6, 12 1, 1.5, 3, 4.5, 7.5 1, 1.5, 3, 4.5, 7.5
ParkJoy * 1280x720 6, 8, 10, 12, 15 6, 8, 10, 12, 15 6, 8, 10, 12, 15
ParkScene 1280x720 1, 1.5, 3, 6, 12 1, 1.5, 3, 4.5, 7.5 1, 1.5, 3, 4.5, 7.5
PierSeaSide 1280x720 1, 1.5, 3, 6, 12 1, 1.5, 3, 4.5, 7.5 1, 1.5, 3, 4.5, 7.5
Tango 1280x720 1, 1.5, 3, 6, 12 1, 1.5, 3, 4.5, 7.5 1, 1.5, 3, 4.5, 7.5
TouchDownPass 1280x720 1, 1.5, 3, 6, 12 1, 1.5, 3, 4.5, 7.5 1, 1.5, 3, 4.5, 7.5
Bunny 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
CSGO 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
DOTA2 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
GTAV 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
Hearthstone 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
Minecraft 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
MrFox_BlueBird 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
Sintel_offset537n480 * 1920x1080 0.5, 1, 2, 6, 9 0.5, 1, 2, 6, 9 0.5, 1, 2, 6, 9
Witcher 1920x1080 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15

* Sequences requiring exceptional target bitrates

If a user does not explicitly specify the target bitrates for a user-defined sequence or stream, the following bitrates are used by default:

Resolution Bitrates (Mb/s)
H.264/AVC H.265/HEVC AV1
4K and over 6, 9, 15, 24, 40 6, 9, 15, 24, 40 6, 9, 15, 24, 40
1080p and under 4K 2, 3, 6, 12, 24 2, 3, 6, 9, 15 2, 3, 6, 9, 15
under 1080p (e.g. 720p) 1, 1.5, 3, 6, 12 1, 1.5, 3, 4.5, 7.5 1, 1.5, 3, 4.5, 7.5

For HQ use case, we measure 2 encoding modes: variable bitrate (VBR) mode and constant bitrate (CBR) mode. The final average BD-rate for a video sequence encoded with a given encoder is computed by averaging the following 4 individual BD-rates:

  1. CBR low bitrates BD-rate
  2. CBR high bitrates BD-rate
  3. VBR low bitrates BD-rate
  4. VBR high bitrates BD-rate.

In the following sections you can find command lines used for high quality H.264/AVC, H.265/HEVC and AV1 video coding with Intel® Media SDK Sample Multi-Transcode and ffmpeg-qsv (Intel® Media SDK integration into FFmpeg).

A video quality measuring tool is provided as a part of Media Delivery Software Stack. The tool allows users to measure video quality for themselves in a manner described in this document for either a predefined set of video sequences, or a video sequences of their choosing. The input can be a raw YUV 4:2:0 8-bit file, or any video encoded bitstream (raw or within a container) supported by ffmpeg.

measure quality -w 1920 -h 1080 -f 24 InputVideo.yuv
measure quality InputVideo.h264

Both ffmpeg and sample-multi-transcode quality results will be computed for pre-encoded input content.

measure quality InputVideo.mp4

Only ffmpeg-based quality results will be computed for pre-encoded input content encapsulated in a container.

Next we present quality command lines for H.264/AVC and H.265/HEVC. To maximize quality over performance, please use "veryslow" preset. For maximum performance set preset to "veryfast". For a balanced quality/performance tradeoff use "medium" preset.

EncTools is Intel’s new software based (SW) BRC which includes a suite of adaptive encoding tools designed to improve video quality (thus a name EncTools).

ExtBRC is Intel’s legacy SW BRC.

EncTools are engaged automatically with enabling external BRC (extbrc 1) and setting lookahead depth >= 1. Positive lookahead depth will automatically enable EncTools BRC and all adaptive encoding tools. For low power lookahead to engage with EncTools BRC, lookahead depth should be > mini-GoP size. Several adaptive encoding tools can be disabled by engaging SMT or FFmpeg-QSV flags, such as, for example, AdaptiveI off (disable scene cut detection) and AdaptiveB off (disable adaptive mini-GoP).

# triggers EncTools without low power lookahead (performance boost):
ffmpeg <...> -g 256 -bf 7 -extbrc 1 -look_ahead_depth 8 <...>

# triggers EncTools with low power lookahead (quality boost):
ffmpeg <...> -g 256 -bf 7 -extbrc 1 -look_ahead_depth 40 <...>

# triggers ExtBRC:
ffmpeg <...> -g 256 -bf 7 -extbrc 1 -look_ahead_depth 0 <...>

Below table summarizes which tools are available in EncTools and ExtBRC SW BRCs.

Feature ExtBRC EncTools
Adaptive Long Term Reference (ALTR)*
Scene Change Detection (SCD/Adaptive I)*
Adaptive Motion Compensation Temporal Filter (AMCTF)*
Adaptive Pyramid Quantization (APQ)
Adaptive GOP (AGOP/Adaptive B)
Adaptive Reference Frames (AREF)
Adaptive Custom Quantizer Matrix (ACQM)
Low Power Look Ahead (LPLA)
Persistance Adaptive Quantization (PAQ)

* - VME based and is available up to (and including) DG1.

EncTools and ExtBRC are not supported for all the codecs and platforms - see support matrix below. Please note that HW BRC for VDENC encoders requires HuC which is not enabled by default in Linux kernel on some platforms. First platform which enables HuC by default is DG1 (TGL does not has HuC enabled by default).

Encoder BRC Type DG2/ATS-M DG1 TGL Gen11 (ICL) Gen9 (SKL) Gen8 (BDW)
AVC VME ExtBRC
EncTools
HW BRC
HEVC VME ExtBRC
EncTools
HW BRC
AVC VDENC ExtBRC
EncTools
HW BRC ✗ * ✗ * ✗ *
HEVC VDENC ExtBRC
EncTools
HW BRC ✗ * ✗ *
AV1 ExtBRC
EncTools
HW BRC

DG2 stands for Intel® Arc™ A-Series Graphics (products formerly Alchemist)

* - requires enabled HuC (which is not a default in vanilla Linux kernel)

To achieve better quality with Intel GPU H.264/AVC encoder running EncTools BRC we recommend the following settings:

ffmpeg-qsv options ffmpeg version Comments
VBR
-b:v $bitrate -maxrate $((2 * bitrate)) n2.8 maxrate > bitrate triggers VBR. You can vary maxrate per your needs.
-bufsize $((4 * bitrate)) n4.0 You can vary bufsize per your needs. We recommend to avoid going below 1 second to avoid quality loss. Buffer size of 4 seconds is recommended for VBR.
-rc_init_occupancy $((2 * bitrate)) n2.8 This is the initial buffer delay. You can vary this per your needs. Recommendation is to use 1/2 of bufsize.
CBR
-b:v $bitrate -minrate $bitrate -maxrate $bitrate n2.8 This triggers CBR.
-bufsize $((2 * bitrate)) n4.0 You can vary bufsize per your needs. We recommend to avoid going below 1 second to avoid quality loss. Buffer size of 2 seconds is recommended for CBR.
-rc_init_occupancy $bitrate n2.8 This is the initial buffer delay. You can vary this per your needs. Recommendation is to use 1/2 of bufsize.
CBR & VBR common settings
-bitrate_limit 0 n3.0 This disables target bitrate limitations that exist in MediaSDK/VPL for AVC encoding
-extbrc 1 -look_ahead_depth $lad n3.0 This enables EncTools Software BRC when look ahead depth > than 0. Need to have look ahead depth > than miniGOP size to enable low power look ahead too (miniGOP size is equal to bf+1). The recommended values for $lad are: 8 (for performance boost) and 40 (for quality boost)
-b_strategy 1 -bf 7 n3.0 These 2 settings activate full 3 level B-Pyramid.
-refs 5 n2.7 5 references are important to trigger Long Term Reference (LTR) coding feature.
-g 256 n2.7 Select long enough GOP size for random access encoding. You can vary this setting. Typically 2 to 4 seconds GOP is used.
-adaptive_i 1 -adaptive_b 1 n3.0 Ensures to enable scene change detection and adaptive miniGOP.
-strict -1 n3.0 Disables HRD compliance.
-extra_hw_frames $lad n4.0 Add extra GPU decoder frame surfaces. This is currently needed for transcoding with look ahead (set this option to look ahead depth value)
# VBR (encoding from YUV with ffmpeg-qsv)
ffmpeg -init_hw_device vaapi=va:${DEVICE:-/dev/dri/renderD128} -init_hw_device qsv=hw@va -an \
  -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate -i $inputyuv \
  -frames:v $numframes -c:v h264_qsv -preset $preset -profile:v high -async_depth 1 \
  -b:v $bitrate -maxrate $((2 * bitrate)) -bitrate_limit 0 -bufsize $((4 * bitrate)) \
  -rc_init_occupancy $((2 * bitrate)) -low_power ${LOW_POWER:-true} -look_ahead_depth $lad -extbrc 1 \
  -b_strategy 1 -adaptive_i 1 -adaptive_b 1 -bf 7 -refs 5 -g 256 -strict -1 \
  -vsync passthrough -y $output

# CBR (encoding from YUV with ffmpeg-qsv)
ffmpeg -init_hw_device vaapi=va:${DEVICE:-/dev/dri/renderD128} -init_hw_device qsv=hw@va -an \
  -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate -i $inputyuv \
  -frames:v $numframes -c:v h264_qsv -preset $preset -profile:v high -async_depth 1 \
  -b:v $bitrate -maxrate $bitrate -minrate $bitrate -bitrate_limit 0 -bufsize $((2 * bitrate)) \
  -rc_init_occupancy $bitrate -low_power ${LOW_POWER:-true} -look_ahead_depth $lad -extbrc 1 \
  -b_strategy 1 -adaptive_i 1 -adaptive_b 1 -bf 7 -refs 5 -g 256 -strict -1 \
  -vsync passthrough -y $output

# VBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -extra_hw_frames $lad -an -i $input \
  -frames:v $numframes -c:v h264_qsv -preset $preset -profile:v high -async_depth 1 \
  -b:v $bitrate -maxrate $((2 * bitrate)) -bitrate_limit 0 -bufsize $((4 * bitrate)) \
  -rc_init_occupancy $((2 * bitrate)) -low_power ${LOW_POWER:-true} -look_ahead_depth $lad -extbrc 1 \
  -b_strategy 1 -adaptive_i 1 -adaptive_b 1 -bf 7 -refs 5 -g 256 -strict -1 \
  -vsync passthrough -y $output

# CBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -extra_hw_frames $lad -an -i $input \
  -frames:v $numframes -c:v h264_qsv -preset $preset -profile:v high -async_depth 1 \
  -b:v $bitrate -maxrate $bitrate -minrate $bitrate -bitrate_limit 0 -bufsize $((2 * bitrate)) \
  -rc_init_occupancy $bitrate -low_power ${LOW_POWER:-true} -look_ahead_depth $lad -extbrc 1 \
  -b_strategy 1 -adaptive_i 1 -adaptive_b 1 -bf 7 -refs 5 -g 256 -strict -1 \
  -vsync passthrough -y $output

# VBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 \
  -device ${DEVICE:-/dev/dri/renderD128} -u $preset -b $bitrateKb -vbr -n $numframes \
  -w $width -h $height -override_encoder_framerate $framerate -lowpower:${LOWPOWER:-on} -lad $lad \
  -extbrc::implicit -AdaptiveI:on -AdaptiveB:on -dist 8 -num_ref 5 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 2)) \
  -InitialDelayInKB $((bitrateKb / 4)) -MaxKbps $((bitrateKb * 2)) -o::h264 $output

# CBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 \
  -device ${DEVICE:-/dev/dri/renderD128} -u $preset -b $bitrateKb -cbr -n $numframes \
  -w $width -h $height  -override_encoder_framerate $framerate -lowpower:${LOWPOWER:-on} -lad $lad \
  -extbrc::implicit -AdaptiveI:on -AdaptiveB:on -dist 8 -num_ref 5 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 4)) \
  -InitialDelayInKB $((bitrateKb / 8)) -o::h264 $output

# VBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async 1 \
  -device ${DEVICE:-/dev/dri/renderD128} -u $preset -b $bitrateKb -vbr -n $numframes \
  -lowpower:${LOWPOWER:-on} -lad $lad -extbrc::implicit -AdaptiveI:on -AdaptiveB:on -dist 8 -num_ref 5 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 2)) \
  -InitialDelayInKB $((bitrateKb / 4)) -MaxKbps $((bitrateKb * 2)) -o::h264 $output

# CBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async 1 \
  -device ${DEVICE:-/dev/dri/renderD128} -u $preset -b $bitrateKb -cbr -n $numframes \
  -lowpower:${LOWPOWER:-on} -lad $lad -extbrc::implicit -AdaptiveI:on -AdaptiveB:on -dist 8 -num_ref 5 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 4)) \
  -InitialDelayInKB $((bitrateKb / 8)) -o::h264 $output

To achieve better quality with Intel GPU H.264/AVC encoder running ExtBRC we recommend the following settings:

ffmpeg-qsv options ffmpeg version Comments
VBR
-b:v $bitrate -maxrate $((2 * bitrate)) n2.8 maxrate > bitrate triggers VBR. You can vary maxrate per your needs.
-bufsize $((4 * bitrate)) n4.0 You can vary bufsize per your needs. We recommend to avoid going below 1 second to avoid quality loss. Buffer size of 4 seconds is recommended for VBR.
-rc_init_occupancy $((2 * bitrate)) n2.8 This is the initial buffer delay. You can vary this per your needs. Recommendation is to use 1/2 of bufsize.
CBR
-b:v $bitrate -minrate $bitrate -maxrate $bitrate n2.8 This triggers CBR.
-bufsize $((2 * bitrate)) n4.0 You can vary bufsize per your needs. We recommend to avoid going below 1 second to avoid quality loss. Buffer size of 2 seconds is recommended for CBR.
-rc_init_occupancy $bitrate n2.8 This is ithe initial buffer delay. You can vary this per your needs. Recommendation is to use 1/2 of bufsize.
CBR & VBR common settings
-bitrate_limit 0 n3.0 This disables target bitrate limitations that exist in MediaSDK/VPL for AVC encoding
-extbrc 1   This enabled ExtBRC Software BRC
-b_strategy 1 -bf 7 n3.0 These 2 settings activate full 3 level B-Pyramid.
-refs 5 n2.7 5 references are important to trigger Long Term Reference (LTR) coding feature.
-g 256 n2.7 Select long enough GOP size for random access encoding. You can vary this setting. Typically 2 to 4 seconds GOP is used.

Example command lines:

# VBR (encoding from YUV with ffmpeg-qsv)
ffmpeg -init_hw_device vaapi=va:${DEVICE:-/dev/dri/renderD128} -init_hw_device qsv=hw@va -an \
  -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate \
  -i $inputyuv -frames:v $numframes -c:v h264_qsv -preset $preset -profile:v high -async_depth 1 \
  -b:v $bitrate -maxrate $((2 * bitrate)) -bitrate_limit 0 -bufsize $((4 * bitrate)) \
  -rc_init_occupancy $((2 * bitrate)) -low_power ${LOW_POWER:-false} -extbrc 1 -b_strategy 1 -bf 7 -refs 5 -g 256 \
  -vsync passthrough -y $output

# CBR (encoding from YUV with ffmpeg-qsv)
ffmpeg -init_hw_device vaapi=va:${DEVICE:-/dev/dri/renderD128} -init_hw_device qsv=hw@va -an \
  -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate \
  -i $inputyuv -vframes $numframes -c:v h264_qsv -preset $preset -profile:v high \
  -b:v $bitrate -maxrate $bitrate -minrate $bitrate -bitrate_limit 0 -bufsize $((2 * bitrate)) \
  -rc_init_occupancy $bitrate -low_power ${LOW_POWER:-false} -extbrc 1 -b_strategy 1 -bf 7 -refs 5 -g 256 \
  -vsync passthrough -y $output

# VBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
  -frames:v $numframes -c:v h264_qsv -preset h264_qsv -profile:v high -async_depth 1 \
  -b:v $bitrate -maxrate $((2 * bitrate)) -bitrate_limit 0 -bufsize $((4 * bitrate)) \
  -rc_init_occupancy $((2 * bitrate)) -low_power ${LOW_POWER:-false} -extbrc 1 -b_strategy 1 -bf 7 -refs 5 -g 256 \
  -vsync passthrough -y $output

# CBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
  -frames:v $numframes -c:v h264_qsv -preset h264_qsv -profile:v high -async_depth 1 \
  -b:v $bitrate -maxrate $bitrate -minrate $bitrate -bitrate_limit 0 -bufsize $((2 * bitrate)) \
  -rc_init_occupancy $bitrate -low_power ${LOW_POWER:-false} -extbrc 1 -b_strategy 1 -bf 7 -refs 5 -g 256 \
  -vsync passthrough -y $output

# VBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -vbr -n $numframes -w $width -h $height -override_encoder_framerate $framerate \
  -lowpower:${LOWPOWER:-off} -extbrc::implicit -ExtBrcAdaptiveLTR:on -dist 8 -num_ref 5 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 2)) \
  -InitialDelayInKB $((bitrateKb / 4)) -MaxKbps $((bitrateKb * 2)) -o::h264 $output

# CBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -cbr -n $numframes -w $width -h $height -override_encoder_framerate $framerate \
  -lowpower:${LOWPOWER:-off} -extbrc::implicit -ExtBrcAdaptiveLTR:on -dist 8 -num_ref 5 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 4)) \
  -InitialDelayInKB $((bitrateKb / 8)) -o::h264 $output

# VBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -vbr -n $numframes -lowpower:${LOWPOWER:-off} \
  -extbrc::implicit -ExtBrcAdaptiveLTR:on -dist 8 -num_ref 5 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -MemType::system -hrd $((bitrateKb / 2)) \
  -InitialDelayInKB $((bitrateKb / 4)) -MaxKbps $((bitrateKb * 2)) -o::h264 $output

# CBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -cbr -n $numframes -lowpower:${LOWPOWER:-off} \
  -extbrc::implicit -ExtBrcAdaptiveLTR:on -dist 8 -num_ref 5 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -MemType::system -hrd $((bitrateKb / 4)) \
  -InitialDelayInKB $((bitrateKb / 8)) -o::h264 $output

To achieve better quality with Intel GPU H.265/HEVC encoder running EncTools BRC we recommend the following settings:

ffmpeg-qsv options ffmpeg version Comments
VBR
-b:v $bitrate -maxrate $((2 * bitrate)) n2.8 maxrate > bitrate triggers VBR. You can vary maxrate per your needs.
-bufsize $((4 * bitrate)) n4.0 You can vary bufsize per your needs. We recommend to avoid going below 1 second to avoid quality loss. Buffer size of 4 seconds is recommended for VBR.
-rc_init_occupancy $((2 * bitrate)) n2.8 This is the initial buffer delay. You can vary this per your needs. Recommendation is to use 1/2 of bufsize.
CBR
-b:v $bitrate -minrate $bitrate -maxrate $bitrate n2.8 This triggers CBR.
-bufsize $((2 * bitrate)) n4.0 You can vary bufsize per your needs. We recommend to avoid going below 1 second to avoid quality loss. Buffer size of 2 seconds is recommended for CBR.
-rc_init_occupancy $bitrate n2.8 This is the initial buffer delay. You can vary this per your needs. Recommendation is to use 1/2 of bufsize.
CBR & VBR common settings
-extbrc 1 -look_ahead_depth $lad n5.0 This enables EncTools Software BRC when look ahead depth > than 0. Need to have look ahead depth > than miniGOP size to enable low power look ahead too (miniGOP size is equal to bf+1). The recommended values for $lad are: 8 (for performance boost) and 40 (for quality boost)
-b_strategy 1 -bf 7 master These 2 settings activate full 3 level B-Pyramid.
-refs 4 n2.8 4 reference are recommended for high quality HEVC encoding.
-g 256 n2.8 Select long enough GOP size for random access encoding. You can vary this setting. Typically 2 to 4 seconds GOP is used.
-strict -1 n5.0 Disables HRD compliance.
-idr_interval begin_only n4.0 Only first I-frame will be IDR, other I-frames will be CRA.
-extra_hw_frames $lad n4.0 Add extra GPU decoder frame surfaces. This is currently needed for transcoding with look ahead (set this option to look ahead depth value)

Example command lines:

# VBR (encoding from YUV with ffmpeg-qsv)
ffmpeg -init_hw_device vaapi=va:${DEVICE:-/dev/dri/renderD128} -init_hw_device qsv=hw@va -an \
  -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate -i $inputyuv \
  -frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth 1
  -b:v $bitrate -maxrate $((2 * bitrate)) -bufsize $((4 * bitrate)) \
  -rc_init_occupancy $((2 * bitrate)) -low_power ${LOW_POWER:-true} -look_ahead_depth $lad -extbrc 1 -b_strategy 1 \
  -bf 7 -refs 4 -g 256 -idr_interval begin_only -strict -1 \
  -vsync passthrough -y $output

# CBR (encoding from YUV with ffmpeg-qsv)
ffmpeg -init_hw_device vaapi=va:${DEVICE:-/dev/dri/renderD128} -init_hw_device qsv=hw@va -an \
  -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate -i $inputyuv \
  -frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth 1
  -b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((2 * bitrate)) \
  -rc_init_occupancy $bitrate -low_power ${LOW_POWER:-true} -look_ahead_depth $lad -extbrc 1 -b_strategy 1 \
  -bf 7 -refs 4 -g 256 -idr_interval begin_only -strict -1 \
  -vsync passthrough -y $output

# VBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -extra_hw_frames $lad -an -i $input \
  -frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth 1 \
  -b:v $bitrate -maxrate $((2 * bitrate)) -bufsize $((4 * bitrate)) \
  -rc_init_occupancy $((2 * bitrate)) -low_power ${LOW_POWER:-true} -look_ahead_depth $lad -extbrc 1 -b_strategy 1 \
  -bf 7 -refs 4 -g 256 -idr_interval begin_only -strict -1 \
  -vsync passthrough -y $output

# CBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -extra_hw_frames $lad -an -i $input \
  -frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth 1 \
  -b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((2 * bitrate)) \
  -rc_init_occupancy $bitrate -low_power ${LOW_POWER:-true} -look_ahead_depth $lad -extbrc 1 -b_strategy 1 \
  -bf 7 -refs 4 -g 256 -idr_interval begin_only -strict -1 \
  -vsync passthrough -y $output

# VBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -vbr -n $numframes -w $width -h $height -override_encoder_framerate $framerate \
  -lowpower:${LOWPOWER:-on} -lad $lad -extbrc::implicit -AdaptiveI:on -AdaptiveB:on -dist 8 -num_ref 4 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 2)) \
  -InitialDelayInKB $((bitrateKb / 4)) -MaxKbps $((bitrateKb * 2)) -o::h264 $output

# CBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -cbr -n $numframes -w $width -h $height -override_encoder_framerate $framerate \
  -lowpower:${LOWPOWER:-on} -lad $lad -extbrc::implicit -AdaptiveI:on -AdaptiveB:on -dist 8 -num_ref 4 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 4)) \
  -InitialDelayInKB $((bitrateKb / 8)) -o::h265 $output

# VBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -vbr -n $numframes -lowpower:${LOWPOWER:-on} \
  -lad $lad -extbrc::implicit -AdaptiveI:on -AdaptiveB:on -dist 8 -num_ref 4 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 2)) \
  -InitialDelayInKB $((bitrateKb / 4)) -MaxKbps $((bitrateKb * 2)) -o::h265 $output

# CBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -cbr -n $numframes -lowpower:${LOWPOWER:-on} \
  -lad $lad -extbrc::implicit -AdaptiveI:on -AdaptiveB:on -dist 8 -num_ref 4 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 4)) \
  -InitialDelayInKB $((bitrateKb / 8)) -o::h265 $output

To achieve better quality with Intel GPU H.265/HEVC encoder running ExtBRC we recommend the following settings:

ffmpeg-qsv options ffmpeg version Comments
VBR
-b:v $bitrate -maxrate $((2 * bitrate)) n2.8 maxrate > bitrate triggers VBR. You can vary maxrate per your needs.
-bufsize $((4 * bitrate)) n4.0 You can vary bufsize per your needs. We recommend to avoid going below 1 second to avoid quality loss. Buffer size of 4 seconds is recommended for VBR.
-rc_init_occupancy $((2 * bitrate)) n2.8 This is the initial buffer delay. You can vary this per your needs. Recommendation is to use 1/2 of bufsize.
CBR
-b:v $bitrate -minrate $bitrate -maxrate $bitrate n2.8 This triggers CBR.
-bufsize $((2 * bitrate)) n4.0 You can vary bufsize per your needs. We recommend to avoid going below 1 second to avoid quality loss. Buffer size of 2 seconds is recommended for CBR.
-rc_init_occupancy $bitrate n2.8 This is the initial buffer delay. You can vary this per your needs. Recommendation is to use 1/2 of bufsize.
CBR & VBR common settings
-extbrc 1 n4.3 This enabled ExtBRC Software BRC
-bf 7 n2.8 B-Pyramid is ON by default (to be explicit, add -b_strategy 1, but the setting is supported in ffmpeg master for HEVC). -bf 7 enables full 3 level B-Pyramid.
-refs 4 n2.8 4 reference are recommended for high quality HEVC encoding.
-g 256 n2.7 Select long enough GOP size for random access encoding. You can vary this setting. Typically 2 to 4 seconds GOP is used.

Example command lines:

# VBR (encoding from YUV with ffmpeg-qsv)
ffmpeg -init_hw_device vaapi=va:${DEVICE:-/dev/dri/renderD128} -init_hw_device qsv=hw@va -an \
  -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate -i $inputyuv \
  -frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth 1 \
  -b:v $bitrate -maxrate $((2 * bitrate)) -bufsize $((4 * bitrate)) \
  -rc_init_occupancy $((2 * bitrate)) -low_power ${LOW_POWER:-false} -extbrc 1 -bf 7 -refs 4 -g 256 \
  -vsync passthrough -y $output

# CBR (encoding from YUV with ffmpeg-qsv)
ffmpeg -init_hw_device vaapi=va:${DEVICE:-/dev/dri/renderD128} -init_hw_device qsv=hw@va -an \
  -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate -i $inputyuv \
  -frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth 1 \
  -b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((2 * bitrate)) \
  -rc_init_occupancy $bitrate -low_power ${LOW_POWER:-false} -extbrc 1 -bf 7 -refs 4 -g 256 \
  -vsync passthrough -y $output

# VBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
  -frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth 1 \
  -b:v $bitrate -maxrate $((2 * bitrate)) -bufsize $((4 * bitrate)) \
  -rc_init_occupancy $((2 * bitrate)) -low_power ${LOW_POWER:-false} -extbrc 1 -bf 7 -refs 4 -g 256 \
  -vsync passthrough -y $output

# CBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
  -frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth 1 \
  -b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((2 * bitrate)) \
  -rc_init_occupancy $bitrate -low_power ${LOW_POWER:-false} -extbrc 1 -bf 7 -refs 4 -g 256 \
  -vsync passthrough -y $output

# VBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -vbr -n $numframes -w $width -h $height -override_encoder_framerate $framerate \
  -lowpower:${LOWPOWER:-off} -extbrc::implicit -dist 8 -num_ref 4 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 2)) \
  -InitialDelayInKB $((bitrateKb / 4)) -MaxKbps $((bitrateKb * 2)) -o::h265 $output

# CBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -cbr -n $numframes -w $width -h $height -override_encoder_framerate $framerate \
  -lowpower:${LOWPOWER:-off} -extbrc::implicit -dist 8 -num_ref 4 -gop_size 256 \
  -NalHrdConformance:off -VuiNalHrdParameters:off -hrd $((bitrateKb / 4)) \
  -InitialDelayInKB $((bitrateKb / 8)) -o::h265 $output

# VBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -vbr -n $numframes -lowpower:${LOWPOWER:-off} \
  -extbrc::implicit -dist 8 -num_ref 4 -gop_size 256 -NalHrdConformance:off -VuiNalHrdParameters:off \
  -hrd $((bitrateKb / 2)) -InitialDelayInKB $((bitrateKb / 4)) -MaxKbps $((bitrateKb * 2)) \
  -o::h265 $output

# CBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -cbr -n $numframes -lowpower:${LOWPOWER:-off} \
  -extbrc::implicit -dist 8 -num_ref 4 -gop_size 256 -NalHrdConformance:off -VuiNalHrdParameters:off \
  -hrd $((bitrateKb / 4)) -InitialDelayInKB $((bitrateKb / 8)) \
  -o::h265 $output

To achieve better quality with Intel GPU AV1 encoder running Hardware BRC we recommend the following settings:

ffmpeg-qsv options ffmpeg version Comments
VBR
-b:v $bitrate -maxrate $((2 * bitrate)) patched maxrate > bitrate triggers VBR. You can vary maxrate per your needs.
-bufsize $((4 * bitrate)) patched You can vary bufsize per your needs. We recommend to avoid going below 1 second to avoid quality loss. Buffer size of 4 seconds is recommended for VBR.
-rc_init_occupancy $((2 * bitrate)) patched This is initial buffer delay. You can vary this per your needs. Recommendation is to use 1/2 of bufsize.
CBR
-b:v $bitrate -minrate $bitrate -maxrate $bitrate patched This triggers CBR.
-bufsize $((2 * bitrate)) patched You can vary bufsize per your needs. We recommend to avoid going below 1 second to avoid quality loss. Buffer size of 2 seconds is recommended for VBR.
-rc_init_occupancy $bitrate patched This is initial buffer delay. You can vary this per your needs. Recommendation is to use 1/2 of bufsize.
CBR & VBR common settings
-b_strategy 1 -bf 7 patched These 2 settings activate full 3 level B-Pyramid.
-g 256 patched Select long enough GOP size for random access encoding. You can vary this setting. Typically 2 to 4 seconds GOP is used.

Example command lines:

# VBR (encoding from YUV with ffmpeg-qsv)
ffmpeg -init_hw_device vaapi=va:${DEVICE:-/dev/dri/renderD128} -init_hw_device qsv=hw@va -an \
  -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate -i $inputyuv \
  -frames:v $numframes -c:v av1_qsv -preset $preset -profile:v main -async_depth 1 \
  -b:v $bitrate -maxrate $((2 * bitrate)) -bufsize $((4 * bitrate)) \
  -rc_init_occupancy $((2 * bitrate)) -b_strategy 1 -bf 7 -g 256 \
  -vsync passthrough -y $output

# CBR (encoding from YUV with ffmpeg-qsv)
ffmpeg -init_hw_device vaapi=va:${DEVICE:-/dev/dri/renderD128} -init_hw_device qsv=hw@va -an \
  -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate -i $inputyuv \
  -frames:v $numframes -c:v av1_qsv -preset $preset -profile:v main -async_depth 1 \
  -b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((2 * bitrate)) \
  -rc_init_occupancy $bitrate -b_strategy 1 -bf 7 -g 256 \
  -vsync passthrough -y $output

# VBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
  -frames:v $numframes -c:v av1_qsv -preset $preset -profile:v main -async_depth 1 \
  -b:v $bitrate -maxrate $((2 * bitrate)) -bufsize $((4 * bitrate)) \
  -rc_init_occupancy $((2 * bitrate)) -b_strategy 1 -bf 7 -g 256 \
  -vsync passthrough -y $output

# CBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
  -frames:v $numframes -c:v av1_qsv -preset $preset -profile:v main -async_depth 1 \
  -b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((2 * bitrate)) \
  -rc_init_occupancy $bitrate -b_strategy 1 -bf 7 -g 256 \
  -vsync passthrough -y $output

# VBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -vbr -n $numframes -w $width -h $height -override_encoder_framerate $framerate \
  -bref -dist 8 -gop_size 256 -hrd $((bitrateKb / 2)) -InitialDelayInKB $((bitrateKb / 4)) \
  -MaxKbps $((bitrateKb * 2)) -o::av1 $output

# CBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
  -u $preset -b $bitrateKb -cbr -n $numframes -w $width -h $height -override_encoder_framerate $framerate \
  -bref -dist 8 -gop_size 256 -hrd $((bitrateKb / 4)) -InitialDelayInKB $((bitrateKb / 8)) \
  -o::av1 $output

# VBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::$inputcodec $input -hw -async 1 \
  -device ${DEVICE:-/dev/dri/renderD128} -u $preset -b $bitrateKb \
  -vbr -n $numframes -bref -dist 8 -gop_size 256 -dist 8 -hrd $((bitrateKb / 2)) \
  -InitialDelayInKB $((bitrateKb / 4)) -MaxKbps $((bitrateKb * 2)) -o::av1 $output

# CBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::$inputcodec $input -hw -async 1 \
  -device ${DEVICE:-/dev/dri/renderD128} -u $preset -b $bitrateKb \
  -cbr -n $numframes -bref -dist 8 -gop_size 256 -hrd $((bitrateKb / 4)) \
  -InitialDelayInKB $((bitrateKb / 8)) -o::av1 $output

For assessing the quality of Intel's H.264 Advanced Video Coding (AVC) and H.265 High Efficiency Video Coding (HEVC) codecs we are using ffmpeg-x264 and ffmpeg-x265 as reference codecs in medium preset for the BD-rate measure. For assessing the quality of Intel's AV1 codec we are using ffmpeg-x264 as a reference codec in medium preset for its BD-rate measure. The reference codecs use 12 threads and -tune psnr option.

# VBR (encoding from YUV)
ffmpeg -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate \
  -i $inputyuv -vframes $numframes -y \
  -c:v libx264 -preset medium -profile:v high \
  -b:v $bitrate -bufsize $((2 * bitrate)) -maxrate $((2 * bitrate)) \
  -tune psnr -threads 12 -vsync passthrough $output

# CBR (encoding from YUV)
ffmpeg -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate \
  -i $inputyuv -vframes $numframes -y \
  -c:v libx264 -preset medium -profile:v high \
  -b:v $bitrate -x264opts no-sliced-threads:nal-hrd=cbr \
  -tune psnr -threads 12 -vsync passthrough $output
# VBR (encoding from YUV)
ffmpeg -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate \
  -i $inputyuv -vframes $numframes -y \
  -c:v libx265 -preset medium \
  -b:v $bitrate -maxrate $((2 * bitrate)) -bufsize $((2 * bitrate)) \
  -tune psnr -threads 12 -vsync passthrough $output

# CBR (encoding from YUV)
ffmpeg -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate \
  -i $inputyuv -vframes $numframes -y \
  -c:v libx265 -preset medium \
  -b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((2 * bitrate)) \
  -tune psnr -threads 12 -vsync passthrough $output