# AI USB camera
Source: [https://docs.qualcomm.com/doc/80-70018-50/topic/ai-usb-camera.html](https://docs.qualcomm.com/doc/80-70018-50/topic/ai-usb-camera.html)
The **gst-ai-usb-camera-app** streams the 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, save the video encoder output, save the camera YUV
to a file, live stream through RTSP, or perform object detection and preview the
results.
Note: The video encoding use case isn't supported in
the current release.
The 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-70018-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* |
yolonas.labels yolov8.labels |
| LiteRT | yolov8_det_quantized.tflite yolonas_quantized.tflite | yolonas.labels yolov8.labels |
| Qualcomm AI Engine direct | *yolov8\_det\_quantized.bin* | yolonas.labels yolov8.labels |
| | | |
| | | |
## Prerequisites
- If not already done so, [Download and install eSDK](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-51/install-sdk.html#download-and-install-esdk-).
- To run the application, push the model and label files to the device. For
instructions, see [Download model and label files](https://docs.qualcomm.com/doc/80-70018-50/topic/download-model-and-label-files.html).
The
application supports the Qualcomm Neural Processing SDK, Qualcomm AI Engine
direct, and LiteRT models.
- To access your host computer, enable SSH. For instructions, see [Sign in using SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-254/how_to.html#use-ssh).
Note: If SSH is already enabled, you can skip this
step.
- Push the model files from the Linux host computer:
scp root@:/etc/modelsCopy to clipboard
- Note that the [downloaded
script](https://docs.qualcomm.com/doc/80-70018-50/topic/download-model-and-label-files.html) downloads the sample video.mp4 video to
the /etc/media directory. If you are using a custom video,
then ensure that you push the video to /etc/media and
update the file path in the application config.JSON file.
- Connect the display to the device using the HDMI port. For instructions, see
[Set up HDMI display](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-18/samples.html).
- Enable the
display:
export XDG_RUNTIME_DIR=/dev/socket/weston && export WAYLAND_DISPLAY=wayland-1Copy to clipboard
If you face issues while enabling camera or display, see [Camera troubleshooting](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-17/troubleshooting.html) and [Display troubleshooting](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-18/debug.html).
- Ensure that the USB webcam is connected to the device.
Note: If the USB camera isn't detected on the device,
Download the required firmware. See [Download PCIe to USB controller
firmware](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-8/pcie.html#download-pcie-to-usb-controller-firmware).
## Run the application
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. Enter the SSH shell and copy the YOLO-NAS label files to YOLOv8:
cp /etc/labels/yolonas.labels /etc/labels/yolov8.labelsCopy to clipboard
2. Use the following format of the
/etc/configs/config-usb-camera-app.json
file:
{
"width": "",
"height": "",
"framerate": "",
"format": "",
"output": "",
"ip-address":"",
"port":"",
"enable-object-detection": "",
"file-path": " ",
"ml-framework": "",
"yolo-model-type": "",
"model": "",
"labels": "",
"constants": "",
"threshold": ,
"runtime": ""
}Copy to clipboard
Note: 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-70018-50/topic/ai-usb-camera.html#ai-usb-camera__section_qjx_hqq_32c).
For example,
run the application using RTSP input, LiteRT, YOLOv8 model, DSP runtime,
custom constants, and custom threshold value.
In the
config-usb-camera-app.json file, you can replace
model-detection.tflite with
yolov8\_det\_quantized.tflite and
detection.labels with
yolov8.labels.
{
"width": 640,
"height": 480,
"framerate": 30,
"format": "YUY2",
"output": "PREVIEW",
"ip-address":"127.0.0.1",
"port":"8900",
"enable-object-detection": "TRUE",
"ml-framework": "tflite",
"yolo-model-type": "yolov8",
"model": "/etc/models/model-detection.tflite",
"labels": "/etc/labels/detection.labels",
"constants": "YOLOv8,q-offsets=<21.0, 0.0, 0.0>,q-scales=<3.093529462814331, 0.00390625, 1.0>;",
"threshold": 40,
"runtime": "dsp"
}Copy to clipboard
3. Run the gst-ai-usb-camera-app
application:
gst-ai-usb-camera-app --od-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.
To display the available help options, run the following command in the SSH
shell:
gst-ai-usb-camera-app -hCopy to clipboard
To stop the use case, use CTRL + C.
## Expected output
The 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-70018-50/topic/ai-usb-camera.html#ai-usb-camera__fig_ihh_tqq_5bc). |
| Save the MP4 and YUV data | 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-70018-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 table lists the plugins used in AI USB camera pipelines:
| Pipeline | Description |
| --- | --- |
| Dump the camera YUV 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 YUV data into a file. |
| Preview on display | USB camera captures the camera live stream. qtivtransform transforms the stream data. Capsfilter is applied to enforce constraints on the raw video data. The data is sent to the Wayland display sink (Waylandsink ) for live preview. |
| 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. |
| Video encoding and 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. |
| Camera capture and object detection | 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. |
## Config JSON field description
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-70018-50/topic/ai-usb-camera.html#ai-usb-camera__section_ohr_1qq_32c). |
| **runtime** | Use one of the following runtimes: |
| **Input source** | Use one of the following input sources: camera–Primary (0) or secondary (1). file-path–The directory path to the video file. rtsp-ip-port–The address of the RTSP stream: rtsp://<ip>:<port>/<stream> |
## Known issues
The USB camera only supports 640 × 480 resolution.
**Parent Topic:** [Run AI/ML sample applications](https://docs.qualcomm.com/doc/80-70018-50/topic/ai-ml-sample-applications.html)
**Related Resources**
- [Object detection](https://docs.qualcomm.com/doc/80-70018-50/topic/gst-ai-object-detection.html)
Last Published: Jan 30, 2026
[Previous Topic
Metadata parsing](https://docs.qualcomm.com/bundle/publicresource/80-70018-50/topics/gst-ai-metadata-parser.md) [Next Topic
Run multimedia sample applications](https://docs.qualcomm.com/bundle/publicresource/80-70018-50/topics/multimedia-sample-applications.md)