semvec/pypi-packages huggingface dataset:
videodev2 0.0.4
Python ctypes bindings for Video4Linux2 (V4L2) API
License: BSD-3-Clause
Requires Python: >=3.6
Keywords: v4l2 video4linux2 linux video capture ctypes

# 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

```bash
pip install videodev2
```

## Usage

```python
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.