Metadata-Version: 2.1
Name: videoio
Version: 0.1.1
Summary: Module for saving and loading images and depth as H.264 video
Home-page: https://github.com/vguzov/videoio
Author: Vladimir Guzov
Author-email: guzov.mail@gmail.com
License: UNKNOWN
Keywords: mp4,png,h264,video,image,depth,ffmpeg
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: ffmpeg-python

# videoio: save/load image sequence as H.264 video
A small Python module for saving and loading RGB and uint16 (depth) frames as H.264 encoded video

## Quickstart
##### Save/load RGB frames:
```python
import numpy as np
from videoio import videosave, videoread
frames = np.random.random((20,200,400,3)) #[framesNr, height, width, RGB]
# Save to video
videosave("out.mp4", frames)
# Load from video
frames = videoread("out.mp4")
```

##### Read frames sequentially:
```python
from videoio import VideoReader
for frame in VideoReader("in.mp4"):
    do_something_with(frame)
```

##### Write frames sequentially:
```python
from videoio import VideoWriter
writer = VideoWriter("out.mp4", resolution=(400, 200)) #[width, height]
for i in range(100):
    frame = get_frame()
    writer.write(frame)
writer.close()
```
or
```python
with VideoWriter("out.mp4", resolution=(400, 200)) as writer:
    for i in range(100):
        frame = get_frame()
        writer.write(frame)
```

##### Lossless write/read of uint16 3D arrays (useful for saving depth frames stored in mm, for example Kinect data):
```python
import numpy as np
from videoio import uint16save, uint16read
# Generate 20 random depth frames
depth_frames = (np.random.random((20,200,400))*65535).astype(np.uint16)
# Save
uint16save("out_depth.mp4", depth_frames)
# Load
depth_frames = uint16read("out_depth.mp4")
```

##### Save RGB frames in lossless mode with different compression preset and different FPS:
```python
videosave("out.mp4", frames, lossless=True, preset="veryfast", fps=10.5)
```

##### Read RGB frames and scale them to target resolution simultaneously:
```python
frames = videoread("in.mp4", output_resolution=(100, 250))
```

## Prerequisites
- `ffmpeg` with libx264 enabled and `ffprobe` (usually comes with ffmpeg)
- `numpy`
- `ffmpeg-python`

## Installation
From pip:
```
pip install videoio
```

From source:
```
git clone https://github.com/vguzov/videoio.git
python setup.py install
```


