# Object detection and encode with LiteRT
Source: [https://docs.qualcomm.com/doc/80-70018-50/topic/single-camera-stream-with-object-detection-and-encode.html](https://docs.qualcomm.com/doc/80-70018-50/topic/single-camera-stream-with-object-detection-and-encode.html)
The use cases use a YOLOv5 LiteRT model to identify the object in a scene. The use
case is to either overlay or compose the bounding boxes over the detected objects, and then
encode this stream as an H.264 bitstream.
## Use qtivoverlay plugin to apply bounding box overlay
Run the use case:
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 ! qtimltflite delegate=external \
external-delegate-path=libQnnTFLiteDelegate.so external-delegate-options="QNNExternalDelegate,backend_type=htp;" model=/etc/models/yolov5.tflite ! queue ! \
qtimlvdetection threshold=75.0 results=10 module=yolov5 labels=/etc/labels/yolov5.labels \
constants="YoloV5,q-offsets=<3.0>,q-scales=<0.005047998391091824>;" ! text/x-raw ! queue ! metamux.Copy to clipboard
To stop the use case, use CTRL + C.
Figure : Pipeline for bounding box overlay and encode

The figure shows the flow of the use case execution:
1. Identify the 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 the stream as a H.264 bitstream.
4. Multiplex the stream in an MP4 container and stored as an MP4 file.
The table provides the sequential processing stages of the pipeline execution:
| Process | Description |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70018-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.
|
| **Preprocessing** | **Preprocessing** |
| [qtimlvconverter](https://docs.qualcomm.com/doc/80-70018-50/topic/qtimlvconverter.html) |
- Receives the video stream on its sink pad.
- Performs preprocessing:
- Color conversion
- Scaling down/up
- Normalization on the stream data when the model
expects the floating point values as an input
- Converts the video stream to a tensor stream on its source
pad.The object detection model uses this tensor
stream for inferencing.
|
| **Inferencing** | **Inferencing** |
| [qtimltflite](https://docs.qualcomm.com/doc/80-70018-50/topic/qtimltflite.html) |
- Loads the object detection model.
- Modifies the graph for the chosen delegate.
- Receives the tensor stream on its sinkpad.
- Runs the inference and produces a tensor stream with the
object detection results on its source pad.
|
| **Postprocessing** | **Postprocessing** |
| [qtimlvdetection](https://docs.qualcomm.com/doc/80-70018-50/topic/qtimlvdetection.html) |
- Receives the inference tensors from the object detection
model.
- Converts the inference tensors on its sinkpad into formats
like video or text that the multimedia plugins can process
later.
- Applies the threshold to the chosen number of results.
- Loads the corresponding modules for detection models.
In
this use case, qtimlvdetection does the following:
- Loads the YOLOv5 submodule.
- Produces results as structures of text.
- Sends them to the sinkpad of qtimetamux.
|
| [qtimetamux](https://docs.qualcomm.com/doc/80-70018-50/topic/qtimetamux.html) |
- Receives video stream and text stream with bounding box
results corresponding to the video stream on its
sinkpads.
- Produces GST buffers with contents of the video stream from
its sink pad.
- Adds bounding boxes as GstVideoRegionOfInterest from data
sinkpad to GST buffers meta (meta muxing) on its source
pad.
|
| [qtivoverlay](https://docs.qualcomm.com/doc/80-70018-50/topic/qtioverlay.html) |
- Receives the multiplexed stream.
- Overlays the bounding boxes on the VideoFrame using CL.
- Produces GST buffers with overlays in its source pad.
|
| [v4l2h264enc](https://docs.qualcomm.com/doc/80-70018-50/topic/v4l2h264enc.html) |
- 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
/opt/video.mp4 file. |
| Playback | Pull video.mp4 from the host computer and
play it on a media player:
`scp root@ target device>:/opt/ directory>` |
## Use qtivcomposer to mix original frame with bounding box mask
Run the use case:
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 ! qtimltflite delegate=external external-delegate-path=libQnnTFLiteDelegate.so \
\external-delegate-options="QNNExternalDelegate,backend_type=htp;" model=/etc/models/yolov5.tflite ! queue ! \
qtimlvdetection threshold=75.0 results=10 module=yolov5 labels=/etc/labels/yolov5.labels \
constants="YoloV5,q-offsets=<3.0>,q-scales=<0.005047998391091824>;" ! video/x-raw,format=BGRA,width=640,height=360 ! queue ! mixer.Copy to clipboard
To
stop the use case, use CTRL + C.
Figure : Pipeline for bounding box mask and encode with qtivcomposer

The 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. Using qtivcomposer, compose bounding boxes over the objects detected and the
original video stream.
3. Encode this stream as an H.264 bitstream.
4. Multiplex the stream in an MP4 container and stored as an MP4 file.
The table provides the sequential processing stages of the pipeline execution:
| Process | Description |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70018-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.
|
| **Preprocessing** | **Preprocessing** |
| [qtimlvconverter](https://docs.qualcomm.com/doc/80-70018-50/topic/qtimlvconverter.html) |
- Receives the video stream on its sink pad.
- Performs preprocessing:
- Color conversion
- Scaling down/up
- Normalization on the stream data when the model
expects the floating point values as input
- Converts the video stream to a tensor stream on its source
pad.The object detection model uses this tensor
stream for inferencing.
|
| **Inferencing** | **Inferencing** |
| [qtimltflite](https://docs.qualcomm.com/doc/80-70018-50/topic/qtimltflite.html) |
- Loads the object detection model.
- Modifies the graph for the chosen delegate.
- Receives the tensor stream on its sinkpad.
- Runs the inference and produces a tensor stream with the
object detection results on its source pad.
|
| **Postprocessing** | **Postprocessing** |
| [qtimlvdetection](https://docs.qualcomm.com/doc/80-70018-50/topic/qtimlvdetection.html) |
- Receives the inference tensors from the object detection
model.
- Converts the inference tensors on its sinkpad into formats
like video or text that the multimedia plugins can process
later.
- Applies the threshold to the chosen number of results.
- Loads the corresponding modules for detection models.
In
this use case, qtimlvdetection does the following:
- Loads the YOLOv5 submodule.
- Produces video frames with only bounding boxes that
can be overlaid on objects.
- Sends them to the sinkpad of qtivcomposer.
|
| [qtivcomposer](https://docs.qualcomm.com/doc/80-70018-50/topic/qtivcomposer.html) |
- Receives the original video stream and video stream with
bounding boxes on its sinkpads
- On its sourcepads, produces content that's composed of video
streams processed from its sinkpads.
|
| [v4l2h264enc](https://docs.qualcomm.com/doc/80-70018-50/topic/v4l2h264enc.html) |
- 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/ directory>` |
**Parent Topic:** [LiteRT use cases](https://docs.qualcomm.com/doc/80-70018-50/topic/tensorflow-lite-use-cases.html)
Last Published: Jan 30, 2026
[Previous Topic
Object detection and display with LiteRT](https://docs.qualcomm.com/bundle/publicresource/80-70018-50/topics/single-camera-stream-with-object-detection-and-display.md) [Next Topic
Image segmentation and display with LiteRT](https://docs.qualcomm.com/bundle/publicresource/80-70018-50/topics/single-camera-stream-with-image-segmentation-and-display.md)