# 音频和视频编码

Source: [https://docs.qualcomm.com/doc/80-70022-50SC/topic/gst-audio-video-encode.html](https://docs.qualcomm.com/doc/80-70022-50SC/topic/gst-audio-video-encode.html)

**gst-audio-video-encode** 应用程序对音频和视频数据进行编码，这些数据存储在用户指定的输出文件中。该应用程序的一些用例包括流服务、视频会议和监控系统。

下图展示了接收视频和音频源、编码和解析视频流的 pipeline。然后，它采集音频流并将其编码为 MP3 格式。两个流都是复用的，并写入一个文件。

有关 pipeline 中使用的插件的信息，请参见 [Pipeline 流](https://docs.qualcomm.com/doc/80-70022-50SC/topic/gst-audio-video-encode.html#gst-audio-video-encode__section_mj1_yfn_4bc)。

Figure : gst-audio-video-encode pipeline
            
            <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by Microsoft Visio, SVG Export gst_audio_video_encode.svg Layer_2 -->
<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="13.4304in" height="4.21947in" viewbox="0 0 966.988 303.802" xml:space="preserve" color-interpolation-filters="sRGB" class="st19"><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: none; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st4 { fill: #000000; font-family: SimHei; font-size: 1.00001em }
.svg-1 .st5 { font-size: 1em }
.svg-1 .st6 { font-family: Roboto; font-size: 1em }
.svg-1 .st7 { fill: #000000; font-family: Roboto; font-size: 1.00001em }
.svg-1 .st8 { font-family: SimHei; font-size: 1em }
.svg-1 .st9 { fill: #2a2aea; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st10 { fill: #ffffff; font-family: SimHei; font-size: 1.00001em }
.svg-1 .st11 { stroke: #000000; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st12 { fill: #000000; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st13 { fill: #007884; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st14 { fill: #ffffff; font-family: Roboto; font-size: 1.00001em }
.svg-1 .st15 { fill: none }
.svg-1 .st16 { stroke: #ffffff; stroke-linecap: butt; stroke-width: 2.25 }
.svg-1 .st17 { fill: #000000; font-family: Roboto; font-size: 0.874992em }
.svg-1 .st18 { fill: #000000; font-family: SimHei; font-size: 0.874992em }
.svg-1 .st19 { 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_2</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.375183,-0.37532)">		<title>Sheet.2</title>		<path d="M0 298.18 A5.62513 5.62513 -180 0 0 5.62 303.8 L960.61 303.8 A5.62513 5.62513 -180 0 0 966.24 298.18 L966.24					 6.38 A5.62513 5.62513 -180 0 0 960.61 0.75 L5.62 0.75 A5.62513 5.62513 -180 0 0 0 6.38 L0 298.18 Z" class="st1"></path>	</g>	<g id="shape3-3" v:mid="3" v:groupcontext="shape">		<title>Sheet.3</title>		<path d="M960.99 0.75 C963.88 0.75 966.24 3.11 966.24 6 L966.24 297.8 C966.24 300.7 963.88 303.05 960.99 303.05 L6 303.05					 C3.11 303.05 0.75 300.7 0.75 297.8 L0.75 6 C0.75 3.11 3.11 0.75 6 0.75 L960.99 0.75 ZM960.99 0 L6 0 C2.69					 0 0 2.69 0 6 L0 297.8 C0 301.12 2.69 303.8 6 303.8 L960.99 303.8 C964.3 303.8 966.99 301.12 966.99 297.8					 L966.99 6 C966.99 2.69 964.3 0 960.99 0 Z" class="st2"></path>	</g>	<g id="shape5-5" v:mid="5" v:groupcontext="shape" transform="translate(9,-102.45)">		<title>Sheet.5</title>		<desc>宽度 高度 output_file input_videocodec</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="47.25" cy="270.52" width="94.5" height="66.5641"></v:textrect>		<rect x="0" y="237.238" width="94.5" height="66.5641" class="st3"></rect>		<text x="70.5" y="252.13" class="st4" v:langid="1033"><v:paragraph v:horizalign="2"></v:paragraph><v:tablist></v:tablist>宽度<v:newlinechar></v:newlinechar><tspan x="70.5" dy="1.331em" class="st5">高度<v:newlinechar></v:newlinechar></tspan><tspan x="38.09" dy="1.233em" class="st6">output_file<v:newlinechar></v:newlinechar></tspan><tspan x="1.06" dy="1.2em" class="st6">input_videocodec</tspan></text>		</g>	<g id="shape6-11" v:mid="6" v:groupcontext="shape" transform="translate(907.5,-145.272)">		<title>Sheet.6</title>		<desc>MP4 编码文件</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="25.5" cy="288.427" width="51.01" height="30.7501"></v:textrect>		<rect x="0" y="273.052" width="51" height="30.7501" class="st3"></rect>		<text x="0" y="284.04" class="st7" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>MP4 <tspan x="0" dy="1.298em" class="st8">编码文件</tspan></text>		</g>	<g id="shape8-15" v:mid="8" v:groupcontext="shape" transform="translate(147.014,-177.041)">		<title>Sheet.8</title>		<desc>媒体采集</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st9"></path>		<text x="21" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>媒体采集</text>		</g>	<g id="shape10-18" v:mid="10" v:groupcontext="shape" transform="translate(147.303,-223.839)">		<title>Sheet.10</title>		<desc>qtiqmmfsrc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="44.8555" cy="296.602" width="89.72" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="89.711" height="14.4" class="st3"></rect>		<text x="13.75" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtiqmmfsrc</text>		</g>	<g id="group11-21" transform="translate(237.014,-196.549)" v:mid="11" v:groupcontext="group">		<title>Sheet.11</title>		<g id="shape12-22" v:mid="12" v:groupcontext="shape" transform="translate(0,-2.99179)">			<title>Sheet.12</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape13-25" v:mid="13" v:groupcontext="shape" transform="translate(9.81887,0)">			<title>Sheet.13</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="shape14-27" v:mid="14" v:groupcontext="shape" transform="translate(341.932,-199.541)">		<title>Sheet.14</title>		<path d="M0 303.8 L8.37 303.8" class="st11"></path>	</g>	<g id="shape15-30" v:mid="15" v:groupcontext="shape" transform="translate(251.932,-177.041)">		<title>Sheet.15</title>		<desc>过滤器</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="27" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>过滤器</text>		</g>	<g id="shape17-33" v:mid="17" v:groupcontext="shape" transform="translate(252.202,-223.839)">		<title>Sheet.17</title>		<desc>capsfilter</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="44.8648" cy="296.602" width="89.73" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="89.7296" height="14.4" class="st3"></rect>		<text x="19.84" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>capsfilter</text>		</g>	<g id="shape18-36" v:mid="18" v:groupcontext="shape" transform="translate(147.014,-52.7487)">		<title>Sheet.18</title>		<desc>音频采集</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="21" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>音频采集</text>		</g>	<g id="shape20-39" v:mid="20" v:groupcontext="shape" transform="translate(147.303,-99.5469)">		<title>Sheet.20</title>		<desc>pulsesrc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="44.8555" cy="296.602" width="89.72" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="89.711" height="14.4" class="st3"></rect>		<text x="22.19" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>pulsesrc</text>		</g>	<g id="group21-42" transform="translate(237.014,-72.2569)" v:mid="21" v:groupcontext="group">		<title>Sheet.21</title>		<g id="shape22-43" v:mid="22" v:groupcontext="shape" transform="translate(0,-2.99181)">			<title>Sheet.22</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape23-46" v:mid="23" v:groupcontext="shape" transform="translate(9.81887,0)">			<title>Sheet.23</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="group24-48" transform="translate(341.932,-72.2569)" v:mid="24" v:groupcontext="group">		<title>Sheet.24</title>		<g id="shape25-49" v:mid="25" v:groupcontext="shape" transform="translate(0,-2.99181)">			<title>Sheet.25</title>			<path d="M0 303.8 L18.04 303.8" class="st11"></path>		</g>		<g id="shape26-52" v:mid="26" v:groupcontext="shape" transform="translate(17.1677,0)">			<title>Sheet.26</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="shape27-54" v:mid="27" v:groupcontext="shape" transform="translate(251.932,-52.7487)">		<title>Sheet.27</title>		<desc>过滤器</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="27" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>过滤器</text>		</g>	<g id="shape29-57" v:mid="29" v:groupcontext="shape" transform="translate(252.202,-99.5469)">		<title>Sheet.29</title>		<desc>capsfilter</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="44.8648" cy="296.602" width="89.73" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="89.7296" height="14.4" class="st3"></rect>		<text x="19.84" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>capsfilter</text>		</g>	<g id="group30-60" transform="translate(558.89,-242.933)" v:mid="30" v:groupcontext="group">		<title>Sheet.30</title>		<g id="shape31-61" v:mid="31" v:groupcontext="shape" transform="translate(0,-2.99179)">			<title>Sheet.31</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape32-64" v:mid="32" v:groupcontext="shape" transform="translate(9.81887,0)">			<title>Sheet.32</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="shape33-66" v:mid="33" v:groupcontext="shape" transform="translate(468.89,-223.424)">		<title>Sheet.33</title>		<desc>队列</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="33" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>队列</text>		</g>	<g id="shape35-69" v:mid="35" v:groupcontext="shape" transform="translate(573.89,-270.223)">		<title>Sheet.35</title>		<desc>h264parse</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="296.602" width="90" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="90" height="14.4" class="st3"></rect>		<text x="16.65" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>h264parse</text>		</g>	<g id="shape36-72" v:mid="36" v:groupcontext="shape" transform="translate(573.89,-223.424)">		<title>Sheet.36</title>		<desc>解析</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="33" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>解析</text>		</g>	<g id="group38-75" transform="translate(663.923,-242.933)" v:mid="38" v:groupcontext="group">		<title>Sheet.38</title>		<g id="shape39-76" v:mid="39" v:groupcontext="shape" transform="translate(0,-2.99179)">			<title>Sheet.39</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape40-79" v:mid="40" v:groupcontext="shape" transform="translate(9.81889,0)">			<title>Sheet.40</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="shape41-81" v:mid="41" v:groupcontext="shape" transform="translate(679.438,-270.223)">		<title>Sheet.41</title>		<desc>mp4mux</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="296.602" width="90" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="90" height="14.4" class="st3"></rect>		<text x="21.47" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>mp4mux</text>		</g>	<g id="group42-84" transform="translate(558.89,-157.655)" v:mid="42" v:groupcontext="group">		<title>Sheet.42</title>		<g id="shape43-85" v:mid="43" v:groupcontext="shape" transform="translate(0,-2.99178)">			<title>Sheet.43</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape44-88" v:mid="44" v:groupcontext="shape" transform="translate(9.81887,0)">			<title>Sheet.44</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="shape45-90" v:mid="45" v:groupcontext="shape" transform="translate(468.89,-138.147)">		<title>Sheet.45</title>		<desc>队列</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="33" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>队列</text>		</g>	<g id="shape47-93" v:mid="47" v:groupcontext="shape" transform="translate(573.89,-184.945)">		<title>Sheet.47</title>		<desc>h265parse</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="296.602" width="90" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="90" height="14.4" class="st3"></rect>		<text x="16.65" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>h265parse</text>		</g>	<g id="shape48-96" v:mid="48" v:groupcontext="shape" transform="translate(573.89,-138.147)">		<title>Sheet.48</title>		<desc>解析</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="33" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>解析</text>		</g>	<g id="group50-99" transform="translate(663.923,-157.655)" v:mid="50" v:groupcontext="group">		<title>Sheet.50</title>		<g id="shape51-100" v:mid="51" v:groupcontext="shape" transform="translate(0,-2.99178)">			<title>Sheet.51</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape52-103" v:mid="52" v:groupcontext="shape" transform="translate(9.81889,0)">			<title>Sheet.52</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="group53-105" transform="translate(558.89,-72.3771)" v:mid="53" v:groupcontext="group">		<title>Sheet.53</title>		<g id="shape54-106" v:mid="54" v:groupcontext="shape" transform="translate(0,-2.99178)">			<title>Sheet.54</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape55-109" v:mid="55" v:groupcontext="shape" transform="translate(9.81887,0)">			<title>Sheet.55</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="group56-111" transform="translate(454.281,-242.933)" v:mid="56" v:groupcontext="group">		<title>Sheet.56</title>		<g id="shape57-112" v:mid="57" v:groupcontext="shape" transform="translate(0,-2.99179)">			<title>Sheet.57</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape58-115" v:mid="58" v:groupcontext="shape" transform="translate(9.81887,0)">			<title>Sheet.58</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="group59-117" transform="translate(454.281,-157.655)" v:mid="59" v:groupcontext="group">		<title>Sheet.59</title>		<g id="shape60-118" v:mid="60" v:groupcontext="shape" transform="translate(0,-2.99178)">			<title>Sheet.60</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape61-121" v:mid="61" v:groupcontext="shape" transform="translate(9.81887,0)">			<title>Sheet.61</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="group62-123" transform="translate(454.281,-72.3771)" v:mid="62" v:groupcontext="group">		<title>Sheet.62</title>		<g id="shape63-124" v:mid="63" v:groupcontext="shape" transform="translate(0,-2.99178)">			<title>Sheet.63</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape64-127" v:mid="64" v:groupcontext="shape" transform="translate(9.81887,0)">			<title>Sheet.64</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="shape65-129" v:mid="65" v:groupcontext="shape" transform="translate(468.89,-52.8689)">		<title>Sheet.65</title>		<desc>队列</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="33" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>队列</text>		</g>	<g id="shape67-132" v:mid="67" v:groupcontext="shape" transform="translate(364.5,-270.223)">		<title>Sheet.67</title>		<desc>v4l2h264enc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="44.8904" cy="296.602" width="89.79" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="89.7808" height="14.4" class="st3"></rect>		<text x="10.75" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>v4l2h264enc</text>		</g>	<g id="shape68-135" v:mid="68" v:groupcontext="shape" transform="translate(364.281,-223.424)">		<title>Sheet.68</title>		<desc>编码</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="33" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>编码</text>		</g>	<g id="shape70-138" v:mid="70" v:groupcontext="shape" transform="translate(364.5,-184.945)">		<title>Sheet.70</title>		<desc>v4l2h265enc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="44.8904" cy="296.602" width="89.79" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="89.7808" height="14.4" class="st3"></rect>		<text x="10.75" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>v4l2h265enc</text>		</g>	<g id="shape71-141" v:mid="71" v:groupcontext="shape" transform="translate(364.281,-138.147)">		<title>Sheet.71</title>		<desc>编码</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="33" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>编码</text>		</g>	<g id="shape73-144" v:mid="73" v:groupcontext="shape" transform="translate(364.5,-99.6672)">		<title>Sheet.73</title>		<desc>audioconvert</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="44.8904" cy="296.602" width="89.79" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="89.7808" height="14.4" class="st3"></rect>		<text x="10.11" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>audioconvert</text>		</g>	<g id="shape74-147" v:mid="74" v:groupcontext="shape" transform="translate(364.281,-52.8689)">		<title>Sheet.74</title>		<desc>转换</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="33" y="284.9" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>转换</text>		</g>	<g id="shape76-150" v:mid="76" v:groupcontext="shape" transform="translate(573.89,-99.6672)">		<title>Sheet.76</title>		<desc>lamemp3enc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="296.602" width="90" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="90" height="14.4" class="st3"></rect>		<text x="10.22" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>lamemp3enc</text>		</g>	<g id="shape77-153" v:mid="77" v:groupcontext="shape" transform="translate(573.89,-52.8689)">		<title>Sheet.77</title>		<desc>MP3 编码</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="281.302" width="90" height="45"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 261.8 A3.00007 3.00007					 -180 0 0 87 258.8 L3 258.8 A3.00007 3.00007 -180 0 0 -0 261.8 L0 300.8 Z" class="st13"></path>		<text x="19.12" y="285.3" class="st14" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>MP3 <tspan class="st8">编码</tspan></text>		</g>	<g id="group79-157" transform="translate(663.923,-72.3771)" v:mid="79" v:groupcontext="group">		<title>Sheet.79</title>		<g id="shape80-158" v:mid="80" v:groupcontext="shape" transform="translate(0,-2.99178)">			<title>Sheet.80</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape81-161" v:mid="81" v:groupcontext="shape" transform="translate(9.81889,0)">			<title>Sheet.81</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="shape82-163" v:mid="82" v:groupcontext="shape" transform="translate(679.438,-51.3689)">		<title>Sheet.82</title>		<desc>多路复用</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="195.274" width="90" height="217.055"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 89.75 A3.00007 3.00007					 -180 0 0 87 86.75 L3 86.75 A3.00007 3.00007 -180 0 0 -0 89.75 L0 300.8 Z" class="st13"></path>		<text x="21" y="198.87" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>多路复用</text>		</g>	<g id="shape84-166" v:mid="84" v:groupcontext="shape" transform="translate(784.438,-270.223)">		<title>Sheet.84</title>		<desc>filesink</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="296.602" width="90" height="14.4"></v:textrect>		<rect x="0" y="289.402" width="90" height="14.4" class="st3"></rect>		<text x="25.92" y="300.2" class="st7" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>filesink</text>		</g>	<g id="group85-169" transform="translate(769.438,-157.655)" v:mid="85" v:groupcontext="group">		<title>Sheet.85</title>		<g id="shape86-170" v:mid="86" v:groupcontext="shape" transform="translate(0,-2.99178)">			<title>Sheet.86</title>			<path d="M0 303.8 L10.69 303.8" class="st11"></path>		</g>		<g id="shape87-173" v:mid="87" v:groupcontext="shape" transform="translate(9.81885,0)">			<title>Sheet.87</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="group90-175" transform="translate(350.299,-158.042)" v:mid="90" v:groupcontext="group">		<title>Sheet.90</title>		<g id="shape91-176" v:mid="91" v:groupcontext="shape" transform="translate(-8.99281E-15,-2.99181)">			<title>Sheet.91</title>			<path d="M9.68 303.8 L0 303.8 L0 218.91 L9.68 218.91 L9.68 303.8 Z" class="st15"></path>			<path d="M9.68 303.8 L0 303.8 L0 218.91 L9.68 218.91" class="st11"></path>		</g>		<g id="shape92-179" v:mid="92" v:groupcontext="shape" transform="translate(8.80075,0)">			<title>Sheet.92</title>			<path d="M0 297.82 L5.18 300.81 L0 303.8 L0 297.82 Z" class="st12"></path>		</g>		<g id="shape93-181" v:mid="93" v:groupcontext="shape" transform="translate(8.80075,-84.8907)">			<title>Sheet.93</title>			<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>		</g>	</g>	<g id="group94-183" transform="translate(124.468,-68.9305)" v:mid="94" v:groupcontext="group">		<title>Sheet.94</title>		<g id="shape95-184" v:mid="95" v:groupcontext="shape" transform="translate(1.14303E-06,-2.9918)">			<title>Sheet.95</title>			<path d="M22.55 176.18 L0 176.18 L0 303.8 L22.55 303.8 L22.55 176.18 Z" class="st15"></path>			<path d="M22.55 176.18 L0 176.18 L0 303.8 L22.55 303.8" class="st16"></path>		</g>		<g id="group96-187" v:mid="96" v:groupcontext="group">			<title>Sheet.96</title>			<g id="shape97-188" v:mid="97" v:groupcontext="shape" transform="translate(5.79536E-14,-2.99181)">				<title>Sheet.97</title>				<path d="M18.24 176.18 L0 176.18 L0 303.8 L18.24 303.8 L18.24 176.18 Z" class="st15"></path>				<path d="M18.24 176.18 L0 176.18 L0 303.8 L18.24 303.8" class="st11"></path>			</g>			<g id="shape98-191" v:mid="98" v:groupcontext="shape" transform="translate(17.365,-127.619)">				<title>Sheet.98</title>				<path d="M0 297.82 L5.18 300.81 L0 303.8 L0 297.82 Z" class="st12"></path>			</g>			<g id="shape99-193" v:mid="99" v:groupcontext="shape" transform="translate(17.365,0)">				<title>Sheet.99</title>				<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>			</g>		</g>	</g>	<g id="group100-195" transform="translate(874.438,-157.655)" v:mid="100" v:groupcontext="group">		<title>Sheet.100</title>		<g id="shape101-196" v:mid="101" v:groupcontext="shape" transform="translate(1.96439E-06,-2.99179)">			<title>Sheet.101</title>			<path d="M0 303.8 L30 303.8" class="st16"></path>		</g>		<g id="group102-199" v:mid="102" v:groupcontext="group">			<title>Sheet.102</title>			<g id="shape103-200" v:mid="103" v:groupcontext="shape" transform="translate(0,-2.99178)">				<title>Sheet.103</title>				<path d="M0 303.8 L25.69 303.8" class="st11"></path>			</g>			<g id="shape104-203" v:mid="104" v:groupcontext="shape" transform="translate(24.8188,0)">				<title>Sheet.104</title>				<path d="M0 303.8 L5.18 300.81 L0 297.82 L0 303.8 Z" class="st12"></path>			</g>		</g>	</g>	<g id="shape105-205" v:mid="105" v:groupcontext="shape" transform="translate(109.468,-135.732)">		<title>Sheet.105</title>		<path d="M0 303.8 L15 303.8" class="st11"></path>	</g>	<g id="shape88-208" v:mid="88" v:groupcontext="shape" transform="translate(784.438,-51.3689)">		<title>Sheet.88</title>		<desc>写入</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="45" cy="195.274" width="90" height="217.055"></v:textrect>		<path d="M0 300.8 A3.00007 3.00007 -180 0 0 3 303.8 L87 303.8 A3.00007 3.00007 -180 0 0 90 300.8 L90 89.75 A3.00007 3.00007					 -180 0 0 87 86.75 L3 86.75 A3.00007 3.00007 -180 0 0 0 89.75 L0 300.8 Z" class="st13"></path>		<text x="33" y="198.87" class="st10" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>写入</text>		</g>	<g id="group144-211" transform="translate(844.938,-18.5848)" v:mid="144" v:groupcontext="group">		<title>Sheet.144</title>		<g id="shape108-212" v:mid="108" v:groupcontext="shape" transform="translate(15.1883,0)">			<title>Sheet.108</title>			<desc>Qualcomm</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="26.4776" cy="297.502" width="52.96" height="12.6"></v:textrect>			<rect x="0" y="291.202" width="52.9552" height="12.6" class="st3"></rect>			<text x="0" y="300.65" class="st17" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>Qualcomm  </text>			</g>		<g id="shape109-215" v:mid="109" v:groupcontext="shape" transform="translate(-9.99201E-16,-0.218618)">			<title>Sheet.109</title>			<path d="M0 302.3 A1.50003 1.50003 -180 0 0 1.5 303.8 L10.5 303.8 A1.50003 1.50003 -180 0 0 12 302.3 L12 293.3 A1.50003						 1.50003 -180 0 0 10.5 291.8 L1.5 291.8 A1.50003 1.50003 -180 0 0 0 293.3 L0 302.3 Z" class="st9"></path>		</g>		<g id="shape111-217" v:mid="111" v:groupcontext="shape" transform="translate(89.1246,0)">			<title>Sheet.111</title>			<desc>开源</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="10.5" cy="297.502" width="21" height="12.6"></v:textrect>			<rect x="0" y="291.202" width="21" height="12.6" class="st3"></rect>			<text x="0" y="301" class="st18" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>开源</text>			</g>		<g id="shape112-220" v:mid="112" v:groupcontext="shape" transform="translate(73.9363,-0.218618)">			<title>Sheet.112</title>			<path d="M0 302.3 A1.50003 1.50003 -180 0 0 1.5 303.8 L10.5 303.8 A1.50003 1.50003 -180 0 0 12 302.3 L12 293.3 A1.50003						 1.50003 -180 0 0 10.5 291.8 L1.5 291.8 A1.50003 1.50003 -180 0 0 0 293.3 L0 302.3 Z" class="st13"></path>		</g>	</g></g>
</svg>

## 运行应用程序

下表列出了 gst-audio-video-encode 应用程序的常见用例及其可以执行的操作：| 用例 | 操作 |
| --- | --- |
| 流服务 | 对音频和视频流进行编码，以便进行实时 Internet 流传输。 |
| 安全摄像头 | 对视频图像进行翻转或旋转，以弥补摄像头安装不当的情况。 |
| 增强现实 | 缩放或旋转视频源以与虚拟组件同步。 |

1. 确保您已完成[前提条件](https://docs.qualcomm.com/doc/80-70022-50SC/topic/mm_sample_apps_prerequisites.html)。
2. 在目标设备的终端中，运行用例：

        gst-audio-video-encode -w <width> -h <height> -c <input-codec> -o /etc/media/<output-file>.mp4Copy to clipboard

下表提供了命令行参数的说明：    | 命令行参数 | 说明 |
    | --- | --- |
    | `-w` | 指定摄像头宽度。 |
    | `-h` | 指定摄像头高度。 |
    | `-c` | 指定输入文件的视频 codec：<ul class="ul" id="gst-audio-video-encode__ul_sm4_hpt_4bc"><br>                                            <li class="li"><code class="ph codeph">1</code> 用于 AVC (H.264)。</li><br><br>                                            <li class="li"><code class="ph codeph">2</code> 用于 HEVC (H.265)。</li><br><br>                                        </ul> |
    | `output-file` | 提供输出文件的绝对路径。 |

例如，使用以下命令运行不同的视频编码用例：
    - AVC：

            gst-audio-video-encode -w 1920 -h 1080 -c 1 -o /etc/media/audiovideo.mp4Copy to clipboard
    - HEVC：

            gst-audio-video-encode -w 1920 -h 1080 -c 2 -o /etc/media/audiovideo.mp4Copy to clipboard
3. 要停止用例，请使用 CTRL +
                    C。
4. 在目标设备的终端中，在 SSH shell 中运行以下命令以显示可用的帮助选项：

        gst-audio-video-encode --helpCopy to clipboard
5. 在主机的终端中，运行以下命令从目标设备中拉取文件：

        scp root@<IP address of target device>:/etc/media/<destination directory>Copy to clipboard

## 预期输出

编码的音频和视频流将复用到 MP4 容器并写入文件。

## Pipeline 流

下表列出了用于运行音频和视频流编码 pipeline 的插件：| 插件 | 说明 |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtiqmmfsrc.html) 和 capsfilter | 采集媒体流。 |
| [v4l2h264enc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/v4l2h264enc.html) | 将视频编码为 AVC (H.264) 格式。 |
| [v4l2h265enc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/v4l2h265enc.html) | 将视频编码为 HEVC (H.265) 格式。 |
| h264parse | 渲染 H.264 视频流。 |
| h265parse | 渲染 H.265 视频流。 |
| [pulsesrc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/pulsesrc.html) | 从流中采集音频，该流使用 capsfilter 进行筛选。 |
| audioconvert | 转换音频进行编码。 |
| lamemp3enc | 以 MP3 格式对音频进行编码。 |
| mp4mux | 将编码的视频和音频复用到 MP4 容器中。 |
| filesink | 将流写入文件。 |

**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-video-playback-example.md) [Next Topic
音频播放](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/gst-audio-decode-sample.md)