Configure an ffmpeg Camera
The ffmpeg
camera model uses a camera device, a video file, or a stream as a camera.
When used with a streaming camera, the ffmpeg
camera model supports any streaming camera format that is supported by the ffmpeg
program, including MJPEG, H264, and MP4.
Navigate to the Config tab of your machine’s page in the Viam app.
Click on the Components subtab and click Create component.
Select the camera
type, then select the ffmpeg
model.
Enter a name for your camera and click Create.
Copy and paste the following attribute template into your camera’s Attributes box. Then remove and fill in the attributes as applicable to your camera, according to the table below.
{
"video_path": "<your-video-path>",
"intrinsic_parameters": {
"width_px": <int>,
"height_px": <int>,
"fx": <float>,
"fy": <float>,
"ppx": <float>,
"ppy": <float>
},
"distortion_parameters": {
"rk1": <float>,
"rk2": <float>,
"rk3": <float>,
"tp1": <float>,
"tp2": <float>
},
"debug": <boolean>,
"input_kw_args": { ... },
"filters": [
{
"name": <string>,
"args": [ "<first>", "<second>", ... ],
"kw_args": { ... }
}
],
"output_kw_args": { ... },
}
{
"video_path": "video0"
}
{
"name": "<your-camera-name>",
"model": "ffmpeg",
"type": "camera",
"namespace": "rdk",
"attributes": {
"intrinsic_parameters": {
"width_px": <int>,
"height_px": <int>,
"fx": <float>,
"fy": <float>,
"ppx": <float>,
"ppy": <float>
},
"distortion_parameters": {
"rk1": <float>,
"rk2": <float>,
"rk3": <float>,
"tp1": <float>,
"tp2": <float>
},
"debug": <boolean>,
"video_path": "<your-video-path>",
"input_kw_args": { ... },
"filters": [
{
"name": <string>,
"args": [ "<first>", "<second>", ... ],
"kw_args": { ... }
}
],
"output_kw_args": { ... },
}
}
The following attributes are available for ffmpeg
cameras:
Name | Type | Inclusion | Description |
---|---|---|---|
video_path | string | Required | The file path to the camera device, color image file, or streaming camera. If you are using a camera with an RTSP stream, provide the RTSP address to this attribute. |
intrinsic_parameters | object | Optional | The intrinsic parameters of the camera used to do 2D <-> 3D projections:
|
distortion_parameters | object | Optional | Modified Brown-Conrady parameters used to correct for distortions caused by the shape of the camera lens:
|
debug | boolean | Optional | Enables the debug outputs from the camera if true .Default: false |
input_kw_args | object | Optional | The input keyword arguments. |
filters | array | Optional | The file path to the depth image. Array of filter objects that specify:
|
output_kw_args | object | Optional | The output keyword arguments. |
View the camera stream
Once your camera is configured and connected, go to the Control tab, and click on the camera’s dropdown menu. Then toggle the camera or the Point Cloud Data view to ON. If everything is configured correctly, you will see the live video feed from your camera. You can change the refresh frequency as needed to change bandwidth.
Next steps
Have questions, or want to meet other people working on robots? Join our Community Discord.
If you notice any issues with the documentation, feel free to file an issue or edit this file.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!