Metadata-Version: 2.4
Name: enot-vp
Version: 1.2.0
Summary: ENOT video processor package for iterating over video frames easily.
Project-URL: Repository, https://github.com/Ruhrozz/enot-vp.git
Author-email: Malofeev Ivan <ruhrozz@bk.ru>
License-Expression: MIT
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Requires-Dist: av>=14.4.0
Requires-Dist: numpy>=1.21.0
Requires-Dist: opencv-python-headless>=4.13.0.92
Description-Content-Type: text/markdown

# ENOT Video Processor

Package for processing video with `pyav` package.
Provides methods for reading from video and writing modified video frames.

# Examples

## Reading Only

```python
from enot_vp import VideoProcessor
import numpy as np

with VideoProcessor(input_video=VIDEO_PATH) as vp:
    for frame in vp:
        print(vp.timestamp)
        print(np.mean(frame))
```

## Reading and Writing

```python
# TODO: does it work?
from enot_vp import VideoProcessor
from ultralytics import YOLO

model = YOLO(MODEL_PATH)

with VideoProcessor(input_video=VIDEO_PATH, output_video=OUTPUT_VIDEO_PATH) as vp:
    for frame in vp:
        ndarray = model(frame, imgsz=1600, verbose=False)[0].plot()[..., ::-1]
        vp.put(ndarray)
```

## Writing Only

```python
from enot_vp import VideoProcessor
import cv2, random, numpy as np

# `width`, `height` and `rate` are required arguments here
with VideoProcessor(output_video=OUTPUT_VIDEO_PATH, width=128, height=128, rate=30) as vp:
    for i in range(200):
        vp.put(cv2.circle(
            np.zeros((128,128,3), dtype=np.uint8), 
            (random.randint(20,108), random.randint(20,108)),
            random.randint(5,20),
            (255,255,255),
            -1,
        ))
```
