# AI USB camera
Source: [https://docs.qualcomm.com/doc/80-70020-50/topic/ai-usb-camera.html](https://docs.qualcomm.com/doc/80-70020-50/topic/ai-usb-camera.html)
The **gst-ai-usb-camera-app** streams video from a USB webcam connected to the
Qualcomm EVK. This webcam should be accessible as a /dev/videoX device.
Additionally, you can perform object detection and preview the results.
You can choose to preview the output on Wayland, or encode to a video file, or live
stream through the RTSP.
Alternatively, you can set `enable-object-detection `as *True* to
perform object detection.
The following figures show pipeline, which processes the input from the USB camera to
generate various outputs.
For more information about the plugins used in these pipelines, see [Pipeline flow](https://docs.qualcomm.com/doc/80-70020-50/topic/ai-usb-camera.html#ai-usb-camera__section_jjq_bln_42c).
Figure : gst-ai-usb-single-camera-app pipeline
Figure : gst-ai-usb-single-camera-app pipeline with object detection
## Sample model and label files
| Runtime | Model files | Label files |
| --- | --- | --- |
| Qualcomm Neural Processing SDK |
yolonas.dlc yolov5.dlc yolov8.dlc | yolonas.labels yolov8.labels yolov5.labels yolox.labels |
| LiteRT | yolov8_det_quantized.tflite yolonas_quantized.tflite yolov5.tflite yolox_quantized.tflite | yolonas.labels yolov8.labels yolov5.labels yolox.labels |
| Qualcomm AI Engine direct | *yolov8\_det\_quantized.bin* | yolonas.labels yolov8.labels yolov5.labels yolox.labels |
| | | |
| | | |
## Run the application on the target device
The sample application uses the
/etc/configs/config-usb-camera-app.json file to read the
input parameters. Ensure that you use the config JSON file to run the
application.
To create your own config JSON file, use [config-usb-camera-app.json](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-sample-apps/gst-ai-usb-camera-app/config-usb-camera-app.json?ref_type=heads) as a
reference.
1. Ensure to connect the USB webcam to the target device and complete the [Prerequisites](https://docs.qualcomm.com/doc/80-70020-50/topic/download-model-and-label-files.html).
Note: If
the USB camera isn't detected on the target device, Download the required
firmware. See [Download PCIe to USB controller
firmware](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-8/pcie.html#download-pcie-to-usb-controller-firmware).
2. Update the config JSON file based on the model, input stream, and other
properties. For more information, see [Config JSON field description](https://docs.qualcomm.com/doc/80-70020-50/topic/ai-usb-camera.html#ai-usb-camera__section_qjx_hqq_32c).
3. Use the following format of the
/etc/configs/config-usb-camera-app.json
file:
{
"width": "",
"height": "",
"framerate": "",
"video-format": "",
"output": "",
"ip-address":"",
"port":"",
"enable-object-detection": "",
"file-path": " ",
"ml-framework": "",
"yolo-model-type": "",
"model": "",
"labels": "",
"constants": "",
"threshold": ,
"runtime": ""
“snpe-layers”: “”
}Copy to clipboard
For example, run the application using RTSP input, LiteRT,
YOLOv8 model, DSP runtime, custom constants, and custom threshold value. The
reference config file is as
follows:
{
"width": 1920,
"height": 1080,
"framerate": 30,
"output":"waylandsink",
"video-format":"yuy2",
"model":"/etc/models/yolox_quantized.tflite",
"labels":"/etc/labels/yolox.labels",
"output-file":"/etc/media/output.mp4",
"ip-address":"127.0.0.1",
"port":"8900",
"enable-object-detection": "TRUE",
"ml-framework": "tflite",
"yolo-model-type": "yolox",
"constants": "YOLOx,q-offsets=<38.0, 0.0, 0.0>,q-scales=<3.6124823093414307, 0.003626860911026597, 0.0>;",
"threshold": 75,
"runtime": "dsp"
}
Copy to clipboard
4. Run the gst-ai-usb-camera-app
application:
gst-ai-usb-camera-app --config-file=/etc/configs/config-usb-camera-app.jsonCopy to clipboard
Note: You can run the
Yolo-NAS-Quantized.tflite model using the YOLOv8
value in the `yolo-model-type` field.
5. To display the available help options, run the following command in the SSH
shell:
gst-ai-usb-camera-app -hCopy to clipboard
6. To stop the use case, use CTRL +
C.
## Expected output
The following table lists the expected output for each use case:
Table : Expected output for gst-usb-single-camera-app
| Use case | Output |
| :--- | :--- |
| Preview | Preview of the camera stream. See [Figure : Expected output for gst-ai-usb-camera-app application–Preview](https://docs.qualcomm.com/doc/80-70020-50/topic/ai-usb-camera.html#ai-usb-camera__fig_ihh_tqq_5bc). |
| Save the MP4 | Save the output to a file at /etc/ folder path. |
| RTSP | View the output on a remote display. |
| Object detection | See [Figure : Expected output for gst-ai-usb-camera-app application–object detection](https://docs.qualcomm.com/doc/80-70020-50/topic/ai-usb-camera.html#ai-usb-camera__fig_rfc_yfd_5bc) |
Figure : Expected output for gst-ai-usb-camera-app application–Preview

Figure : Expected output for gst-ai-usb-camera-app application–object
detection

## Pipeline flow
The following table lists the plugins used in AI USB camera pipelines:
| Pipeline | Description |
| --- | --- |
| Dump the USB camera to a filesink | USB camera captures the camera live stream. qtivtransform transforms the stream data. Capsfilter is applied to enforce constraints on the raw video data. Filesink is used to dump the data into a file. |
| Video encoding | USB camera captures the camera live stream. qtivtransform transforms the stream data. Capsfilter is applied to enforce constraints on the raw video data. v4l2h264enc is used to encode the video using the H.264 format. H264parse is used to parse the video. Mp4mux is used to multiplex the video into an MP4 container. Filesink is used to write the video to a file. |
| RTSP streaming | USB camera captures the camera live stream. qtivtransform transforms the stream data. Capsfilter is applied to enforce constraints on the raw video data. v4l2h264enc is used to encode the video using the H.264 format. H264parse is used to parse the video. qtirtspbin is used to load the stream to RTSP. |
| USB camera and object detection on RTSP | USB camera captures the camera live stream. Capsfilter is applied to enforce constraints on the raw video data. tee is used to split the stream for inferencing. qtivtransform transforms the stream data. qtimlvconverter does preprocessing and converts the video stream to a tensor stream, which is used for inferencing. qtimlsnpe , qtimltflite , or qtimlqnn run the inference on the stream. qtimlvdetection handles the inference results from any object detection model and produces video frames. qtivcomposer composes the video frames and shares them with qtirtspsink. qtirtspbin submits the composed video stream to Weston, which renders it on the local display. |
| USB camera and object detection on wayland | USB camera captures the camera live stream. Capsfilter is applied to enforce constraints on the raw video data. tee is used to split the stream for inferencing. qtivtransform transforms the stream data. qtimlvconverter does preprocessing and converts the video stream to a tensor stream, which is used for inferencing. qtimlsnpe , qtimltflite , or qtimlqnn run the inference on the stream. qtimlvdetection handles the inference results from any object detection model and produces video frames. qtivcomposer composes the video frames and shares them with Waylandsink. Waylandsink submits the composed video stream to Weston, which renders it on the local display. |
| Object detection using USB camera and file encode | USB camera captures the camera live stream. Capsfilter is applied to enforce constraints on the raw video data. tee is used to split the stream for inferencing. qtivtransform transforms the stream data. qtimlvconverter does preprocessing and converts the video stream to a tensor stream, which is used for inferencing. qtimlsnpe , qtimltflite , or qtimlqnn run the inference on the stream. qtimlvdetection handles the inference results from any object detection model and produces video frames. qtivcomposer composes the video frames and shares them with Waylandsink. Filesink submits the composed video stream to Weston, which renders it on the local display. |
## Config JSON field description
The different parameters available to configure the JSON file and run the use case
are as follows:
Table : Field description–config_detection.json file
| Field | Values/description |
| :--- | :--- |
| **ml-framework** | Use one of the following models: snpe–Qualcomm Neural Processing SDK tflite–LiteRT qnn–Qualcomm AI Engine direct |
| **yolo-model-type** | Run the `yolov5`, `yolov8`, and `yolonas` models respectively. See [Sample model and label files](https://docs.qualcomm.com/doc/80-70020-50/topic/ai-usb-camera.html#ai-usb-camera__section_ohr_1qq_32c). |
| **runtime** | Use one of the following runtimes: |
| **output** | filesink waylandsink rtspsink |
| **enable-object-detection** | |
| **snpe-layers** | `[“output-layer-name”,”output-layer-name”]` |
| **video-format** | |
Note: `video-format` field is only applicable when
`enable-object-detection` is set to FALSE.
## Related information
[Object detection](https://docs.qualcomm.com/doc/80-70020-50/topic/gst-ai-object-detection.html)
**Parent Topic:** [Run AI/ML sample applications](https://docs.qualcomm.com/doc/80-70020-50/topic/ai-ml-sample-applications.html)
Last Published: Jan 30, 2026
[Previous Topic
Metadata parsing](https://docs.qualcomm.com/bundle/publicresource/80-70020-50/topics/gst-ai-metadata-parser.md) [Next Topic
Hardware benchmarking application](https://docs.qualcomm.com/bundle/publicresource/80-70020-50/topics/vision_ai_demo_app.md)