A buffered and threaded wrapper for the OpenCV VideoCapture object. Can speed up video decoding significantly. Supports "with"-syntax.
Go to file
Askill abcfb75f72 added packaging information 2021-10-30 15:16:35 +02:00
tests added packaging information 2021-10-30 15:16:35 +02:00
.gitignore added packaging information 2021-10-30 15:16:35 +02:00
README.rst added packaging information 2021-10-30 15:16:35 +02:00
VERSION added packaging information 2021-10-30 15:16:35 +02:00
__init__.py added packaging information 2021-10-30 15:16:35 +02:00
requirements.txt added packaging information 2021-10-30 15:16:35 +02:00
setup.py added packaging information 2021-10-30 15:16:35 +02:00

README.rst

# 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)