Skip to main content

High-performance video capture library using FFmpeg

Project description

degirum_video_capture - DeGirum video reading and decoding library

This package is intended to replace OpenCV's cv2.VideoCapture() class for the purposes of video reading and decoding in performance-based pipelines. The goals of this project are to:

  1. Provide more frames per second than cv2.VideoCapture.read()
  2. Provide utility by allowing the user to enable select filters when reading a video
  3. Remaining compatible with in-process opencv-python by avoiding ffmpeg libaray symbol conflict

License

MIT License

External Licenses

Installation

pip install degirum-video-capture

Documentation

Class VideoCapture

Note: VideoCapture can be used as a context manager

def __init__( [source], [filter args] )

ARGS

  • optional (string) source: source to read from. Acceptable values: filepath, rtsp stream, usb camera
  • optional filter args:
    • (int) width: Width to which the output frame will be resized and padded to. Aspect ratio will be maintained.
    • (int) height: Height to which the output frame will be resized and padded to. Aspect ratio will be maintained.

RETURNS

  • VideoCapture object

def open( source, [filter args] )

ARGS

  • (string) source: same as source in __init__
  • optional filter args: same as filter args in __init__

Note: open() does not need to be explicitly called if source was provided in __init__.

RETURNS

  • True if source opened successfully. False otherwise.

def read()

RETURNS

  • tuple: (success: bool, frame: np.ndarray or None)
    • success: True if a frame was read, False otherwise.
    • frame: numpy array (height, width, 3) in BGR format or None

def isOpened()

RETURNS

  • True if source is opened, False otherwise.

def close()

Closes source

def get( prop_id )

ARGS

  • (int) prop_id: Property identifier (use CAP_PROP_* constants)

RETURNS

  • float: Property value, or -1 if not supported/available

CAP_PROP_*:

0 = CAP_PROP_POS_MSEC
1 = CAP_PROP_POS_FRAMES
2 = CAP_PROP_POS_AVI_RATIO
3 = CAP_PROP_FRAME_WIDTH
4 = CAP_PROP_FRAME_HEIGHT
5 = CAP_PROP_FPS
6 = CAP_PROP_FOURCC
7 = CAP_PROP_FRAME_COUNT

Example Usage

No resizing, explicit open + checks

import degirum_video_capture as dvc

cap = dvc.VideoCapture()
cap.open("example.mp4")

if cap.isOpened():
    while True:
        ret, frame = capture.read()
        if not ret:
            break
        # Do something with the frame
        foo_bar(frame)

    cap.close()

Resizing + letterboxing, implicit open and no checks, used as context manager

import degirum_video_capture as dvc

with dvc.VideoCapture("example.mp4", 640, 640) as capture:
    while True:
        ret, frame = capture.read()
        if not ret:
            break
        # Do something with the frame
        foo_bar(frame)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

degirum_video_capture-0.1.1-cp313-cp313-manylinux_2_35_x86_64.whl (45.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.35+ x86-64

degirum_video_capture-0.1.1-cp313-cp313-manylinux_2_35_aarch64.whl (44.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.35+ ARM64

degirum_video_capture-0.1.1-cp312-cp312-manylinux_2_35_x86_64.whl (45.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ x86-64

degirum_video_capture-0.1.1-cp312-cp312-manylinux_2_35_aarch64.whl (44.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ ARM64

degirum_video_capture-0.1.1-cp311-cp311-manylinux_2_35_x86_64.whl (45.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ x86-64

degirum_video_capture-0.1.1-cp311-cp311-manylinux_2_35_aarch64.whl (44.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ ARM64

degirum_video_capture-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl (45.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

degirum_video_capture-0.1.1-cp310-cp310-manylinux_2_35_aarch64.whl (44.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ ARM64

degirum_video_capture-0.1.1-cp39-cp39-manylinux_2_35_x86_64.whl (45.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.35+ x86-64

degirum_video_capture-0.1.1-cp39-cp39-manylinux_2_35_aarch64.whl (44.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.35+ ARM64

File details

Details for the file degirum_video_capture-0.1.1-cp313-cp313-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for degirum_video_capture-0.1.1-cp313-cp313-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 c57ac0aae7af61fa4c3d448bcbe2820f58e350c46144daca0862613777b28417
MD5 0abf3cf6ebc07b54622947d52eb2dcb0
BLAKE2b-256 1e02246b2eaf4654242c3a0fc6d667afd284d2a1bbb88ad145777e904a28209f

See more details on using hashes here.

File details

Details for the file degirum_video_capture-0.1.1-cp313-cp313-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for degirum_video_capture-0.1.1-cp313-cp313-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 ac71cb216279e2635c7ccd610d6fcf8b8c227466501844e1f71d5415bd72f5e8
MD5 413cdb0cf0400f8ee6adf7fb5ce3e593
BLAKE2b-256 de0370a6ec58ec9bc0d99460353caed257ef916012c16de3cd7be8f48aafd1ea

See more details on using hashes here.

File details

Details for the file degirum_video_capture-0.1.1-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for degirum_video_capture-0.1.1-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 7aed84d3a9bb90a630b95e87fb2b3ce42bcf1a25a2a0e33b2e5c431cbc342c44
MD5 3ac5337fe848adf534010d0e63d74398
BLAKE2b-256 42f46477c310019abe649906eda18207fff09d541bdc6b4091522b6ef66318cc

See more details on using hashes here.

File details

Details for the file degirum_video_capture-0.1.1-cp312-cp312-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for degirum_video_capture-0.1.1-cp312-cp312-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 9d32cff9b4f560c7ccb207d56c7d2fca202b1a45c381465fe9e57804fa1c5572
MD5 22f7f401a100bfb33916b2e8a42096a6
BLAKE2b-256 ff1a38d7cbe34fd72579d66044f278a23d484927bf2aff37894b01d4b87bfa79

See more details on using hashes here.

File details

Details for the file degirum_video_capture-0.1.1-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for degirum_video_capture-0.1.1-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 3ca174ccd0b8337c748a90599069d7998debf4490ebb227c550385a8ba5bc4f1
MD5 b1ddaeded31ed5f78fef1abfc892a7b2
BLAKE2b-256 8daab995cd9a8a695bc7cae3a67749d80e70ef642fb90f143fe230220544e4a8

See more details on using hashes here.

File details

Details for the file degirum_video_capture-0.1.1-cp311-cp311-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for degirum_video_capture-0.1.1-cp311-cp311-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 43ada7350db36bfd5b4935ef374dc1baf1861cf31331298621df26c6c6cf7e04
MD5 ebc11022673ec55e938b39c4b139c771
BLAKE2b-256 c0f820f2acf2c50c6aaa5e6333becdedb2b5cbeff40144feffa9826c719d5799

See more details on using hashes here.

File details

Details for the file degirum_video_capture-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for degirum_video_capture-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 94236e34c6aaf8acbd68247fdab2afba0d1adaf3448eac4df69499c6899e5b1a
MD5 dabaecc47ffed45a8a78b1467aa2f7bf
BLAKE2b-256 e8dac5135eb8a28bba7e2986ba2488e40966ddcd6bf85d353ff33e777e545f3c

See more details on using hashes here.

File details

Details for the file degirum_video_capture-0.1.1-cp310-cp310-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for degirum_video_capture-0.1.1-cp310-cp310-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 9105f2b64f0951fe325a819dc7257174276da376cc5a91a1ab3835ab28268d81
MD5 4c38c5bc850cb88b3e4c2fd5b4b85ec3
BLAKE2b-256 67c716b14bcdedf318000d80be38ab832098bebb4684fb75d12a47c10ebf023b

See more details on using hashes here.

File details

Details for the file degirum_video_capture-0.1.1-cp39-cp39-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for degirum_video_capture-0.1.1-cp39-cp39-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 2fafb9c190b9bd7a235465d789a2606a5d6ce83a01f7aa323be155d5f746a6f3
MD5 5fd0456446074278bcffe36fb1b69e1e
BLAKE2b-256 fad8a1588a7d1b831631b385d3c3828a0515c31138e357d045fb9ab68aa73d9f

See more details on using hashes here.

File details

Details for the file degirum_video_capture-0.1.1-cp39-cp39-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for degirum_video_capture-0.1.1-cp39-cp39-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 8f7691e5ffc18c0502906b3da4e28a6b64c2ea70f5361cae158920c955ee3666
MD5 fe12283c8ee9cde45127e1bccdbf9909
BLAKE2b-256 9132da339c129b8ef40803d973459a9078522f9785fab19eb168379019898b14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page