Skip to content

🎥 Video API

linuxpy.video.device

Human friendly interface to V4L2 (Video 4 Linux 2) subsystem.

V4L2Error

Bases: Exception

Video for linux 2 error

Controls(device: Device)

Bases: dict

from_device(device) classmethod

InfoEx(device: Device)

Bases: DeviceHelper

video_standards: list[Standard] property

List of video standards for the active input

Frame(data: bytes, buff: raw.v4l2_buffer, format: Format)

The resulting object from an acquisition.

EventReader(device: Device, max_queue_size=100)

aread() async

Wait for next event or return last event in queue

FrameReader(device: Device, raw_read: Callable[[], Buffer], max_queue_size: int = 1)

aread() -> Frame async

Wait for next frame or return last frame

create_buffers(fd, format: raw.v4l2_format, memory: Memory, count: int) -> raw.v4l2_create_buffers

Create buffers for Memory Mapped or User Pointer or DMA Buffer I/O

convert_to_ctypes_array(lst, depth, ctype)

Convert a list (arbitrary depth) to a ctypes array.

request_and_query_buffer(fd, buffer_type: BufferType, memory: Memory) -> raw.v4l2_buffer

request + query buffers

request_and_query_buffers(fd, buffer_type: BufferType, memory: Memory, count: int) -> list[raw.v4l2_buffer]

request + query buffers

create_mmap_buffers(fd, buffer_type: BufferType, memory: Memory, count: int) -> list[mmap.mmap]

create buffers + mmap_from_buffer

iter_video_files(path: PathLike = '/dev') -> Iterable[Path]

Returns an iterator over all video files

iter_devices(path: PathLike = '/dev', **kwargs) -> Iterable[Device]

Returns an iterator over all video devices

iter_video_capture_files(path: PathLike = '/dev') -> Iterable[Path]

Returns an iterator over all video files that have CAPTURE capability

iter_video_capture_devices(path: PathLike = '/dev', **kwargs) -> Iterable[Device]

Returns an iterator over all video devices that have CAPTURE capability

iter_video_output_files(path: PathLike = '/dev') -> Iterable[Path]

Some drivers (ex: v4l2loopback) don't report being output capable so that apps like zoom recognize them as valid capture devices so some results might be missing

iter_video_output_devices(path: PathLike = '/dev', **kwargs) -> Iterable[Device]

Returns an iterator over all video devices that have VIDEO OUTPUT capability