Tools for reading and writing videos, and loading them efficiently with PyTorch.
Project description
Parallel Video IO
The Parallel Video IO (PVIO) package is motivated by the following problems that I kept having:
- I could never remember the
ffmpegandffprobcommands for simple tasks, so I have to Google them every time. - Precise random seek in videos (for scientific use) is not so trivial.
- I just want some simple dataloader that works for ML training and inference.
After finding myself writing the same thing over and over again for different projects, I wrote this package with the following features:
- Read frames from videos (random access, buffered sequential, or streamed one at a time) using imageio/FFmpeg.
- Write sequences of NumPy frames to H.264 MP4 files with sensible defaults.
- PyTorch-compatible
VideoCollectionDatasetandVideoCollectionDataLoaderthat stream frames from many videos in parallel across worker processes.SimpleVideoCollectionLoaderprovides a convenience API that combines dataset and dataloader creation in one call.
- A small
pviocommand-line tool (an ffmpeg-lite helper):pvio encodecombines a directory or list of image files into an H.264 MP4 (with--mode,--quality, and--presetflags), andpvio infoprints a video's frame count, frame size, and FPS.
GPU acceleration is automatic. On a machine with a CUDA GPU, decoding uses
the GPU (TorchCodec/NVDEC, with frame-accurate seeking preserved) and writing
uses the GPU encoder (FFmpeg/NVENC at a visually-lossless setting); both fall
back to the CPU when no GPU is available. SimpleVideoCollectionLoader runs in
the main process when decoding on the GPU (CUDA cannot be used in forked
workers). Pass device="cpu" (loader/EncodedVideo) or mode="cpu"
(write_frames_to_video) to opt out.
Linux only. macOS and Windows are not currently supported.
Installation, code examples, and documentation
Development
Clone and install with the dev dependencies:
git clone git@github.com:sibocw/parallel-video-io.git
cd parallel-video-io
uv sync --extra dev
Run the test suite:
pytest tests
Build and preview the documentation site locally:
uv run properdocs serve
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parallel_video_io-0.1.10a2.tar.gz.
File metadata
- Download URL: parallel_video_io-0.1.10a2.tar.gz
- Upload date:
- Size: 201.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36728e0d1610e77e7715d9cfca30344d100a9e7a994a578a53b2768f6873a56b
|
|
| MD5 |
19f027ba21c2f20956c07a45c4a03117
|
|
| BLAKE2b-256 |
6e10d48f01d463e205b7cc5ed3809b62a256722613ff5c2b3db9f088455b797b
|
Provenance
The following attestation bundles were made for parallel_video_io-0.1.10a2.tar.gz:
Publisher:
publish.yml on NeLy-EPFL/parallel-video-io
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parallel_video_io-0.1.10a2.tar.gz -
Subject digest:
36728e0d1610e77e7715d9cfca30344d100a9e7a994a578a53b2768f6873a56b - Sigstore transparency entry: 2058563803
- Sigstore integration time:
-
Permalink:
NeLy-EPFL/parallel-video-io@1a15657ebd32547cf5a90fa8116113a44e71f9ef -
Branch / Tag:
refs/tags/v0.1.10-alpha.2 - Owner: https://github.com/NeLy-EPFL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1a15657ebd32547cf5a90fa8116113a44e71f9ef -
Trigger Event:
release
-
Statement type:
File details
Details for the file parallel_video_io-0.1.10a2-py3-none-any.whl.
File metadata
- Download URL: parallel_video_io-0.1.10a2-py3-none-any.whl
- Upload date:
- Size: 35.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b511d25f4ad128c070c66c94f438d3363b9a388fa6a604a7747f442226567e8
|
|
| MD5 |
6ac6d00dcb04d409c3b88b5136c93ca9
|
|
| BLAKE2b-256 |
83b5d50c07b1b7db3429ede9ec34f6b50ca7fe18daa11d0cbbae38faab1548e8
|
Provenance
The following attestation bundles were made for parallel_video_io-0.1.10a2-py3-none-any.whl:
Publisher:
publish.yml on NeLy-EPFL/parallel-video-io
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parallel_video_io-0.1.10a2-py3-none-any.whl -
Subject digest:
5b511d25f4ad128c070c66c94f438d3363b9a388fa6a604a7747f442226567e8 - Sigstore transparency entry: 2058563946
- Sigstore integration time:
-
Permalink:
NeLy-EPFL/parallel-video-io@1a15657ebd32547cf5a90fa8116113a44e71f9ef -
Branch / Tag:
refs/tags/v0.1.10-alpha.2 - Owner: https://github.com/NeLy-EPFL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1a15657ebd32547cf5a90fa8116113a44e71f9ef -
Trigger Event:
release
-
Statement type: