diff --git a/.gitignore b/.gitignore index 7f12269..7086f56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ # Project Specific Ignores /weights -*.mp4 -/test/data/*.avi - +.DS_Store # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/README.md b/README.md index e69de29..3b69e14 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,52 @@ +# Video Upscaler + +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + + +## Description +Quick project I hope to work on to help me upscale old home video footage from camcorders, etc. + + +## Features +- Upscales video using [Real-ESRGAN](https://github.com/sberbank-ai/Real-ESRGAN). Currently tested on Apple Silicon GPU (working, sort of) + +## Installation + +To install this project using Poetry, follow these steps: + +1. Make sure you have Poetry installed. If not, you can install it by following the instructions [here](https://python-poetry.org/docs/#installation). +2. Clone the repository: `git clone https://github.com/nostoslabs/video_upscaler.git` +3. Navigate to the project directory: `cd video_upscaler` +4. Install the project dependencies: `poetry install` +5. Activate the virtual environment: `poetry shell` + +You have now successfully installed the project using Poetry. + + + +## Usage +```bash +poetry run upscale video.mp4 video_HD.mp4 +``` + +## Contributing + +Contributions are welcome! Follow these steps to contribute to the project: + +1. Fork the repository. +2. Create a new branch for your feature or bug fix. +3. Make your changes and commit them. +4. Push your changes to your forked repository. +5. Open a pull request to the main repository. + +Please ensure that your code follows the project's coding conventions and style guidelines. + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +## Contact +Contact me via an issue. + +## Acknowledgements +This is just a wrapper of the excellent pyAV and https://github.com/sberbank-ai/Real-ESRGAN models. diff --git a/poetry.lock b/poetry.lock index 3807e33..16815cc 100644 --- a/poetry.lock +++ b/poetry.lock @@ -175,6 +175,20 @@ files = [ {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] +[[package]] +name = "exceptiongroup" +version = "1.2.0" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, + {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, +] + +[package.extras] +test = ["pytest (>=6)"] + [[package]] name = "filelock" version = "3.13.1" @@ -191,6 +205,22 @@ docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1 testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)"] typing = ["typing-extensions (>=4.8)"] +[[package]] +name = "flake8" +version = "7.0.0" +description = "the modular source code checker: pep8 pyflakes and co" +optional = false +python-versions = ">=3.8.1" +files = [ + {file = "flake8-7.0.0-py2.py3-none-any.whl", hash = "sha256:a6dfbb75e03252917f2473ea9653f7cd799c3064e54d4c8140044c5c065f53c3"}, + {file = "flake8-7.0.0.tar.gz", hash = "sha256:33f96621059e65eec474169085dc92bf26e7b2d47366b70be2f67ab80dc25132"}, +] + +[package.dependencies] +mccabe = ">=0.7.0,<0.8.0" +pycodestyle = ">=2.11.0,<2.12.0" +pyflakes = ">=3.2.0,<3.3.0" + [[package]] name = "fsspec" version = "2023.12.2" @@ -269,6 +299,17 @@ files = [ {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, ] +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + [[package]] name = "jinja2" version = "3.1.3" @@ -355,6 +396,17 @@ files = [ {file = "MarkupSafe-2.1.3.tar.gz", hash = "sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad"}, ] +[[package]] +name = "mccabe" +version = "0.7.0" +description = "McCabe checker, plugin for flake8" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, +] + [[package]] name = "mpmath" version = "1.3.0" @@ -696,6 +748,65 @@ tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "pa typing = ["typing-extensions"] xmp = ["defusedxml"] +[[package]] +name = "pluggy" +version = "1.3.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, + {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pycodestyle" +version = "2.11.1" +description = "Python style guide checker" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pycodestyle-2.11.1-py2.py3-none-any.whl", hash = "sha256:44fe31000b2d866f2e41841b18528a505fbd7fef9017b04eff4e2648a0fadc67"}, + {file = "pycodestyle-2.11.1.tar.gz", hash = "sha256:41ba0e7afc9752dfb53ced5489e89f8186be00e599e712660695b7a75ff2663f"}, +] + +[[package]] +name = "pyflakes" +version = "3.2.0" +description = "passive checker of Python programs" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"}, + {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, +] + +[[package]] +name = "pytest" +version = "7.4.4" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + [[package]] name = "pyyaml" version = "6.0.1" @@ -814,6 +925,17 @@ files = [ [package.dependencies] mpmath = ">=0.19" +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + [[package]] name = "torch" version = "2.1.2" @@ -1012,4 +1134,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "246fc6420a8fad62b0df9b320d11b0885e4f1109aaaa3fe591bccd744c950e2a" +content-hash = "fc966464d3ffb01227a2e78352820e32055828c4b685e01e199bb663b4f0a1ba" diff --git a/pyproject.toml b/pyproject.toml index 6129f24..9ecdef2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,10 @@ torchaudio = "^2.1.2" [tool.poetry.scripts] upscale = "video_upscaler.main:main" +[tool.poetry.group.dev.dependencies] +pytest = "^7.4.4" +flake8 = "^7.0.0" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" diff --git a/tests/data/heidi.mp4 b/tests/data/heidi.mp4 new file mode 100644 index 0000000..7e88555 Binary files /dev/null and b/tests/data/heidi.mp4 differ diff --git a/tests/test_video_upscale.py b/tests/test_video_upscale.py new file mode 100644 index 0000000..b699c1c --- /dev/null +++ b/tests/test_video_upscale.py @@ -0,0 +1,10 @@ +import pytest +from pathlib import Path +from video_upscaler.main import upscale_video + +def test_upscale(): + input_video = 'tests/data/heidi.mp4' + expected_output = 'tests/data/heidi_HD.mp4' + upscale_video(input_video, expected_output) + assert Path(expected_output).exists() +