Video for Linux 2 (V4L2 API)
An input type that allows Smelter to capture video using the Video for Linux 2 API. V4L2 devices can be found in paths that look like this:
/dev/video[N], whereNis the device number,/dev/v4l/by-id/[DEVICE ID],/dev/v4l/by-path/[PCI/USB PATH].
Usage
To use the V4L2 Input you must register it first. You can do it by sending a request like this:
Example request
POST: /api/input/:input_id/registerContent-Type: application/json
{ "type": "v4l2", "path": "/dev/video0", "format": "yuyv", "resolution": { "width": 1920, "height": 1080, }, "framerate": 30,}See HTTP Routes documentation to learn more about managing inputs.
Reference
Type definition
type RegisterV4l2Input = { type: "v4l2"; path: string; format: "yuyv" | "nv12"; resolution: { width: u32; height: u32; }; framerate: u32 | string; required?: bool;};Parameters for registering a V4L2 device as an input.
Properties
path
Path to the V4L2 device.
- Type:
string
format
A format used for video capture.
- Type:
"yuyv" | "nv12" - Supported values:
yuyv- YUYV, which is a form of interleaved 4:2:2 YUV.nv12- NV12, which is a form of planar 4:2:0 YUV, with one plane for Y and a second plane for interleaved UV.
resolution
The capture resolution. This value may be changed by the device driver to the closest resolution supported at the selected format.
- Type:
{ width: u32; height: u32; }
framerate
Video framerate. This value may be changed by the device driver to the closest framerate supported at the
selected format and resolution. Has to be either a u32 or a string in the "NUM/DEN" form, representing a
fraction.
- Type:
u32 | string
required
Determines if the input stream is essential for output frame production. If set to true and the stream is delayed, Smelter will postpone output frames until the stream is received.
- Type:
bool - Default value:
false