cutcutcodec.core.analysis.video.quality.compare
- cutcutcodec.core.analysis.video.quality.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. If you want to compute this metric only, give
Noneto ref.- 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.quality import compare >>> from cutcutcodec.utils import get_project_root >>> video = get_project_root() / "media" / "video" / "intro.webm" >>> res = compare(video, video, psnr=True, ssim=True) >>> pprint.pprint(res) {'psnr': [100.0, 100.0, ..., 100.0, 100.0], 'ssim': [1.0, 1.0, ..., 1.0, 1.0]} >>>