# AI USB camera 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 a 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-80021-50/topic/ai-usb-camera.html#section-jjq-bln-42c). Live camera preview on display v4l2src qtivtransform capsfilter waylandsink Video encoding v4l2src qtivtransform capsfilter v4l2h264enc h264parse mp4mux filesink h264parse qtirtspbin Video encoding and RTSP streaming v4l2src qtivtransform capsfilter v4l2h264enc Qualcomm Open source **Figure : gst-ai-usb-camera-app pipeline** v4l2src qtimlvtransform qtimlvconverter qtimltflite/qtimlsnpe/qtimlqnn qtimlpostprocess qtivcomposer waylandsink capsfilter tee v4l2src qtimlvtransform qtimlvconverter qtimltflite/qtimlsnpe/qtimlqnn qtimlpostprocess qtivcomposer filesink capsfilter tee v4l2src qtimlvtransform qtimlvconverter qtimltflite/qtimlsnpe/qtimlqnn qtimlpostprocess qtivcomposer RTSP sink capsfilter tee Qualcomm Open source **Figure : gst-ai-usb-camera-app pipeline with object detection** ## Input and output capabilities The following table summarizes the input and output capabilities supported by the sample application: | Config | Input | Input | Input | Input | Output | Output | Output | | --- | --- | --- | --- | --- | --- | --- | --- | | Config | File src | RTSP | USB camera | MIPI camera | File | Display | RTSP | | Config #1 | Yes | Yes | yes | No | No | Yes | No | | Config #2 | Yes | Yes | Yes | No | No | Yes | No | | | | | | | | | | ## Sample model and label files | **Runtime** | **Model files** | **Label files** | | --- | --- | --- | | Qualcomm Neural Processing SDK | |
\* *yolonas.json*
\* *yolov8.json*
\* *yolov5.json*
\* *yolox.json* | | LiteRT | |
\* *yolonas.json*
\* *yolov8.json*
\* *yolov5.json*
\* *yolox.json* | | Qualcomm AI Engine direct | *yolov8\_det\_quantized.bin* |
\* *yolonas.json*
\* *yolov8.json*
\* *yolov5.json*
\* *yolox.json* | | | | | | | | | ## 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-80021-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-80021-8/pcie.html#download-pcie-to-usb-controller-firmware). Note For USB camera input, set the `video-format`, `resolution`, and `framerate` parameters in the configuration file to match the capabilities of the camera. To check the camera capabilities, see [Configure USB camera](https://docs.qualcomm.com/bundle/publicresource/topics/80-80021-8/usb.html#configure-usb-camera). 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-80021-50/topic/gst-ai-object-detection.html#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": "