> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run sample applications

> Run the preinstalled GStreamer-based AI sample applications on a Qualcomm Device Cloud device

The Qualcomm Dragonwing™ RB3 Gen 2 device comes preinstalled with GStreamer-based AI sample applications. Some of these applications support RTSP input (such as from IP cameras) and RTSP output that can be viewed on the host computer.

## Run the multistream inference sample application

The `gst-ai-multistream-inference` application demonstrates AI inference (object detection and classification) on up to 8 combined input streams from a camera, file, or RTSP source. The output can be displayed on an HDMI display, saved as an H.264-encoded MP4 file, or streamed as RTSP output.

1. Download the YoloX and InceptionV3 quantized models from [Qualcomm AI Hub](https://aihub.qualcomm.com/) and copy them to the device.

2. Copy the models and input video files to the device from your host computer terminal:

   ```shell theme={null}
   scp -P 2222 -o StrictHostKeychecking=no -o UserKnownHostsFile=/dev/null <model file path> root@localhost:/etc/models/
   ```

   ```shell theme={null}
   scp -P 2222 -o StrictHostKeychecking=no -o UserKnownHostsFile=/dev/null <video file path> root@localhost:/etc/media/
   ```

3. On the QDC device shell, download and extract the labels file:

   ```shell theme={null}
   wget https://github.com/quic/sample-apps-for-qualcomm-linux/releases/download/labels/labels.zip
   unzip -d /etc/ labels.zip
   ```

4. Create the `/etc/xdg/weston` directory on the device:

   ```shell theme={null}
   mkdir /etc/xdg/weston
   ```

5. Create or edit the `/etc/xdg/weston/weston.ini` file on the device:

   ```ini theme={null}
   # configuration file for Weston
   [core]
   idle-time=0
   # backend=sdm-backend.so
   repaint-window=10
   gbm-format=xbgr8888
   require-outputs=none

   [output]
   name=DSI-1
   mode=on

   [output]
   name=DP-1
   mode=on

   [shell]
   clock-format=seconds
   ```

6. Edit the `/etc/configs/config-multistream-inference.json` configuration file.

   For RTSP input and RTSP output:

   ```json theme={null}
   {
     "input-rtsp-path": [
       "rtsp://127.0.0.1:8901/live1.mkv"
     ],
     "model": "/etc/models/yolox_quantized.tflite",
     "labels": "/etc/labels/yolox.json",
     "output-display": 0,
     "output-ip-address": "127.0.0.1",
     "output-port-number": "8900",
     "use-case": 0
   }
   ```

   The `input-rtsp-path` field is a JSON array of RTSP input addresses. The output is streamed at `rtsp://<output-ip-address>:<output-port-number>/live`.

   For file input and file output:

   ```json theme={null}
   {
     "input-file-path": [
       "/etc/media/video1.mp4",
       "/etc/media/video2.mp4",
       "/etc/media/video3.mp4",
       "/etc/media/video4.mp4",
       "/etc/media/video5.mp4",
       "/etc/media/video6.mp4"
     ],
     "model": "/etc/models/yolox_quantized.tflite",
     "labels": "/etc/labels/yolox.json",
     "input-type": "h264",
     "output-display": 0,
     "output-file-path": "<output file path>",
     "use-case": 0
   }
   ```

   The `input-file-path` field is a JSON array of input file paths. The output is saved to the path specified in `output-file-path`.

7. Run the sample application:

   ```shell theme={null}
   gst-ai-multistream-inference
   ```

   For a full list of configuration options, run:

   ```shell theme={null}
   gst-ai-multistream-inference -h
   ```

8. View or copy the output:

   <Tabs>
     <Tab title="File output">
       Copy the output file to your host machine:

       ```shell theme={null}
       scp -P 2222 -o StrictHostKeychecking=no -o UserKnownHostsFile=/dev/null root@localhost:<output file path> ./
       ```
     </Tab>

     <Tab title="RTSP output">
       View the output using VLC media player:

       1. Open VLC media player.
       2. Press `Ctrl+N`.
       3. Enter the URL `rtsp://127.0.0.1:8900/live` in the input bar.
       4. Select **Play**.

       <img src="https://mintcdn.com/qualcomm-prod/ajmq44Q1W0vLtUT4/Tools/Qualcomm-Device-Cloud/_images/qdc/sample-app-rtsp-output.png?fit=max&auto=format&n=ajmq44Q1W0vLtUT4&q=85&s=3680aa02a0a476363be703eb81a4b834" alt="Sample application RTSP output in VLC" width="1920" height="1128" data-path="Tools/Qualcomm-Device-Cloud/_images/qdc/sample-app-rtsp-output.png" />
     </Tab>
   </Tabs>

For more information, see [multistream inference](https://docs.qualcomm.com/doc/80-80022-55/topic/multistream-inference.html).

## Run the multi-input object detection sample application

The `gst-ai-multi-input-output-object-detection` application performs object detection on video streams from various sources such as a file or RTSP stream. The output can be displayed on an HDMI display, saved as an H.264-encoded MP4 file, or streamed as RTSP output.

1. [Generate the yolov5.tflite model and download the label files](/Key-Documents/AI-Developer-Workflow/topic/appx-export-yolov8).

2. Copy the model and input video files to the device:

   ```shell theme={null}
   scp -P 2222 -o StrictHostKeychecking=no -o UserKnownHostsFile=/dev/null <model file path> root@localhost:/etc/models/
   ```

   ```shell theme={null}
   scp -P 2222 -o StrictHostKeychecking=no -o UserKnownHostsFile=/dev/null <video file path> root@localhost:/etc/media/
   ```

3. On the QDC device shell, download and extract the labels file:

   ```shell theme={null}
   wget https://github.com/quic/sample-apps-for-qualcomm-linux/releases/download/labels/labels.zip
   unzip -d /etc/ labels.zip
   ```

4. Unless already done, create the `/etc/xdg/weston` directory on the device:

   ```shell theme={null}
   mkdir /etc/xdg/weston
   ```

5. Unless already done, edit the `/etc/xdg/weston/weston.ini` file on the device:

   ```ini theme={null}
   # configuration file for Weston
   [core]
   idle-time=0
   # backend=sdm-backend.so
   repaint-window=10
   gbm-format=xbgr8888
   require-outputs=none

   [output]
   name=DSI-1
   mode=on

   [output]
   name=DP-1
   mode=on

   [shell]
   clock-format=seconds
   ```

6. Edit the `/etc/configs/config-multi-input-output-object-detection.json` configuration file.

   For file input and file output:

   ```json theme={null}
   {
     "input-file-path": [
       "/etc/media/video1.mp4",
       "/etc/media/video2.mp4"
     ],
     "model": "/etc/models/yolov5.tflite",
     "labels": "/etc/labels/yolov5.json",
     "output-file-path": "/etc/media/output.mp4"
   }
   ```

   For file input and RTSP output:

   ```json theme={null}
   {
     "input-file-path": [
       "/etc/media/video1.mp4",
       "/etc/media/video2.mp4"
     ],
     "model": "/etc/models/yolov5.tflite",
     "labels": "/etc/labels/yolov5.json",
     "output-ip-address": "10.92.176.104",
     "output-port-number": "8900"
   }
   ```

7. Run the sample application:

   ```shell theme={null}
   gst-ai-multi-input-output-object-detection --config-file=/etc/configs/config-multi-input-output-object-detection.json
   ```

8. View or copy the output:

   <Tabs>
     <Tab title="File output">
       Copy the output file to your host machine:

       ```shell theme={null}
       scp -P 2222 -o StrictHostKeychecking=no -o UserKnownHostsFile=/dev/null root@localhost:<output file path> ./
       ```
     </Tab>

     <Tab title="RTSP output">
       View the output using VLC media player:

       1. Open VLC media player.
       2. Press `Ctrl+N`.
       3. Enter the URL `rtsp://127.0.0.1:8900/live` in the input bar.
       4. Select **Play**.

       <img src="https://mintcdn.com/qualcomm-prod/ajmq44Q1W0vLtUT4/Tools/Qualcomm-Device-Cloud/_images/qdc/sample-app-rtsp-output.png?fit=max&auto=format&n=ajmq44Q1W0vLtUT4&q=85&s=3680aa02a0a476363be703eb81a4b834" alt="Sample application RTSP output in VLC" width="1920" height="1128" data-path="Tools/Qualcomm-Device-Cloud/_images/qdc/sample-app-rtsp-output.png" />
     </Tab>
   </Tabs>

For more information, see [multi-input inferencing](https://docs.qualcomm.com/doc/80-80022-55/topic/multi-input-inferencing.html).
