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.2.tar.gz (49.9 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.2-py3-none-any.whl (49.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: videodev2-0.0.2.tar.gz
  • Upload date:
  • Size: 49.9 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.2.tar.gz
Algorithm Hash digest
SHA256 0babb283861511106b8217193fcea06298418ff6381baa69b2465f8a3622f7c6
MD5 cc8a079a400674fef5947e0554e8e669
BLAKE2b-256 8d3a9e4d64f980bb402427db75a8548ffe9a06a19375957d570d261f809bbf28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: videodev2-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 49.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c03242a9ed316ed798c2be96a1c0b353047664943067a58e442a81e7ebb8b529
MD5 e74ad0be31aba0347ec712cd251fc70b
BLAKE2b-256 9d6cf01a5a757dfbda41f070cb806ce9007e117d3630a2d32fce456bd154e4b0

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