A modular video processing pipeline
pip install git+https://github.com/centralelyon/ntt.git@main
To develop "ntt" library, make an editable install
inside a Python virtual environment using pip -e
editable flag.
- create a virtual environment and activate it
- clone this ntt repository
- install ntt and its "dev" dependencies
pip install -e ".[dev]"
In case of important changes (e.g repository structure), you may have to install the library again.
Assuming you have cloned the repository or installed the source package, you
can run tests with pytest
:
$ pytest tests
Look at the examples
folder to see how to use ntt functions.
Assuming you have a crop.mp4
video in a samples
folder and an output
folder, here is how to use extract_first_frame
function.
from ntt.frames.frame_extraction import extract_first_frame
if __name__ == "__main__":
extract_first_frame(
video_path_in="samples/",
video_name_in="crop.mp4",
frame_path_out="output/",
frame_name_out="crop-ex.jpg",
)
.
├── .circleci: configuration for CircleCI
│ ├── config.yml
│ └── ...
├── examples: simple examples on how to use ntt functions
│ ├── (files)
│ └── ...
├── samples: sample videos, images and data
│ ├── (files)
│ └── ...
├── src: the package source code
│ └── ntt: the main module
│ ├── README.md
│ ├── __init__.py
│ ├── frames: module for frame extraction
│ │ └── ...
│ ├── ...
│ └── ...
├── tests: pytest files
│ ├── (files)
│ └── ...
├── .gitignore
├── Dockerfile
├── README.md
├── pyproject.toml: ntt Python packaging file, contains ntt dependencies
├── requirements.txt
└──
Each module structure is as follows:
.
├── ...
├── ntt/
│ ├── __init__.py
│ ├── README.md
│ ├── name_of_the_module/
│ │ ├── __init__.py
│ │ ├── README.md
│ │ ├── name_of_the_function1.py
│ │ ├── name_of_the_function2.py
│ │ └── ...
│ ├── ...
│ └── ...
└── ...
The project is configured to run tests on CircleCI. The configuration file is
.circleci/config.yml
.
- build the image
docker build -t ntt .
$ docker build -t ntt .
- run the image
docker run --rm -v ${PWD}:/app ntt
(rm is to remove the container after it is stopped)
docker ps -a
(shows the list of containers)
- run a custom script
docker run --rm -v ${PWD}:/app ntt python ntt/frames/test/test_frame_extraction.py
- run the image
docker run -v "$(pwd)":/app ntt python ntt/frames/test/test_frame_extraction.py