Metadata-Version: 2.4
Name: pyvideotools
Version: 0.1.0
Summary: Video metric and encoding tools
Home-page: https://github.com/Noam-Hache/pyvideotools
Author: Noam Hache
Author-email: Noam Hache <noam.hache@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/Noam-Hache/pyvideotools
Project-URL: Issues, https://github.com/Noam-Hache/pyvideotools/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: setuptools>=84.0.0
Requires-Dist: vsjetpack[source]>=2.2.4
Dynamic: author
Dynamic: home-page
Dynamic: license-file

# pyvideotools : Quality Metrics & Video Encoding

WIP

Python utilities for video quality measurement and video encoding using VapourSynth.

Simple metric usage with statistics.
x264 and SVT-AV1 bindings.

## Features
- Quality metrics
    - SSIMULACRA2
    - XPSNR
    - Butteraugli
    - CVVDP
- CPU and GPU implementations
- x264 and SVT-AV1 encoding (WIP)

## Requirements

- Python
- [VapourSynth](https://www.vapoursynth.com/)
- [L-SMASH Works](https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works)
- [VS-ZIP](https://github.com/dnjulek/vapoursynth-zip) and/or [VSHIP](https://codeberg.org/Line-fr/Vship)
- [FFmpeg](https://ffmpeg.org/), [x264](https://www.videolan.org/developers/x264.html), [SVT-AV1](https://gitlab.com/AOMediaCodec/SVT-AV1), or [Turbo-Metrics](https://github.com/Gui-Yom/turbo-metrics) depending on the features used

## Examples
### Quality metrics examples

```python
from src.pyvideotools import metrics
from pathlib import Path

metric = metrics.VSzipSSIMULACRA2(
    source=Path("source.mkv"),
    distorted=Path("encoded.mkv"),
    skip=3,
)

metric.run()

print(metric.scores_standard_deviation)
print(metric.scores_median)
```

### Encoding examples

SVT-AV1 CRF Encoding
```python
from src.pyvideotools import encoders

cmd = encoders.SVTAV1CommandBuilder()
cmd.input("input.mkv")
cmd.preset("4")
cmd.crf(30)
cmd.output("output.mkv", overwrite=True)
cmd.run()
```

x264 2-pass target bitrate
```python
from src.pyvideotools import encoders

cmd = encoders.x264CommandBuilder()
cmd.input("input.mkv")
cmd.preset("faster")
cmd.bitrate(682)
cmd.passes(2)
cmd.output("output.mkv", overwrite=True)
cmd.run()
```


## Supported Implementations

| Metric      | CPU                    | GPU   |
| ----------- | ---------------------- | ----- |
| SSIMULACRA2 | VS-ZIP / Turbo-Metrics | VSHIP |
| XPSNR       | VS-ZIP / FFmpeg        | -     |
| Butteraugli | -                      | VSHIP |
| CVVDP       | -                      | VSHIP |
