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.1.tar.gz (49.8 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.1-py3-none-any.whl (49.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: videodev2-0.0.1.tar.gz
  • Upload date:
  • Size: 49.8 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.1.tar.gz
Algorithm Hash digest
SHA256 95936f08be768e7ef9557f4c99e015b2731d9807fc73ca98bb777e092dd12e34
MD5 fe75f0207ca036c163d88a395f138b25
BLAKE2b-256 eddf16335a79f95a415eb11c34072b81f95bdc65fc188dfece412cfe1941e710

See more details on using hashes here.

File details

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

File metadata

  • Download URL: videodev2-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 49.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bb72aa520726e6469a6860df8f9653e9c64814f9380f8e02ab71b5f1ba76e84d
MD5 96831763a465603950ed12be1d47e5ec
BLAKE2b-256 23e5eebd14f4aa6fb7e7e20c488f81b46b794bf69f32d28e0d66645e9ed9639e

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