USB Camera Device Service
The USB Camera Device Service provides a means of integrating USB cameras with Edge Xpert.
Key Features
The USB Camera Device Service supports the following key features:
- Camera metadata
- Camera status
- Video stream reference
How Does the Device Service Work?
- The device service ONLY works on Linux with kernel v5.10 or higher.
- The device service uses V4L2 API to get camera metadata.
- The device service uses FFmpeg framework to capture video frames and stream them to an RTSP server.
- An RTSP server is embedded in the dockerized device service.
USB Camera Device Profile
The USB Camera Device Service uses a pre-defined device profile. This defines the commands that the device service can invoke on a USB camera.
Each device resource should have a mandatory attribute named command
. There are two types of command
:
- The commands started with METADATA_ prefix are used to get camera metadata.
- The commands start with VIDEO_ prefix are related to video stream.
USB Camera Command | Description |
---|---|
METADATA_DEVICE_CAPABILITY | Camera information including driver name, device name, bus info, and capabilities. For further information, refer to the Linux Media Infrastructure userspace API document. |
METADATA_CURRENT_VIDEO_INPUT | Query the current video input. For further information, refer to the Linux Media Infrastructure userspace API document. |
METADATA_CAMERA_STATUS | Video Input Status. For further information, refer to the Linux Media Infrastructure userspace API document. |
METADATA_IMAGE_FORMATS | Enumerate image formats. For further information, refer to the Linux Media Infrastructure userspace API document. |
METADATA_DATA_FORMAT | Get the data format. For further information, refer to the Linux Media Infrastructure userspace API document. |
METADATA_CROPPING_ABILITY | Information about the video cropping and scaling abilities. For further information, refer to the Linux Media Infrastructure userspace API document. |
METADATA_STREAMING_PARAMETERS | Get streaming parameters. For further information, refer to the Linux Media Infrastructure userspace API document. |
VIDEO_START_STREAMING | Start streaming process. |
VIDEO_STOP_STREAMING | Stop streaming process. |
VIDEO_STREAM_URI | Get video-streaming URI. |
VIDEO_STREAMING_STATUS | Get streaming status, including FFmpeg options. |
Note
In general, this predefined device profile should be applicable to all types of USB cameras. You do not need to define device profile yourself unless you want to modify resource names or set default values for video options.
USB Camera Protocol Properties
The available USB Camera protocol properties are described in the following table:
Protocol Property | Description | Valid Values |
---|---|---|
Path | A file descriptor of camera created by OS. You can find the path of the connected USB camera through the v4l2-ctl utility | String. For example, /dev/video0 |
AutoStreaming | Indicates whether the device service should automatically start video streaming for cameras. Default value is false. |
|
Configurable RTSP Server Hostname and Port
The hostname and port of the RTSP server to which the device service publishes video streams can be configured using the following environment variables:
Environment Variable | Description |
---|---|
DRIVER_RTSPSERVERHOSTNAME |
Specifies the RTSP server hostname Default is localhost |
DRIVER_RTSPTCPPORT |
Specifies the RTSP server port number Default is 8554 |
Tested Devices
The following devices have been tested with EdgeX:
- AUKEY PC-LM1E Webcam
- HP w200 Webcam
- Jinpei JW-01B USB FHD Web Computer Camera
- Logitech Brio 4K
- Logitech C270 HD Webcam
- Logitech StreamCam
The following devices have been tested with Edge Xpert:
- HP w200 Webcam
- Jinpei JW-01B USB FHD Web Computer Camera
- Logitech C270 HD Webcam
Using the USB Camera Device Service
Examples of setting up and using devices with the Edge Xpert USB Camera Device Service can be found at USB Camera Example