Skip to main content

Python ctypes bindings for Video4Linux2 (V4L2) API

Project description

videodev2

Python ctypes bindings for Video4Linux2 (V4L2) API

Overview

This package provides Python ctypes bindings for the Linux Video4Linux2 (V4L2) API, automatically generated from the videodev2.h header file. It includes all V4L2 structures, enums, constants, and IOCTL definitions needed for video device programming.

Installation

pip install videodev2

Usage

import videodev2

# Access V4L2 symbols through the videodev2 module
from videodev2 import videodev2

# Example: Query device capabilities
import fcntl

# Open video device
fd = open('/dev/video0', 'rb+', buffering=0)

# Query capabilities
cap = videodev2.v4l2_capability()
fcntl.ioctl(fd, videodev2.VIDIOC_QUERYCAP, cap)
print(f"Driver: {cap.driver.decode()}")
print(f"Card: {cap.card.decode()}")

# Set format
fmt = videodev2.v4l2_format()
fmt.type = videodev2.V4L2_BUF_TYPE_VIDEO_CAPTURE
fmt.fmt.pix.width = 640
fmt.fmt.pix.height = 480
fmt.fmt.pix.pixelformat = videodev2.v4l2_fourcc('Y', 'U', 'Y', 'V')
fcntl.ioctl(fd, videodev2.VIDIOC_S_FMT, fmt)

Features

  • Complete V4L2 API coverage
  • All structures, enums, and constants
  • IOCTL definitions
  • Helper functions (e.g., v4l2_fourcc)
  • Compatible with Python 3.6+

License

This project is licensed under the BSD 3-Clause License.

Project details


Download files

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

Source Distribution

videodev2-0.0.3.tar.gz (50.0 kB view details)

Uploaded Source

Built Distribution

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

videodev2-0.0.3-py3-none-any.whl (49.8 kB view details)

Uploaded Python 3

File details

Details for the file videodev2-0.0.3.tar.gz.

File metadata

  • Download URL: videodev2-0.0.3.tar.gz
  • Upload date:
  • Size: 50.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for videodev2-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b62161078b74c92d5b186bb9ce52a86651e04480628d85e81856190fcb40efe2
MD5 7ae380fead6166f6522dafa6e399bd3b
BLAKE2b-256 1293d13060686265ddc5df27b8fd885825b402eb7faa8447e79e985e33c5118f

See more details on using hashes here.

File details

Details for the file videodev2-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: videodev2-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 49.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for videodev2-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4dada320cbb4e633094549d08a764e33c7bcd23b25f32fb07b7b82c91408d6ee
MD5 60d1189d974a56fc909473d1533eb172
BLAKE2b-256 9ec029d358987bf6023514a70de26f2afa840d5322788c568a8ea883b91a93cb

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