# Pose estimation and encode with LiteRT The use cases implement the HRNet LiteRT model to process a single camera stream with pose estimation and encode the stream as an H.264 bitstream. ## Use qtivoverlay plugin to apply pose estimation overlay Run the use case on the target device: gst-launch-1.0 -e \ qtiqmmfsrc name=camsrc ! video/x-raw,format=NV12,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/output_video.mp4 \ split. ! queue ! qtimlvconverter ! queue ! qtimltflite delegate=external external-delegate-path=libQnnTFLiteDelegate.so \ external-delegate-options="QNNExternalDelegate,backend_type=htp;" model=/etc/models/hrnet_pose_quantized.tflite ! queue ! \ qtimlpostprocess results=2 module=hrnet labels=/etc/labels/hrnet.json settings=/etc/labels/hrnet_settings.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 poses of people in the scenes from the video stream coming through the camera source. 2. Overlay the available poses using overlaylib. 3. Encode the stream as an H.264 bitstream. 4. Multiplex the stream in an MP4 container and store it as an MP4 file. **Figure : Pipeline for pose estimation and encode using qtivoverlay** The following table provides the sequential processing stages of the pipeline execution: | Process | Description | | --- | --- | | [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-80021-50/topic/qtiqmmfsrc.html) |
Collects the video stream (source) and creates two copies of the source:
One stream is sent to the qtimetamux plugin to retain the video stream.
The other stream is sent to an ML inferencing pipeline.
Receives the video stream on its sink pad.
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 HRNet model uses this tensor stream for inferencing.
Loads the HRNet 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 pose estimation results on its source pad.
Receives the inference tensors from a HRNet 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 pose estimation models.
In this use case, qtimlpostprocess does the following:
Loads the HRNet submodule.
Produces results as structures of text.
Sends them to the sinkpad of qtimetamux.
Receives the video stream and text stream with pose results corresponding to video stream on its sinkpads.
Produces GST buffers with the contents of video stream on its sink pad.
Adds poses from data sinkpad to GST buffer meta (meta muxing) on its source pad.
Receives the multiplexed stream.
Overlays the poses on the VideoFrame using CL.
Produces GST buffers with overlays in its source pad.
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.
Collects the video stream (source) and creates two copies of the source:
One stream is sent to the qtivcomposer plugin to retain the video stream.
The other stream is sent to an ML inferencing pipeline.
Receives the video stream on its sink pad.
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 HRNet model uses this tensor stream for inferencing.
Loads the HRNet 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 pose estimation results on its source pad.
Receives the inference tensors from a HRNet 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 pose estimation models.
In this use case, qtimlpostprocess does the following:
Loads the HRNet submodule.
Produces results as video frames with poses drawn.
Sends them to the sinkpad of the qtivcomposer.
Receives the original video stream and video stream of poses on its sinkpads.
On its sourcepad, produces the GST buffers with the contents composed of video streams from its sinkpads.
Receives the multiplexed stream.
Overlays the poses on the VideoFrame using CL.
Produces GST buffers with overlays in its source pad.
Applies parameters to each frame of the video stream that it's receiving on its sinkpad.
Encodes it into bitstream and sends it over its sourcepad.