Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nateraw/encoded-video
Utilities for working with videos
https://github.com/nateraw/encoded-video
numpy pyav serialization video-processing
Last synced: 28 days ago
JSON representation
Utilities for working with videos
- Host: GitHub
- URL: https://github.com/nateraw/encoded-video
- Owner: nateraw
- Created: 2021-10-28T00:49:00.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-28T17:21:50.000Z (about 3 years ago)
- Last Synced: 2024-10-02T05:01:28.677Z (about 1 month ago)
- Topics: numpy, pyav, serialization, video-processing
- Language: Python
- Homepage:
- Size: 1.69 MB
- Stars: 13
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# encoded-video
Utilities for serializing/deserializing videos w/ `pyav` and `numpy`.
## Purpose
1. Have a helpful API for working with videos
2. Liberate myself from relying on `torch` or `tensorflow` to do the above
3. Serialize/deserialize videos without writing directly to file (helpful for sending/recieving videos over APIs)## Acknowledgments
This is more or less a `torch`-less version of `EncodedVideo` from [`pytorchvideo`](https://github.com/facebookresearch/pytorchvideo).
## Setup
```
pip install encoded-video
```## Usage
```python
import numpy as np
from encoded_video import bytes_to_video, read_video, video_to_bytesvid = read_video('archery.mp4')
video_arr = vid['video'] # (T, H, W, C)
audio_arr = vid['audio'] # (S,)out_bytes = video_to_bytes(
video_arr,
fps=30,
audio_array=np.expand_dims(audio_arr, 0),
audio_fps=vid['audio_fps'],
audio_codec='aac'
)restored_video = bytes_to_video(out_bytes)
```