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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file videodev2-0.0.4.tar.gz.
File metadata
- Download URL: videodev2-0.0.4.tar.gz
- Upload date:
- Size: 50.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c34ba70491d148c23a08cbacd8efabeb413cff5baa943a7548ac4abd1eb19e2a
|
|
| MD5 |
9c06068136b083a7d67427e683eb0452
|
|
| BLAKE2b-256 |
7c82ffdba8838b1f24b83268863a8f66fe9334d7f28a5b9c368f9c48f7516e69
|
File details
Details for the file videodev2-0.0.4-py3-none-any.whl.
File metadata
- Download URL: videodev2-0.0.4-py3-none-any.whl
- Upload date:
- Size: 49.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d35f7ab39ddb06d50fec96a99bfc8d5b8b525bc7ea03788259d386393f1a64ba
|
|
| MD5 |
45b0fb376bb277ae1bbe797ee6bc932d
|
|
| BLAKE2b-256 |
68304982441a03860ab8f656702d8a2c13d0cf6f56d65bfb78fe288028dcb473
|