Skip to main content
Every AI pipeline starts with a data source — the raw video or audio that the model will analyze. QIM SDK uses GStreamer plugins to connect your pipeline to whatever source you’re working with: a video file for testing, a USB webcam on your desk, a built-in ISP camera on the device, or a live RTSP stream from a network camera. Each source type produces frames in a slightly different format, but they all feed into the same pipeline structure. The sections below show the GStreamer snippet for each source type — copy the one that matches your setup and use it as the first stage of your pipeline.
1

Choose your source

Paste one of the following export VIDEO_SOURCE commands into your device shell:
Use a pre-recorded video file to test your pipeline. This is the easiest way to get started — you can replay the same clip repeatedly to validate your model.1. Download sample video on your host machine
FileDownloadSave as
Sample videoInput videovideo.mp4
Then copy it to your device:
SCP (SSH)
ssh <user>@<device-ip> "mkdir -p $HOME/media"
scp video.mp4  <user>@<device-ip>:$HOME/media/
2. Set the source
export VIDEO_SOURCE="filesrc location=$HOME/media/video.mp4 ! qtdemux ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! video/x-raw,format=NV12"
USB cameras show up as V4L2 devices (e.g. /dev/video0). Run this on the device to find your camera’s node:
for dev in /dev/video*; do
  echo "$dev: $(cat /sys/class/video4linux/$(basename $dev)/name)"
done
Then set the source using the device node you identified:
export VIDEO_SOURCE="v4l2src device=/dev/video<#> ! video/x-raw,width=1920,height=1080"
Note: Adjust the resolution if your camera does not support 1080p.
Built-in cameras are accessed using the qticamsrc plugin, which handles ISP hardware initialization on Qualcomm SoCs.
export VIDEO_SOURCE="qticamsrc camera=0 ! video/x-raw,width=1920,height=1080"
Note: If multiple cameras are connected, set the camera property to select the one you want.
RTSP cameras stream encoded video (H.264 or H.265) over the network. The rtspsrc plugin receives the stream and the hardware decoder converts it to NV12 for the pipeline.
export VIDEO_SOURCE="rtspsrc location=<RTSP-URL> ! rtph264depay ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! video/x-raw,format=NV12"
The resolution is determined by the camera and cannot be changed in GStreamer.The RTSP URL format varies by manufacturer. Common formats:
rtsp://username:password@ip_address:port/stream_path
rtsp://ip_address:port/h264/ch1/main/av_stream
rtsp://username:password@ip_address:port/Streaming/Channels/101
If you’re unsure, search for “[your camera model] RTSP URL” or check the manufacturer’s documentation.
2

Run example on device

data sourceThis pipeline captures frames from the video source in NV12 (YUV) format and passes them to appsink, which notifies the application when a new frame is available. The queue element allows the source and consumer to run in parallel.
gst-launch-1.0 $VIDEO_SOURCE ! \
  filesink location=$HOME/media/frame.bin