CRF vs CBR vs QP Dataset

Compare the CRF, CBR and QP modes.

The parameters of this database

Name

Value

Description (link)

Total

effort

fast, medium

enc_effort

\(2\)

encoder

libsvtav1, libx264, libx265

enc_encoder

\(2\)

host

paradoxe-26

env_hostname

\(1\)

metrics

psnr, ssim

Table t_met_metric

mode

crf, cbr, qp

enc_mode

\(3\)

profile

sd, fhd

video resolution and more

\(2\)

quality

\(\left\{\frac{k}{17} \mid k \in [1,16] \right\}\)

enc_quality

\(16\)

repeat

\(5\) times

total repetitions

\(5\)

video

baolei_balloon, park_joy

ctc

\(2\)

total

\(\prod\)

total number of points

\(5760\)

Download

mendevi download crf_vs_cbr_vs_qp.db.xz.torrent

Plots

Effect of mode on energy

The graph below shows the energy impact of the QP for a comparable bitrate.

mendevi plot crf_vs_cbr_vs_qp.db -x bitrate -y energy -wx profile -wy encoder -c mode -m effort -e quality -f 'ref_stem=="park_joy"'
Effect of mode on energy at constant bitrate

The graph below shows the energy impact of the QP for a comparable quality.

mendevi plot crf_vs_cbr_vs_qp.db -x psnr -y energy -wx profile -wy encoder -c mode -m effort -e quality -f 'ref_stem=="park_joy"' -t t_enc_encode
Effect of mode on energy at constant quality

Conclusion

On this machine and in this video, the encoder, the profile and the force have a much greater impact on the encoding energy than the mode. The difference between qp and crf modes is imperceptible.

The cbr mode appears to be more efficient than the others for the libsvtav1 encoder.

Reproduce

Version 4.2.0 of libsvtav1 does not support optimisation on ssim and the random/access prediction on cbr mode. Although mendevi enables these default settings for the qp and crf modes, they need to be always disabled here to ensure a fair comparison between the different modes of libsvtav1. In order to optimise PSNR and predict with low delay, you have to create the file callback.py with the following content:

import re

from mendevi.cmd import CmdFFMPEG

def libsvtav1_lowdelay_psnr(cmd: CmdFFMPEG, **kwargs) -> CmdFFMPEG:
    """Set tune=1 and pred-struct=1 to the svtav1 parameters."""
    if kwargs["encoder"] != "libsvtav1":
        return cmd
    encode = cmd.encode
    try:
        idx = encode.index("-svtav1-params") + 1
    except ValueError:
        encode.append("-svtav1-params")
        idx = len(encode)
        encode.append("")
    encode[idx] = (
        re.sub(r"tune=\d", r"tune=1", encode[idx])
        if "tune=" in encode[idx]
        else f"{encode[idx]}:tune=1"
    )
    encode[idx] = (
        re.sub(r"pred-struct=\d", r"pred-struct=1", encode[idx])
        if "pred-struct=" in encode[idx]
        else f"{encode[idx]}:pred-struct=1"
    )
    cmd.encode = encode
    return cmd
for video in baolei_balloon.mkv park_joy.mkv; do
    mendevi prepare $video -p sd
    mendevi prepare $video -p fhd
done

mendevi encode -m crf -m cbr -m qp -r 5 -c libsvtav1 -c libx264 -c libx265 -e fast -e medium --callback callback.py reference*
mendevi decode sample*

mendevi probe reference* sample*