CRF vs CBR vs QP Dataset¶
Compare the CRF, CBR and QP modes.
Name |
Value |
Description (link) |
Total |
|---|---|---|---|
effort |
|
\(2\) |
|
encoder |
|
\(2\) |
|
host |
|
\(1\) |
|
metrics |
|
||
mode |
|
\(3\) |
|
profile |
|
\(2\) |
|
quality |
\(\left\{\frac{k}{17} \mid k \in [1,16] \right\}\) |
\(16\) |
|
repeat |
\(5\) times |
total repetitions |
\(5\) |
video |
|
\(2\) |
|
total |
\(\prod\) |
total number of points |
\(5760\) |
Download¶
mendevi download crf_vs_cbr_vs_qp.db.xz.torrent
crf_vs_cbr_vs_qp.json.xz (914 Ko).
crf_vs_cbr_vs_qp.db.xz.torrent (593 Mo).
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"'
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
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*