# Object detection and encode with Neural Processing SDK
Source: [https://docs.qualcomm.com/doc/80-70022-50/topic/single-camera-stream-with-object-detection-and-encode-with-mobilenet-v2-ssd.html](https://docs.qualcomm.com/doc/80-70022-50/topic/single-camera-stream-with-object-detection-and-encode-with-mobilenet-v2-ssd.html)
The use cases implement a yolox.dlc object detection model with
Qualcomm Neural Processing SDK to identify an object from a camera stream. The use case is
to overlay or compose the bounding boxes over the detected objects, and then encode the
stream as a H.264 bitstream.
Download [YOLOX](https://aihub.qualcomm.com/iot/models/yolox?searchTerm=yolox%29) Qualcomm AI runtime w8a8 precision model
from AI hub. The YOLOX model uses the YOLOv8 postprocessing module.
Note: For Ubuntu Server, `sudo` access is necessary to
write the encoded stream to the `/etc/media` folder.
## Use qtivoverlay plugin to apply detection overlay
Run the use case on the target
device:
gst-launch-1.0 -e \
qtiqmmfsrc name=camsrc ! video/x-raw,format=NV12_Q08C,width=1280,height=720,framerate=30/1 ! queue ! tee name=split \
split. ! queue ! qtimetamux name=metamux ! queue ! qtivoverlay ! queue ! v4l2h264enc capture-io-mode=4 output-io-mode=5 ! h264parse ! queue ! mp4mux ! queue ! filesink location=/etc/media/video.mp4 \
split. ! queue ! qtimlvconverter ! queue ! qtimlsnpe delegate=dsp model=/etc/models/yolox-yolo-x-w8a8.dlc layers="" ! queue ! \
qtimlpostprocess settings="{\"confidence\": 70.0}" results=5 module=yolov8 labels=/etc/labels/yolox.json ! text/x-raw ! queue ! metamux.Copy to clipboard
To stop the use case, use CTRL + C.
The following figure shows the flow of the use case execution:
1. Identify object scenes from a video stream, which is coming through a camera
source.
2. Overlay bounding boxes over the detected objects using overlaylib.
3. Encode this stream as an H.264 bitstream.
4. Multiplex the stream in an MP4 container and stored as an MP4 file.
Figure : Pipeline for bounding box overlay and encode
The following table provides the sequential processing stages of the pipeline
execution:
| Process | Description |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70022-50/topic/qtiqmmfsrc.html) |
Collects the video stream (source) and creates two copies of the source:
One stream is sent to qtimetamux plugin to retain the video stream.
The other stream is sent to an ML inferencing pipeline.
Applies parameters to each frame of the video stream it's receiving on its sinkpad.
Encodes it into bitstream and sends it over its sourcepad.
|
| h264parse | Adds more information about the bitstream to the GStreamer buffer meta. |
| mp4mux | Receives these buffers and creates containers with format specification buffers. |
| **Output** | **Output** |
| Filesink | Stores the resulting stream in a /etc/media/video.mp4 file. |
| Playback | Pull video.mp4 from the host computer and play it on a media player: `scp root@ target device>:/etc/media/video.mp4 directory>` |
## Use qtivcomposer to mix original frame with detection mask
Run the use case on the target
device:
gst-launch-1.0 -e \
qtiqmmfsrc name=camsrc ! video/x-raw,format=NV12_Q08C,width=1280,height=720,framerate=30/1 ! queue ! tee name=split \
split. ! queue ! qtivcomposer name=mixer ! queue ! video/x-raw,format=NV12,width=1920,height=1080,interlace-mode=progressive,colorimetry=bt601 ! \
v4l2h264enc capture-io-mode=4 output-io-mode=5 ! h264parse ! queue ! mp4mux ! queue ! filesink location=/etc/media/video.mp4 \
split. ! queue ! qtimlvconverter ! queue ! qtimlsnpe delegate=dsp model=/etc/models/yolox-yolo-x-w8a8.dlc layers="" ! queue ! \
qtimlpostprocess settings="{\"confidence\": 70.0}" results=5 module=yolov8 labels=/etc/labels/yolox.json ! video/x-raw,width=640,height=360 ! queue ! mixer.Copy to clipboard
To stop the use case, use CTRL + C.
The following figure shows the flow of the use case execution:
1. Identify object scenes from a video stream, which is coming through a camera
source.
2. Compose bounding boxes over objects detected and original video stream using
qtivcomposer.
3. Encode this stream as an H.264 bitstream.
4. Multiplex the stream in an MP4 container and stored as an MP4 file.
Figure : Pipeline for bounding box mask and encode with qtivcomposer
The following table provides the sequential processing stages of the pipeline
execution:
| Process | Description |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70022-50/topic/qtiqmmfsrc.html) |
Collects the video stream (source) and creates two copies of the source:
One stream is sent to qtimetamux plugin to retain the video stream.
The other stream is sent to an ML inferencing pipeline.
Applies parameters to each frame of the video stream its receiving on its sinkpad.
Encodes it into bitstream and sends it over its sourcepad.
|
| h264parse | Adds more information about the bitstream to the GStreamer buffer meta. |
| mp4mux | Receives these buffers and creates containers with format specification buffers. |
| **Output** | **Output** |
| Filesink | Stores the resulting stream in a /etc/media/video.mp4 file. |
| Playback | Pull video.mp4 from the host computer and play it on a media player: `scp root@ target device>:/etc/media/video.mp4 directory>` |
## Known issue
The current model in AI hub isn't giving the expected output. The issue will be fixed
in a future release.
**Parent Topic:** [Qualcomm Neural Processing SDK use cases](https://docs.qualcomm.com/doc/80-70022-50/topic/qualcomm-neural-processing-sdk-use-cases.html)
Last Published: Feb 20, 2026
[Previous Topic
Object detection and display with Neural Processing SDK](https://docs.qualcomm.com/bundle/publicresource/80-70022-50/topics/single-camera-stream-with-object-detection-and-display-with-mobilenet-v2-ssd.md) [Next Topic
Image segmentation and display with Neural Processing SDK](https://docs.qualcomm.com/bundle/publicresource/80-70022-50/topics/single-camera-stream-with-image-segmentation-and-display-with-deeplabv3-quantized.md)