AMD Re-introduces the B-frame!

We all know how import the B-frame can be for video encoding. At the launch of RDNA2 AMD promised to add it back into their Hardware Encoders for H.264, and finally on March 17th they did just that! The question is, will it actually make a difference?

For years AMD has struggled behind Intel and Nvidia with their hardware based video encoders on their graphic cards. We saw previously that AMD hasn’t been able to keep up with the newer H.265 encodings. However nobody streams on the web with H.265 as nothing supports it. It’s great for video backup or recording your desktop locally, but no streaming service handles it, because most browsers do not support H.265 video playback.

That leaves H.264 until we have AV1 hardware encoders. So does the almighty b-frame make a difference?

The B-frame difference

I am happy to report that with a quick test, that yes, the B-frame is back and does help!

This graph was generated using FFMetrics v1.0, and shows a small section of the encoding of Big Buck Bunny at 5000 kbps. We are using variable bitrate based encoding as hardware encoders are designed with streaming in mind, and they usually requires a set bitrate. 5000 kbps is right in the range Twitch suggests for 1080p.

The blue line is the encoding without B-frames, and the orange line is with B-frames. We are looking at a frame by frame score, with the frame number as the x-axis is on bottom and VMAF is the Y-AXIS.

Graph captured from FFmetrics v1.0
X-AXIS Frame Number | Y-AXIS VMAF Score

We can see that there are several places that greatly benefit by saving bitrate with B-frames (the places the b-frame orange line is far above the blue line.) Notice how jagged the line with B-frames is as well. Because of how b-frames operate, they have quality drops compared to the frames around them, however because they are so small, they allow the P and I frames to be much higher initial quality.

Overall the first 2 minutes of Big Buck Bunny encoded from raw Y4M video to H.264 had almost two full point increases on PSNR from 41.694 to 43.326 (out of a possible max of 48). It also had a over a full point increase in VMAF from 94.12 to 95.39 (out of a possible max of 100).

Is AMD better than everyone else finally?

AMD might not be smoking everyone else, but they are a solid contender!

This same video scored a VMAF of 96.13 with Nvidia’s NVENC and the high score of 96.37 to Intel’s QSV. AMD is now less than a VMAF point behind. Whereas previously they were over two full points behind without B-frames.

Here we can see AMD is the red is still a bit below its competitors, with Intel in the blue and Nvidia in the orange.

Graph captured from FFmetrics v1.0
X-AXIS Frame Number | Y-AXIS VMAF Score

All hardware encoders still fall short of a proper two-pass software encode with x264 using veryslow preset, which scored 97.33, but that is not a comparable use case. That is simply the ceiling of what’s possible.

Also be aware that not everything is going to instantly support this feature. You’ll have to keep an eye on your favorite streaming software release notes and see if they add it in.

Wrap Up

Sorry I don’t have time for a deeper dive with a lot more comparisons. However Big Buck Bunny is a solid test for B-frames, and I am confident there will be similar behavior across other media that benefits from b-frames. Expect a quality increase, but not to be quite at the same level as the competitors.

These tests were done on two very different systems, so not providing encoding speeds. However they were all using latest drivers available as of 2022-07-01 and latest version of rigaya’s hardware encoding software.

Commands run:

# AMD 6900XT
VCEEncC64.exe -i big_buck_bunny_1080p24.y4m --trim 0:2880 --video-metadata clear --metadata clear --chapter-copy -c avc --vbr 5000 --bframes 3 --ref 3 --b-pyramid --preset slow --level auto --motion-est q-pel --pe --colorrange tv --avsync cfr -o big_buck_bunny_1080p-vce-5000-bp.mp4

# Intel i7-12700H
QSVEncC64.exe -i big_buck_bunny_1080p24.y4m --trim 0:2880 --video-metadata clear --metadata clear --chapter-copy -c h264 --vbr 5000 --bframes 3 --ref 3  --quality best --output-depth 8 --level auto --colorrange tv --avsync cfr  -o big_buck_bunny_1080-qsv-5000.mp4

# NVIDIA GeForce RTX 3060 Laptop
NVEncC64.exe -i big_buck_bunny_1080p24.y4m --trim 0:2880 --video-metadata clear --metadata clear --chapter-copy -c avc --vbr 5000 --bframes 3 --ref 3 --bref-mode disabled --preset quality --aq --aq-strength 0 --level auto --multipass 2pass-full --mv-precision Q-pel --colorrange tv --avsync cfr -o big_buck_bunny_1080-nvnec-5000.mp4

# Also tried with bref-mode each and middle for NVENC. Middle had a slight bump to VMAF 96.17, but wasn't worth re-generating the charts.