# Efficient data/control flow for ML pipelines Source: [https://docs.qualcomm.com/doc/80-70014-50/topic/efficient-data-control-flow.html](https://docs.qualcomm.com/doc/80-70014-50/topic/efficient-data-control-flow.html) Manage and control the data flow between ML data pipelines that are running inside the docker and native GST services. The following plugins are used to transfer data to and from the docker container: - [qtisocketsrc](https://docs.qualcomm.com/doc/80-70014-50/topic/qtisocketsrc.html): Reads data from the socket file. - [qtisocketsink](https://docs.qualcomm.com/doc/80-70014-50/topic/qtisocketsink.html): Dumps the data in the socket file. The following use cases demonstrate efficient data management using three GST data pipelines. - They enable you to process the data in real time through shared memory or domain sockets. - They allow you to perform a second level of processing. ## Prerequisites Enable docker image. For instructions, see [Containerization](https://docs.qualcomm.com/bundle/publicresource/topics/80-70014-27/platform_software_features.html#sub$containerization). ## Video encode Run the following commands in three separate consoles to execute the pipelines: 1. Pipeline 1: Start the video capture and send the data to a socket. gst-launch-1.0 -e qtisocketsrc socket=/opt/docker/output.sock ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=5 output-io-mode=5 ! h264parse ! mp4mux ! queue ! filesink location=/opt/docker_video.mp4Copy to clipboard 2. Pipeline 2: 1. Run inside docker container. 2. Read from the input socket. 3. Pass the data to an output socket. docker run -v /opt/docker:/opt -v /usr/lib/gstreamer-1.0/libqtisocketsrc.so:/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libqtisocketsrc.so -v /usr/lib/gstreamer-1.0/libqtisocketsink.so:/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libqtisocketsink.so -ti gst-image-kodiak /bin/bash -c "gst-launch-1.0 -e qtisocketsrc socket=/opt/input.sock ! qtisocketsink socket=/opt/output.sock"Copy to clipboard 3. Pipeline 3: 1. Read from the output socket. 2. Encode the video stream data. 3. Save the data to a file. gst-launch-1.0 -e qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc ! qtisocketsink socket=/opt/docker/input.sockCopy to clipboard ## Video transformation Run the following commands in three separate consoles to execute the pipelines: 1. Pipeline 1: 1. Start video capture. 2. Transform the resolution. 3. Send the data to a socket. gst-launch-1.0 -e qtisocketsrc socket=/opt/docker/output.sock ! video/x-raw\(memory:GBM\),format=NV12,width=1280,height=720,framerate=30/1,compression=ubwc,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=5 output-io-mode=5 ! h264parse ! mp4mux ! queue ! filesink location=/opt/docker_video_transformed.mp4Copy to clipboard 2. Pipeline 2: 1. Run inside docker container. 2. Read from the input socket. 3. Pass the data to an output socket. docker run -v /opt/docker:/opt -v /usr/lib/gstreamer-1.0/libqtisocketsrc.so:/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libqtisocketsrc.so -v /usr/lib/gstreamer-1.0/libqtisocketsink.so:/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libqtisocketsink.so -ti gst-image-kodiak /bin/bash -c "gst-launch-1.0 -e qtisocketsrc socket=/opt/input.sock ! qtisocketsink socket=/opt/output.sock"Copy to clipboard 3. Pipeline 3: 1. Read from the output socket. 2. Encode the video stream data. 3. Save the data to a file. export XDG_RUNTIME_DIR=/dev/socket/weston && export WAYLAND_DISPLAY=wayland-1Copy to clipboard gst-launch-1.0 -e qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc ! queue ! qtivtransform ! video/x-raw\(memory:GBM\),format=NV12,width=1280,height=720,framerate=30/1 ! queue ! qtisocketsink socket=/opt/docker/input.sockCopy to clipboard ## Object detection Run the following commands in three separate consoles to execute the pipelines: 1. Pipeline 1: 1. Start video capture. 2. Perform object detection. 3. Use [qtioverlay](https://docs.qualcomm.com/doc/80-70014-50/topic/qtioverlay.html) to apply bounding boxes over video. 4. Send the data to a socket. gst-launch-1.0 -e qtisocketsrc socket=/opt/docker/output.sock ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=5 output-io-mode=5 ! h264parse ! mp4mux ! queue ! filesink location=/opt/docker_video_detect.mp4Copy to clipboard 2. Pipeline 2: 1. Run inside docker container. 2. Read from the input socket. 3. Pass the data to an output socket. docker run -v /opt/docker:/opt -v /usr/lib/gstreamer-1.0/libqtisocketsrc.so:/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libqtisocketsrc.so -v /usr/lib/gstreamer-1.0/libqtisocketsink.so:/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libqtisocketsink.so -ti gst-image-kodiak /bin/bash -c "gst-launch-1.0 -e qtisocketsrc socket=/opt/input.sock ! qtisocketsink socket=/opt/output.sock"Copy to clipboard 3. Pipeline 3: 1. Read from the output socket. 2. Encode the video stream data. 3. Save the data to a file. export XDG_RUNTIME_DIR=/dev/socket/weston && export WAYLAND_DISPLAY=wayland-1Copy to clipboard gst-launch-1.0 -e qtiqmmfsrc ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc ! queue ! tee name=split ! queue ! qtimetamux name=metamux ! queue ! qtioverlay ! queue ! qtisocketsink socket=/opt/docker/input.sock split. ! queue ! qtimlvconverter ! queue ! qtimltflite delegate=gpu model=/opt/yolov5m-320x320-int8.tflite ! queue ! qtimlvdetection threshold=45.0 results=10 module=yolov5 labels=/opt/yolov5m.labels constants="YoloV5,q-offsets=<3.0>,q-scales=<0.005047998391091824>;" ! text/x-raw ! queue ! metamux.Copy to clipboard **Parent Topic:** [Multimedia use cases](https://docs.qualcomm.com/doc/80-70014-50/topic/multimedia-use-cases.html) Last Published: Oct 27, 2025 [Previous Topic Single camera stream and socket use case](https://docs.qualcomm.com/bundle/publicresource/80-70014-50/topics/socketsrc-and-socketsink-use-case.md) [Next Topic GStreamer daemon](https://docs.qualcomm.com/bundle/publicresource/80-70014-50/topics/gstreamer-daemon.md)