cutcutcodec.core.analysis.video.metrics.video_metrics

cutcutcodec.core.analysis.video.metrics.video_metrics(dis: Path | str | bytes, ref: Path | str | bytes | None = None, **metrics) dict[str, list[float]][source]

Simultaneously calculate multiple video metrics, comparative and no-reference.

Parameters

dispathlike

The distorted video file.

refpathlike, optional

The reference video file, used for comparative metrics only.

lpips_alexboolean, default=False

Trigger the spacial comparative quality LPIPS metric with medium alex network. Call cutcutcodec.core.analysis.video.quality.lpips() on every frame.

lpips_vggboolean, default=False

Trigger the spacial comparative quality LPIPS metric with big vgg network. Call cutcutcodec.core.analysis.video.quality.lpips() on every frame.

psnrboolean, default=False

Trigger the spacial comparative quality PSNR metric. Call cutcutcodec.core.analysis.video.quality.psnr() on every frame.

rms_sobelboolean, default=False

Trigger the spacial root mean square sobel gradient complexity. Call cutcutcodec.core.analysis.video.complexity.rms_sobel() on every frame.

rms_time_diffboolean, default=False

Trigger the temporal root mean square time difference complexity. Call cutcutcodec.core.analysis.video.complexity.rms_time_diff() on every frame.

ssimboolean, default=False

Trigger the spacial comparative quality SSIM metric. Call cutcutcodec.core.analysis.video.quality.ssim() on every frame.

uvqboolean, default=False

Trigger the spacial and temporal no-reference quality UVQ metric. Call cutcutcodec.core.analysis.video.quality.uvq().

vmafboolean, default=False

Trigger the spacial comparative quality VMAF metric. Call cutcutcodec.core.analysis.video.quality.vmaf.vmaf() on every frame.

Returns

metricsdict[str, list[float]]

Associate the corresponding scalar values with each metric.

Notes

The color space of the distorted video is converted to the same as the reference video.

Examples

>>> import pprint
>>> from cutcutcodec.core.analysis.video.metrics import video_metrics
>>> from cutcutcodec.utils import get_project_root
>>> video = get_project_root() / "media" / "video" / "intro.webm"
>>> res = video_metrics(video, video, psnr=True, ssim=True, rms_sobel=True)
>>> pprint.pprint(res)  
{'psnr': [100.0,
          100.0,
          ...,
          100.0,
          100.0],
 'rms_sobel': [0.0036468505859375,
               0.0036468505859375,
               ...,
               0.0033111572265625,
               0.000560760498046875],
 'ssim': [1.0,
          1.0,
          ...,
          1.0,
          1.0]}
>>>

SeeAlso