# 智能 codec

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

**gst-smartcodec-example** 应用程序根据场景变化估计阈值减少带宽和存储资源。

智能 codec 插件 [qtismartvencbin](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtismartvencbin.html) 使用智能 fps、智能 I 帧、智能码率和智能 ROI 来执行以下操作：

- 在不降低质量的前提下降低码率。
- 实现网络和存储资源的高效利用。

下图显示了双流用例的 pipeline 流。关于更多详细信息，请参阅 [Pipeline 流](https://docs.qualcomm.com/doc/80-70022-50SC/topic/smart-codec.html#smart-codec__section_rcj_tl2_ncc)。

Figure : 双流 gst-smartcodec-example pipeline
            
            <!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->

<!-- Generated by Microsoft Visio, SVG Export gst_smartcodec_example_pipeline_twostreams.svg Layer_1 -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="10.9999in" height="2.20896in" viewbox="0 0 791.996 159.045" xml:space="preserve" color-interpolation-filters="sRGB" class="st14"><v:documentproperties v:langid="1033" v:viewmarkup="false"></v:documentproperties>
<style>.svg-1 .st1 { fill: #fafafa; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st2 { fill: #d2d7e1; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st3 { fill: #2a2aea; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st4 { fill: #ffffff; font-family: Roboto; font-size: 1.00001em }
.svg-1 .st5 { fill: none }
.svg-1 .st6 { stroke: #000000; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st7 { fill: #000000; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st8 { fill: #007884; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st9 { fill: #ffffff; font-family: SimHei; font-size: 1.00001em }
.svg-1 .st10 { font-family: Roboto; font-size: 1em }
.svg-1 .st11 { fill: none; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st12 { fill: #000000; font-family: Roboto; font-size: 0.874992em }
.svg-1 .st13 { fill: #000000; font-family: SimHei; font-size: 0.874992em }
.svg-1 .st14 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<g v:mid="0" v:index="1" v:groupcontext="foregroundPage">	<title>Layer_1</title>	<v:pageproperties v:drawingscale="1" v:pagescale="1" v:drawingunits="19" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<g id="shape2-1" v:mid="2" v:groupcontext="shape" transform="translate(0.374931,-0.37532)">		<title>Sheet.2</title>		<path d="M0 153.42 A5.62513 5.62513 -180 0 0 5.62 159.05 L785.62 159.05 A5.62513 5.62513 -180 0 0 791.25 153.42 L791.25					 6.38 A5.62513 5.62513 -180 0 0 785.62 0.75 L5.62 0.75 A5.62513 5.62513 -180 0 0 0 6.38 L0 153.42 Z" class="st1"></path>	</g>	<g id="shape3-3" v:mid="3" v:groupcontext="shape">		<title>Sheet.3</title>		<path d="M786 0.75 C788.89 0.75 791.25 3.11 791.25 6 L791.25 153.05 C791.25 155.94 788.89 158.3 786 158.3 L6 158.3 C3.11					 158.3 0.75 155.94 0.75 153.05 L0.75 6 C0.75 3.11 3.11 0.75 6 0.75 L786 0.75 ZM786 0 L6 0 C2.69 0 0 2.69					 0 6 L0 153.05 C0 156.36 2.69 159.05 6 159.05 L786 159.05 C789.31 159.05 792 156.36 792 153.05 L792 6 C792					 2.69 789.31 0 786 0 Z" class="st2"></path>	</g>	<g id="shape5-5" v:mid="5" v:groupcontext="shape" transform="translate(15,-70.3504)">		<title>Sheet.5</title>		<desc>qtiqmmfsrc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="136.545" width="90.01" height="45"></v:textrect>		<path d="M0 156.05 A3.00007 3.00007 -180 0 0 3 159.05 L87 159.05 A3.00007 3.00007 -180 0 0 90 156.05 L90 117.05 A3.00007					 3.00007 -180 0 0 87 114.05 L3 114.05 A3.00007 3.00007 -180 0 0 -0 117.05 L0 156.05 Z" class="st3"></path>		<text x="13.9" y="140.15" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtiqmmfsrc</text>		</g>	<g id="group7-8" transform="translate(113.639,-61.5083)" v:mid="7" v:groupcontext="group">		<title>Sheet.7</title>		<g id="shape8-9" v:mid="8" v:groupcontext="shape" transform="translate(1.15907E-13,-2.99178)">			<title>Sheet.8</title>			<path d="M10.69 159.05 L0 159.05 L0 102.34 L10.69 102.34 L10.69 159.05 Z" class="st5"></path>			<path d="M10.69 159.05 L0 159.05 L0 102.34 L10.69 102.34" class="st6"></path>		</g>		<g id="shape9-12" v:mid="9" v:groupcontext="shape" transform="translate(9.81887,2.84217E-14)">			<title>Sheet.9</title>			<path d="M0 153.06 L5.18 156.05 L0 159.05 L0 153.06 Z" class="st7"></path>		</g>		<g id="shape10-14" v:mid="10" v:groupcontext="shape" transform="translate(9.81887,-56.7006)">			<title>Sheet.10</title>			<path d="M0 159.05 L5.18 156.05 L0 153.06 L0 159.05 Z" class="st7"></path>		</g>	</g>	<g id="shape11-16" v:mid="11" v:groupcontext="shape" transform="translate(129.199,-42.0001)">		<title>Sheet.11</title>		<desc>capsfilter</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="136.545" width="90.01" height="45"></v:textrect>		<path d="M0 156.05 A3.00007 3.00007 -180 0 0 3 159.05 L87 159.05 A3.00007 3.00007 -180 0 0 90 156.05 L90 117.05 A3.00007					 3.00007 -180 0 0 87 114.05 L3 114.05 A3.00007 3.00007 -180 0 0 -0 117.05 L0 156.05 Z" class="st8"></path>		<text x="19.97" y="140.15" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>capsfilter</text>		</g>	<g id="group13-19" transform="translate(219.199,-61.8822)" v:mid="13" v:groupcontext="group">		<title>Sheet.13</title>		<g id="shape14-20" v:mid="14" v:groupcontext="shape" transform="translate(0,-2.61781)">			<title>Sheet.14</title>			<path d="M0 159.05 L11.23 159.05" class="st6"></path>		</g>		<g id="shape15-23" v:mid="15" v:groupcontext="shape" transform="translate(10.4665,0)">			<title>Sheet.15</title>			<path d="M0 159.05 L4.53 156.43 L0 153.81 L0 159.05 Z" class="st7"></path>		</g>	</g>	<g id="shape16-25" v:mid="16" v:groupcontext="shape" transform="translate(234.758,-42.0001)">		<title>Sheet.16</title>		<desc>接收端口 (qtismartvencabin)</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="136.545" width="120" height="45"></v:textrect>		<path d="M0 156.05 A3.00007 3.00007 -180 0 0 3 159.05 L117 159.05 A3.00007 3.00007 -180 0 0 120 156.05 L120 117.05 A3.00007					 3.00007 -180 0 0 117 114.05 L3 114.05 A3.00007 3.00007 -180 0 0 -0 117.05 L0 156.05 Z" class="st3"></path>		<text x="36" y="133.34" class="st9" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>接收端口<v:newlinechar></v:newlinechar><tspan x="9.5" dy="1.233em" class="st10">(qtismartvencabin)</tspan></text>		</g>	<g id="group18-29" transform="translate(354.758,-61.8822)" v:mid="18" v:groupcontext="group">		<title>Sheet.18</title>		<g id="shape19-30" v:mid="19" v:groupcontext="shape" transform="translate(0,-2.61781)">			<title>Sheet.19</title>			<path d="M0 159.05 L11.23 159.05" class="st6"></path>		</g>		<g id="shape20-33" v:mid="20" v:groupcontext="shape" transform="translate(10.4665,0)">			<title>Sheet.20</title>			<path d="M0 159.05 L4.53 156.43 L0 153.81 L0 159.05 Z" class="st7"></path>		</g>	</g>	<g id="shape21-35" v:mid="21" v:groupcontext="shape" transform="translate(370.318,-42.0001)">		<title>Sheet.21</title>		<desc>v4l2h264enc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="136.545" width="90" height="45"></v:textrect>		<path d="M0 156.05 A3.00007 3.00007 -180 0 0 3 159.05 L87 159.05 A3.00007 3.00007 -180 0 0 90 156.05 L90 117.05 A3.00007					 3.00007 -180 0 0 87 114.05 L3 114.05 A3.00007 3.00007 -180 0 0 -0 117.05 L0 156.05 Z" class="st8"></path>		<text x="10.86" y="140.15" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>v4l2h264enc</text>		</g>	<g id="group23-38" transform="translate(460.318,-61.8822)" v:mid="23" v:groupcontext="group">		<title>Sheet.23</title>		<g id="shape24-39" v:mid="24" v:groupcontext="shape" transform="translate(0,-2.61781)">			<title>Sheet.24</title>			<path d="M0 159.05 L11.23 159.05" class="st6"></path>		</g>		<g id="shape25-42" v:mid="25" v:groupcontext="shape" transform="translate(10.4665,0)">			<title>Sheet.25</title>			<path d="M0 159.05 L4.53 156.43 L0 153.81 L0 159.05 Z" class="st7"></path>		</g>	</g>	<g id="shape26-44" v:mid="26" v:groupcontext="shape" transform="translate(475.877,-42.0001)">		<title>Sheet.26</title>		<desc>h264parse</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="136.545" width="90.01" height="45"></v:textrect>		<path d="M0 156.05 A3.00007 3.00007 -180 0 0 3 159.05 L87 159.05 A3.00007 3.00007 -180 0 0 90 156.05 L90 117.05 A3.00007					 3.00007 -180 0 0 87 114.05 L3 114.05 A3.00007 3.00007 -180 0 0 -0 117.05 L0 156.05 Z" class="st8"></path>		<text x="16.65" y="140.15" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>h264parse</text>		</g>	<g id="group28-47" transform="translate(565.877,-61.8822)" v:mid="28" v:groupcontext="group">		<title>Sheet.28</title>		<g id="shape29-48" v:mid="29" v:groupcontext="shape" transform="translate(0,-2.61781)">			<title>Sheet.29</title>			<path d="M0 159.05 L11.23 159.05" class="st6"></path>		</g>		<g id="shape30-51" v:mid="30" v:groupcontext="shape" transform="translate(10.4665,0)">			<title>Sheet.30</title>			<path d="M0 159.05 L4.53 156.43 L0 153.81 L0 159.05 Z" class="st7"></path>		</g>	</g>	<g id="shape31-53" v:mid="31" v:groupcontext="shape" transform="translate(581.437,-42.0001)">		<title>Sheet.31</title>		<desc>mp4mux</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="136.545" width="90.01" height="45"></v:textrect>		<path d="M0 156.05 A3.00007 3.00007 -180 0 0 3 159.05 L87 159.05 A3.00007 3.00007 -180 0 0 90 156.05 L90 117.05 A3.00007					 3.00007 -180 0 0 87 114.05 L3 114.05 A3.00007 3.00007 -180 0 0 -0 117.05 L0 156.05 Z" class="st8"></path>		<text x="21.47" y="140.15" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>mp4mux</text>		</g>	<g id="group33-56" transform="translate(671.437,-61.8822)" v:mid="33" v:groupcontext="group">		<title>Sheet.33</title>		<g id="shape34-57" v:mid="34" v:groupcontext="shape" transform="translate(0,-2.61781)">			<title>Sheet.34</title>			<path d="M0 159.05 L11.23 159.05" class="st6"></path>		</g>		<g id="shape35-60" v:mid="35" v:groupcontext="shape" transform="translate(10.4665,0)">			<title>Sheet.35</title>			<path d="M0 159.05 L4.53 156.43 L0 153.81 L0 159.05 Z" class="st7"></path>		</g>	</g>	<g id="shape36-62" v:mid="36" v:groupcontext="shape" transform="translate(686.996,-42.0001)">		<title>Sheet.36</title>		<desc>filesink</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="136.545" width="90" height="45"></v:textrect>		<path d="M0 156.05 A3.00007 3.00007 -180 0 0 3 159.05 L87 159.05 A3.00007 3.00007 -180 0 0 90 156.05 L90 117.05 A3.00007					 3.00007 -180 0 0 87 114.05 L3 114.05 A3.00007 3.00007 -180 0 0 0 117.05 L0 156.05 Z" class="st8"></path>		<text x="25.92" y="140.15" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>filesink</text>		</g>	<g id="shape38-65" v:mid="38" v:groupcontext="shape" transform="translate(129.199,-99.0454)">		<title>Sheet.38</title>		<desc>capsfilter</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="136.545" width="90.01" height="45"></v:textrect>		<path d="M0 156.05 A3.00007 3.00007 -180 0 0 3 159.05 L87 159.05 A3.00007 3.00007 -180 0 0 90 156.05 L90 117.05 A3.00007					 3.00007 -180 0 0 87 114.05 L3 114.05 A3.00007 3.00007 -180 0 0 -0 117.05 L0 156.05 Z" class="st8"></path>		<text x="19.97" y="140.15" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>capsfilter</text>		</g>	<g id="group40-68" transform="translate(219.199,-118.928)" v:mid="40" v:groupcontext="group">		<title>Sheet.40</title>		<g id="shape41-69" v:mid="41" v:groupcontext="shape" transform="translate(0,-2.61781)">			<title>Sheet.41</title>			<path d="M0 159.05 L11.23 159.05" class="st6"></path>		</g>		<g id="shape42-72" v:mid="42" v:groupcontext="shape" transform="translate(10.4665,0)">			<title>Sheet.42</title>			<path d="M0 159.05 L4.53 156.43 L0 153.81 L0 159.05 Z" class="st7"></path>		</g>	</g>	<g id="shape43-74" v:mid="43" v:groupcontext="shape" transform="translate(234.758,-99.0454)">		<title>Sheet.43</title>		<desc>接收端口 (qtismartvencabin)</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="136.545" width="120" height="45"></v:textrect>		<path d="M0 156.05 A3.00007 3.00007 -180 0 0 3 159.05 L117 159.05 A3.00007 3.00007 -180 0 0 120 156.05 L120 117.05 A3.00007					 3.00007 -180 0 0 117 114.05 L3 114.05 A3.00007 3.00007 -180 0 0 -0 117.05 L0 156.05 Z" class="st3"></path>		<text x="36" y="133.34" class="st9" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>接收端口<v:newlinechar></v:newlinechar><tspan x="9.5" dy="1.233em" class="st10">(qtismartvencabin)</tspan></text>		</g>	<g id="shape45-78" v:mid="45" v:groupcontext="shape" transform="translate(113.639,225.24) rotate(180)">		<title>Sheet.45</title>		<path d="M0 159.05 L8.64 159.05" class="st6"></path>	</g>	<g id="group53-81" transform="translate(666.872,-14.7814)" v:mid="53" v:groupcontext="group">		<title>Sheet.53</title>		<g id="shape48-82" v:mid="48" v:groupcontext="shape" transform="translate(15.1883,0)">			<title>Sheet.48</title>			<desc>Qualcomm</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="26.0912" cy="152.745" width="52.19" height="12.6"></v:textrect>			<rect x="0" y="146.445" width="52.1825" height="12.6" class="st11"></rect>			<text x="0" y="155.9" class="st12" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>Qualcomm  </text>			</g>		<g id="shape49-85" v:mid="49" v:groupcontext="shape" transform="translate(-9.99201E-16,-0.218624)">			<title>Sheet.49</title>			<path d="M0 157.55 A1.50003 1.50003 -180 0 0 1.5 159.05 L10.5 159.05 A1.50003 1.50003 -180 0 0 12 157.55 L12 148.55						 A1.50003 1.50003 -180 0 0 10.5 147.05 L1.5 147.05 A1.50003 1.50003 -180 0 0 0 148.55 L0 157.55 Z" class="st3"></path>		</g>		<g id="shape51-87" v:mid="51" v:groupcontext="shape" transform="translate(89.1246,0)">			<title>Sheet.51</title>			<desc>开源</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="10.5" cy="152.745" width="21" height="12.6"></v:textrect>			<rect x="0" y="146.445" width="21" height="12.6" class="st11"></rect>			<text x="-0" y="156.24" class="st13" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>开源</text>			</g>		<g id="shape52-90" v:mid="52" v:groupcontext="shape" transform="translate(73.9363,-0.218624)">			<title>Sheet.52</title>			<path d="M0 157.55 A1.50003 1.50003 -180 0 0 1.5 159.05 L10.5 159.05 A1.50003 1.50003 -180 0 0 12 157.55 L12 148.55						 A1.50003 1.50003 -180 0 0 10.5 147.05 L1.5 147.05 A1.50003 1.50003 -180 0 0 0 148.55 L0 157.55 Z" class="st8"></path>		</g>	</g></g>
</svg>

## 运行应用程序

1. 确保您已完成[前提条件](https://docs.qualcomm.com/doc/80-70022-50SC/topic/mm_sample_apps_prerequisites.html)。
2. 要从主机访问目标设备，请设置 SSH。相关操作步骤，请参阅 [使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70022-254/how_to.html#use-ssh)。
3. 在主机的终端中，输入 SSH shell 以：
    - 运行用例：

            ssh root@<ip-addr of the target device>Copy to clipboard
    - 从主机推送文件：

            scp <filename> root@<IP address of target device>:/etc/media/Copy to clipboard
4. 在目标设备的终端中，使用摄像头源运行用例：

        gst-smartcodec-example -w 1920 -h 1080 -o video.mp4Copy to clipboard
5. 要停止用例，请使用 CTRL +
                    C。
6. 在目标设备的终端中，在 SSH shell 中运行以下命令以显示可用的帮助选项：

        gst-smartcodec-example --helpCopy to clipboard

## 预期输出

该应用程序生成一个编码后的 MP4 文件作为输出。

下表列出了使用和不使用智能 codec 的分辨率为 1080p 的视频文件大小。

Table : 智能 codec - 文件大小

| 智能 codec | 文件大小 |
| :--- | :--- |
| 启用 | 3718 KB |
| 禁用 | 17706 KB |

## Pipeline 流

下表列出了智能 codec pipeline 中使用的插件：

| 插件 | 说明 |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtiqmmfsrc.html) | <ol class="ol" id="smart-codec__ol_jln_dm2_ncc"><br>                                    <li class="li">采集视频流。</li><br><br>                                    <li class="li">将流送至 capsfilter。</li><br><br>                                </ol> |
| Capsfilter | 将源分支为两个单独的 pipeline。在一个 pipeline 中，[qtismartvencbin](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtismartvencbin.html) 处理输出。 |
| Capsfilter | 在另一个 pipeline 中，视频将经历以下操作：<ol class="ol" id="smart-codec__ol_lmr_dly_nbc"><br>                                    <li class="li">使用 <a href="https://docs.qualcomm.com/doc/80-70022-50SC/topic/v4l2h264enc.html">v4l2h264enc</a> 编码。</li><br><br>                                    <li class="li">用 h264parse 渲染。</li><br><br>                                    <li class="li">使用 mp4mux 复用成 MP4 格式。</li><br><br>                                    <li class="li">使用 filesink 写入文件。</li><br><br>                                </ol> |
|  |  |

## 相关信息

[AI 智能 codec](https://docs.qualcomm.com/doc/80-70022-50SC/topic/ai-smart-codec.html)

**Parent Topic:** [运行视频和音频的示例应用程序](https://docs.qualcomm.com/doc/80-70022-50SC/topic/audio-sample-applications.html)

Last Published: Nov 05, 2025

[Previous Topic
视频墙](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/gst-concurrent-videoplay-composition.md) [Next Topic
多格式解码](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/gst-videocodec-concurrent-playback.md)