# 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/raspberrypi/py-videodev2",
"name": "videodev2",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "v4l2 video4linux2 linux video capture ctypes",
"author": "Raspberry Pi",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/7c/82/ffdba8838b1f24b83268863a8f66fe9334d7f28a5b9c368f9c48f7516e69/videodev2-0.0.4.tar.gz",
"platform": null,
"description": "# videodev2\n\nPython ctypes bindings for Video4Linux2 (V4L2) API\n\n## Overview\n\nThis 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.\n\n## Installation\n\n```bash\npip install videodev2\n```\n\n## Usage\n\n```python\nimport videodev2\n\n# Access V4L2 symbols through the videodev2 module\nfrom videodev2 import videodev2\n\n# Example: Query device capabilities\nimport fcntl\n\n# Open video device\nfd = open('/dev/video0', 'rb+', buffering=0)\n\n# Query capabilities\ncap = videodev2.v4l2_capability()\nfcntl.ioctl(fd, videodev2.VIDIOC_QUERYCAP, cap)\nprint(f\"Driver: {cap.driver.decode()}\")\nprint(f\"Card: {cap.card.decode()}\")\n\n# Set format\nfmt = videodev2.v4l2_format()\nfmt.type = videodev2.V4L2_BUF_TYPE_VIDEO_CAPTURE\nfmt.fmt.pix.width = 640\nfmt.fmt.pix.height = 480\nfmt.fmt.pix.pixelformat = videodev2.v4l2_fourcc('Y', 'U', 'Y', 'V')\nfcntl.ioctl(fd, videodev2.VIDIOC_S_FMT, fmt)\n```\n\n## Features\n\n- Complete V4L2 API coverage\n- All structures, enums, and constants\n- IOCTL definitions\n- Helper functions (e.g., `v4l2_fourcc`)\n- Compatible with Python 3.6+\n\n## License\n\nThis project is licensed under the BSD 3-Clause License.\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Python ctypes bindings for Video4Linux2 (V4L2) API",
"version": "0.0.4",
"project_urls": {
"Bug Reports": "https://github.com/raspberrypi/py-videodev2/issues",
"Homepage": "https://github.com/raspberrypi/py-videodev2",
"Source": "https://github.com/raspberrypi/py-videodev2"
},
"split_keywords": [
"v4l2",
"video4linux2",
"linux",
"video",
"capture",
"ctypes"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "68304982441a03860ab8f656702d8a2c13d0cf6f56d65bfb78fe288028dcb473",
"md5": "45b0fb376bb277ae1bbe797ee6bc932d",
"sha256": "d35f7ab39ddb06d50fec96a99bfc8d5b8b525bc7ea03788259d386393f1a64ba"
},
"downloads": -1,
"filename": "videodev2-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "45b0fb376bb277ae1bbe797ee6bc932d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 49923,
"upload_time": "2025-07-23T10:18:50",
"upload_time_iso_8601": "2025-07-23T10:18:50.378149Z",
"url": "https://files.pythonhosted.org/packages/68/30/4982441a03860ab8f656702d8a2c13d0cf6f56d65bfb78fe288028dcb473/videodev2-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7c82ffdba8838b1f24b83268863a8f66fe9334d7f28a5b9c368f9c48f7516e69",
"md5": "9c06068136b083a7d67427e683eb0452",
"sha256": "c34ba70491d148c23a08cbacd8efabeb413cff5baa943a7548ac4abd1eb19e2a"
},
"downloads": -1,
"filename": "videodev2-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "9c06068136b083a7d67427e683eb0452",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 50108,
"upload_time": "2025-07-23T10:18:51",
"upload_time_iso_8601": "2025-07-23T10:18:51.631561Z",
"url": "https://files.pythonhosted.org/packages/7c/82/ffdba8838b1f24b83268863a8f66fe9334d7f28a5b9c368f9c48f7516e69/videodev2-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-23 10:18:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "raspberrypi",
"github_project": "py-videodev2",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "videodev2"
}