cutcutcodec.core.analysis.video.metric.compare
- cutcutcodec.core.analysis.video.metric.compare(ref: Path | str | bytes, dis: Path | str | bytes, **kwargs) dict[str, list[float]][source]
Compare 2 video files with differents metrics.
Parameters
- refpathlike
The reference video file.
- dispathlike
The distorted video.
- lpips_alexboolean, default=False
If True, compute the lpips with alex (medium).
- lpips_vggboolean, default=False
If True, compute the lpips with vgg (slow).
- psnrboolean, dafault=False
If True, compute the psnr (very fast).
- ssimboolean, default=False
If True, compute the ssim (slow).
- uvqboolean, default=False
If True, compute the uvq on the dis video (very slow). It returns only one value per second.
- vmafboolean, default=False
If True, compute the vmaf (medium).
Returns
- metricsdict[str, list[float]]
Each metric name is associated with the scalar value of each frame. All the numbers are rounded to 4 decimals number.
Notes
Frames are converted to yuv if not already converted, then the distorted video is converted to the color space of the reference video.
Examples
>>> import pprint >>> from cutcutcodec.core.analysis.video.metric import compare >>> res = compare( ... "media/video/intro.webm", "media/video/intro.webm", ... lpips_alex=True, psnr=True, ssim=True ... ) >>> pprint.pprint(res) {'lpips_alex': [0.0, 0.0, ..., 0.0, 0.0], 'psnr': [100.0, 100.0, ..., 100.0, 100.0], 'ssim': [1.0, 1.0, ..., 1.0, 1.0]} >>> compare(None, "media/video/intro.webm", uvq=True) {'uvq': [2.9175, 2.8559, 2.7784, 3.1725, 3.5817, 3.7688, 3.0215, 2.944, 2.697, 3.4718]} >>>