# 运行本地用例

Source: [https://docs.qualcomm.com/doc/80-70022-50SC/topic/local-use-cases.html](https://docs.qualcomm.com/doc/80-70022-50SC/topic/local-use-cases.html)

使用运行在同一处理器上的控制应用控制 GStD 框架。

## 前提条件

激活显示器：

    vi /etc/default/gstd
         OPTARGS=" -a 0.0.0.0"
    
         XDG_RUNTIME_DIR=/dev/socket/weston
    
         WAYLAND_DISPLAY=wayland-1
    
    systemctl daemon-reload
    systemctl restart gstdCopy to clipboard

## 单流编码

1. 创建 pipeline：

        gst-client-1.0 pipeline_create enc1 qtiqmmfsrc name=camsrc ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=4 output-io-mode=5 ! h264parse ! queue ! mp4mux ! queue ! filesink location=/tmp/enc1.mp4Copy to clipboard
2. 控制 pipeline：

        gst-client-1.0 pipeline_play enc1Copy to clipboard

    - 发送 EOS：

            gst-client-1.0 event_eos enc1Copy to clipboard
    - 停止 pipeline：

            gst-client-1.0 pipeline_stop enc1Copy to clipboard

## 多流编码

1. 创建 pipeline：

        gst-client-1.0 pipeline_create enc2 qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=4 output-io-mode=5 ! queue ! h264parse ! mp4mux ! queue ! filesink location="/tmp/mux1.mp4" \ camsrc. ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=4 output-io-mode=5 ! queue ! h264parse ! mp4mux ! queue ! filesink location="/tmp/mux2.mp4"Copy to clipboard
2. 控制 pipeline：

        gst-client-1.0 pipeline_play enc2Copy to clipboard

    - 发送 EOS：

            gst-client-1.0 event_eos enc2Copy to clipboard
    - 停止 pipeline：

            gst-client-1.0 pipeline_stop enc2Copy to clipboard

## 单显示器

1. 创建 pipeline：

        gst-client-1.0 pipeline_create dis1 qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! waylandsink fullscreen=true async=true sync=falseCopy to clipboard
2. 控制 pipeline：
    - 播放 pipeline：

            gst-client-1.0 pipeline_play dis1Copy to clipboard
    - 暂停 pipeline：

            gst-client-1.0 pipeline_pause dis1Copy to clipboard
    - 停止 pipeline：

            gst-client-1.0 pipeline_stop dis1Copy to clipboard

## 多显示器

1. 创建 pipeline：

        gst-client-1.0 pipeline_create dis2 qtiqmmfsrc name=camsrc video_0::type=preview ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! waylandsink x=0 y=0 width=500 height=400 async=true sync=false camsrc. ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! waylandsink x=510 y=0 width=500 height=400 async=true sync=falseCopy to clipboard
2. 控制 pipeline：
    - 播放 pipeline：

            gst-client-1.0 pipeline_play dis2Copy to clipboard
    - 暂停 pipeline：

            gst-client-1.0 pipeline_pause dis2Copy to clipboard
    - 停止 pipeline：

            gst-client-1.0 pipeline_stop dis2Copy to clipboard

**Parent Topic:** [GStD 框架](https://docs.qualcomm.com/doc/80-70022-50SC/topic/gstreamer-daemon.html)

Last Published: Nov 05, 2025

[Previous Topic
GStD 框架](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/gstreamer-daemon.md) [Next Topic
运行 TCP 用例](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/tcp-use-cases.md)