# Image classification and encode with Neural Processing SDK
Source: [https://docs.qualcomm.com/doc/80-70015-50/topic/single-camera-stream-with-image-classification-and-encode-with-mobilenet-v1.html](https://docs.qualcomm.com/doc/80-70015-50/topic/single-camera-stream-with-image-classification-and-encode-with-mobilenet-v1.html)
The use cases use the InceptionV3 image classification model with Qualcomm Neural
Processing SDK to classify scenes from a single camera stream and either overlay or compose
the classification labels, and then encode the stream.
You can use any publicly available classification model with TensorFlow and convert it to
`.dlc` format. For instructions, see [TensorFlow Model Conversion](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-2/model_conv_tensorflow.html).
## Variant 1: Use qtioverlay plugin to apply classification overlay
Run the use
case:
setprop persist.overlay.use_c2d_blit 2Copy to clipboard
gst-launch-1.0 -e \
qtiqmmfsrc name=camsrc ! video/x-raw\(memory:GBM\),format=NV12,width=1280,height=720,framerate=30/1,compression=ubwc ! queue ! tee name=split \
split. ! queue ! qtimetamux name=metamux ! queue ! qtioverlay ! queue ! video/x-raw\(memory:GBM\),format=NV12,width=1280,height=720,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=5 output-io-mode=5 ! h264parse ! queue ! mp4mux ! queue ! filesink location=/opt/video.mp4 \
split. ! queue ! qtimlvconverter ! queue ! qtimlsnpe delegate=dsp model=/opt/inceptionv3.dlc ! queue ! qtimlvclassification threshold=40.0 results=2 module=mobilenet labels=/opt/classification.labels ! text/x-raw ! queue ! metamux.Copy to clipboard
To stop the use case, press CTRL + C.
Figure : Pipeline for classification overlay and encode

The figure shows the flow of the use case execution:
1. Classify scenes from a video stream coming through a camera source.
2. Overlay the classification labels using overlaylib.
3. Encode this stream as an H.264 bitstream.
4. Multiplex the stream in an MP4 container and store it as an MP4 file.
The table provides the sequential processing stages of the pipeline execution:
| Process | Description |
| --- | --- |
| Source |
- The video stream is collected from a camera source plugin
and two copies are created:
- One stream is sent to the 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-70015-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 classification model uses this tensor stream
for inferencing.
|
| **Inferencing** | **Inferencing** |
| [qtimlsnpe](https://docs.qualcomm.com/doc/80-70015-50/topic/qtimlsnpe.html) |
- Loads the 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
inference results on its source pad.
|
| **Postprocessing** | **Postprocessing** |
| [qtimlvclassification](https://docs.qualcomm.com/doc/80-70015-50/topic/qtimlvclassification.html) |
- Receives the inference tensors from a classification model
on its sinkpad.
- Converts the tensors into formats such as video or text that
the multimedia plugins can process later.
- Applies the threshold to the chosen number of results.
- Loads the corresponding modules of the classification
models. In this use case, qtimlvclassification does the
following:
- Loads the submodule of the model.
- Produces results as video frames with classification
labels.
- Sends them to the sinkpad of qtimetamux.
|
| [qtimetamux](https://docs.qualcomm.com/doc/80-70015-50/topic/qtimetamux.html) |
- Receives the video and text streams with the classification
results corresponding to the video stream on its
sinkpads.
- Produces GST buffers with the contents of the video stream
on its sink pad.
- Adds classification result from the data sinkpad to GST
buffer meta (meta muxing) on its source pad.
|
| [qtioverlay](https://docs.qualcomm.com/doc/80-70015-50/topic/qtioverlay.html) |
- Receives the multiplexed stream.
- Overlays the classification labels on the VideoFrame using
CL.
- Produces GST buffers with overlays in its source pad.
|
| [v4l2h264enc](https://docs.qualcomm.com/doc/80-70015-50/topic/v4l2h264enc.html) |
- Applies parameters to each frame of the video stream it is
receiving on its sinkpad.
- Encodes it into bitstream and sends it over its
sourcepad.
|
| h264parse | Adds additional information corresponding to the bitstream to
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 machine and
play it on a media player:
`scp root@ target device>:/opt/ directory>` |
## Variant 2: Use qtivcomposer to mix original frame with classification
mask
Run the use
case:
gst-launch-1.0 -e --gst-debug=2 \
qtiqmmfsrc name=camsrc ! video/x-raw\(memory:GBM\),format=NV12,width=1280,height=720,framerate=30/1,compression=ubwc ! queue ! tee name=split \
split. ! queue ! qtivcomposer name=mixer sink_1::position="<30, 30>" sink_1::dimensions="<320, 180>" ! queue ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=5 output-io-mode=5 ! h264parse ! queue ! mp4mux ! queue ! filesink location=/opt/video.mp4 \
split. ! queue ! qtimlvconverter ! queue ! qtimlsnpe delegate=dsp model=/opt/inceptionv3.dlc ! queue ! qtimlvclassification threshold=40.0 results=2 module=mobilenet labels=/opt/classification.labels ! video/x-raw,format=BGRA,width=640,height=360 ! queue ! mixer.Copy to clipboard
To stop the use case, press CTRL + C.
Figure : Pipeline for classification and encode with qtivcomposer

The figure shows the flow of the use case execution:
- Classify scenes from a video stream coming through a camera source.
- Compose classification labels and video stream together using qtivcomposer.
- Encode this stream as an H.264 bitstream.
- Multiplex the stream in an MP4 container and store it as an MP4 file.
The table provides the sequential processing stages of the pipeline execution:
| Process | Description |
| --- | --- |
| Source |
- The video stream is collected from a camera source plugin
and two copies are created:
- One stream is sent to the qtivcomposer 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-70015-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 classification model uses this tensor stream
for inferencing.
|
| **Inferencing** | **Inferencing** |
| [qtimlsnpe](https://docs.qualcomm.com/doc/80-70015-50/topic/qtimlsnpe.html) |
- Loads the 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
inference results on its source pad.
|
| **Postprocessing** | **Postprocessing** |
| [qtimlvclassification](https://docs.qualcomm.com/doc/80-70015-50/topic/qtimlvclassification.html) |
- Receives the inference tensors from a classification model
on its sinkpad.
- Converts the tensors into formats such as video or text that
the multimedia plugins can process later.
- Applies the threshold to the chosen number of results.
- Loads the corresponding modules of the classification
models. In this use case, qtimlvclassification does the
following:
- Loads the submodule of the model.
- Produces results as video frames with classification
labels.
- Sends them to the sinkpad of qtivcomposer.
|
| [qtivcomposer](https://docs.qualcomm.com/doc/80-70015-50/topic/qtivcomposer.html) |
- Receives original video stream and video stream with
classification results on its sinkpads.
- On its sourcepad, produces GST buffers with the contents
composed of video streams from its sinkpads.
|
| [v4l2h264enc](https://docs.qualcomm.com/doc/80-70015-50/topic/v4l2h264enc.html) |
- Applies parameters to each frame of the video stream it is
receiving on its sinkpad.
- Encodes it into bitstream and sends it over its
sourcepad.
|
| h264parse | Adds additional information corresponding to the bitstream to
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 machine and
play it on a media player:
`scp root@ target device>:/opt/ directory>` |
**Parent Topic:** [Qualcomm Neural Processing SDK use cases](https://docs.qualcomm.com/doc/80-70015-50/topic/qualcomm-neural-processing-sdk-use-cases.html)
Last Published: Oct 27, 2025
[Previous Topic
Image classification and display with Neural Processing SDK](https://docs.qualcomm.com/bundle/publicresource/80-70015-50/topics/single-camera-stream-with-image-classification-and-display-with-mobilenet-v1.md) [Next Topic
Object detection and display with Neural Processing SDK](https://docs.qualcomm.com/bundle/publicresource/80-70015-50/topics/single-camera-stream-with-object-detection-and-display-with-mobilenet-v2-ssd.md)