# Image segmentation and encode with Neural Processing SDK
Source: [https://docs.qualcomm.com/doc/80-80020-50/topic/single-camera-stream-with-image-segmentation-and-encode-with-deeplabv3-quantized.html](https://docs.qualcomm.com/doc/80-80020-50/topic/single-camera-stream-with-image-segmentation-and-encode-with-deeplabv3-quantized.html)
The use case implements the DeepLab v3 model with the Qualcomm Neural Processing SDK
runtime. The use case is to compose the semantic segmentations and original video stream,
encode this stream, and then multiplex it in an MP4 container.
Note: For Ubuntu Server, `sudo` access is necessary to
write the encoded stream to the `/etc/media` folder.
Run the use case on the target
device:
gst-launch-1.0 -e --gst-debug=2 \
filesrc location=/etc/media/video.mp4 ! qtdemux ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! queue ! tee name=split \
split. ! queue ! qtivcomposer name=mixer sink_1::dimensions="<1920,1080>" sink_1::alpha=0.5 ! 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/deeplabv3_plus_mobilenet.dlc ! queue ! \
qtimlpostprocess module=deeplab-argmax labels=/etc/labels/deeplabv3_resnet50.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 scenes from a video stream coming through a file source.
2. Compose semantic segmentation and video stream using qtivcomposer.
3. Encode the stream as an H.264 bit stream and multiplex the stream in an MP4
container.
Figure : Pipeline for image segmentation and encode with qtivcomposer
The following table provides the sequential processing stages of the pipeline
execution:
| Process | Description |
| --- | --- |
| File source: filesrc |
Captures the video stream using filesrc, followed by qtdemux, which demultiplexes the stream.
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 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@ device>:/etc/media/video.mp4 directory>` |
**Parent Topic:** [Qualcomm Neural Processing SDK use cases](https://docs.qualcomm.com/doc/80-80020-50/topic/qualcomm-neural-processing-sdk-use-cases.html)
Last Published: Mar 02, 2026
[Previous Topic
Image segmentation and display with Neural Processing SDK](https://docs.qualcomm.com/bundle/publicresource/80-80020-50/topics/single-camera-stream-with-image-segmentation-and-display-with-deeplabv3-quantized.md) [Next Topic
Custom Gstreamer pipeline use cases](https://docs.qualcomm.com/bundle/publicresource/80-80020-50/topics/custom-gstreamer-pipeline-use-cases.md)