Reads a video into a buffer in an extra thread with some nice syntax.
Project description
# CV2 Threaded Video Capture
Not much to say here, it enables you to read an entire video or a number of frames from a video in an extra thread with some nice syntax.
This project was initially part of my video synopsis project, wich is why the config dict() is required.
### Full video
from VideoReader import VideoReader import os
fileName = “out.mp4” dirName = os.path.join(os.path.dirname(__file__), “generate test footage”)
config = {} config[“inputPath”] = os.path.join(dirName, fileName) config[“videoBufferLength”] = 100
- with VideoReader(config) as reader:
- while not reader.videoEnded():
framenumber, frame = reader.pop() print(framenumber)
### Selection of Frames
from VideoReader import VideoReader import os
fileName = “out.mp4” dirName = os.path.join(os.path.dirname(__file__), “generate test footage”)
config = {} config[“inputPath”] = os.path.join(dirName, fileName) config[“videoBufferLength”] = 100
frameList = list(range(100, 500))
- with VideoReader(config, frameList) as reader:
- while not reader.videoEnded():
framenumber, frame = reader.pop() print(framenumber)
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
Hashes for CV2-Threaded-Video-Capture-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a5cbe20410788a676d9e5636478ca7ce7d2668dcb6d77252c3eab3deee4d844 |
|
MD5 | bc8ec8d6d6310f8a6da690e5ffc13577 |
|
BLAKE2b-256 | 311fa2c5b2379695d1b4667f1912f64ba361f7b858e2c4e32d5e5df9c9b54379 |