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.
- 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", 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]} >>> compare(None, "media/video/intro.webm", uvq=True) {'uvq': [2.8496, 2.8577, 2.9328, 3.3655, 3.8789, 3.4904, 3.1649, 3.1805, 3.1579, 3.2773]} >>>