# 实时拍照

Source: [https://docs.qualcomm.com/doc/80-70022-50SC/topic/gst-snapshot-stream-example.html](https://docs.qualcomm.com/doc/80-70022-50SC/topic/gst-snapshot-stream-example.html)

**gst-snapshot-stream-example** 应用程序允许您生成两个流：用于实时显示的预览流和用于采集图像并将其保存为 JPEG 文件的拍照流。

Note: 此示例应用程序在 Dragonwing IQ-8275 和 Dragonwing QCS9075 上不受支持。

对于拍照流，您可以定义拍照的数量。

下图展示了一个 pipeline：允许从同一视频源同时进行实时预览和拍照。

关于更多详细信息，请参阅 [Pipeline 流](https://docs.qualcomm.com/doc/80-70022-50SC/topic/gst-snapshot-stream-example.html#gst-snapshot-stream-example__section_lny_sly_nbc)。

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

<!-- Generated by Microsoft Visio, SVG Export gst_snapshot_stream_example_pipeline.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="6.35417in" height="2.08333in" viewbox="0 0 457.5 150" xml:space="preserve" color-interpolation-filters="sRGB" class="st13"><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: #007884; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st4 { fill: #ffffff; font-family: Roboto; font-size: 1.00001em }
.svg-1 .st5 { stroke: #000000; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st6 { fill: #000000; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st7 { fill: #2a2aea; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st8 { fill: none }
.svg-1 .st9 { fill: none; stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5 }
.svg-1 .st10 { fill: none; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st11 { fill: #000000; font-family: Roboto; font-size: 0.874992em }
.svg-1 .st12 { fill: #000000; font-family: SimHei; font-size: 0.874992em }
.svg-1 .st13 { 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.375137,-0.375275)">		<title>Sheet.2</title>		<path d="M0 144.37 A5.62513 5.62513 -180 0 0 5.63 150 L451.13 150 A5.62513 5.62513 -180 0 0 456.75 144.37 L456.75 6.38					 A5.62513 5.62513 -180 0 0 451.13 0.75 L5.63 0.75 A5.62513 5.62513 -180 0 0 -0 6.38 L0 144.37 Z" class="st1"></path>	</g>	<g id="shape3-3" v:mid="3" v:groupcontext="shape">		<title>Sheet.3</title>		<path d="M451.5 0.75 C454.39 0.75 456.75 3.11 456.75 6 L456.75 144 C456.75 146.89 454.39 149.25 451.5 149.25 L6 149.25					 C3.11 149.25 0.75 146.89 0.75 144 L0.75 6 C0.75 3.11 3.11 0.75 6 0.75 L451.5 0.75 ZM451.5 0 L6 0 C2.69 0					 0 2.69 0 6 L0 144 C0 147.31 2.69 150 6 150 L451.5 150 C454.81 150 457.5 147.31 457.5 144 L457.5 6 C457.5					 2.69 454.81 0 451.5 0 Z" class="st2"></path>	</g>	<g id="shape5-5" v:mid="5" v:groupcontext="shape" transform="translate(212.111,-39.7975)">		<title>Sheet.5</title>		<desc>capsfilter</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="52.5" cy="128.75" width="105" height="42.5"></v:textrect>		<path d="M0 147 A3.00007 3.00007 -180 0 0 3 150 L102 150 A3.00007 3.00007 -180 0 0 105 147 L105 110.5 A3.00007 3.00007					 -180 0 0 102 107.5 L3 107.5 A3.00007 3.00007 -180 0 0 0 110.5 L0 147 Z" class="st3"></path>		<text x="27.47" y="132.35" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>capsfilter</text>		</g>	<g id="shape7-8" v:mid="7" v:groupcontext="shape" transform="translate(212.111,-91.1445)">		<title>Sheet.7</title>		<desc>capsfilter</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="52.5" cy="128.75" width="105" height="42.5"></v:textrect>		<path d="M0 147 A3.00007 3.00007 -180 0 0 3 150 L102 150 A3.00007 3.00007 -180 0 0 105 147 L105 110.5 A3.00007 3.00007					 -180 0 0 102 107.5 L3 107.5 A3.00007 3.00007 -180 0 0 0 110.5 L0 147 Z" class="st3"></path>		<text x="27.47" y="132.35" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>capsfilter</text>		</g>	<g id="group9-11" transform="translate(317.111,-109.777)" v:mid="9" v:groupcontext="group">		<title>Sheet.9</title>		<g id="shape10-12" v:mid="10" v:groupcontext="shape" transform="translate(0,-2.61781)">			<title>Sheet.10</title>			<path d="M0 150 L13.59 150" class="st5"></path>		</g>		<g id="shape11-15" v:mid="11" v:groupcontext="shape" transform="translate(12.8215,-2.84217E-14)">			<title>Sheet.11</title>			<path d="M0 150 L4.53 147.38 L0 144.76 L0 150 Z" class="st6"></path>		</g>	</g>	<g id="shape12-17" v:mid="12" v:groupcontext="shape" transform="translate(335.625,-39.7975)">		<title>Sheet.12</title>		<desc>multifilesink</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="52.5" cy="128.75" width="105" height="42.5"></v:textrect>		<path d="M0 147 A3.00007 3.00007 -180 0 0 3 150 L102 150 A3.00007 3.00007 -180 0 0 105 147 L105 110.5 A3.00007 3.00007					 -180 0 0 102 107.5 L3 107.5 A3.00007 3.00007 -180 0 0 0 110.5 L0 147 Z" class="st3"></path>		<text x="19.99" y="132.35" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>multifilesink</text>		</g>	<g id="group13-20" transform="translate(317.111,-58.4297)" v:mid="13" v:groupcontext="group">		<title>Sheet.13</title>		<g id="shape14-21" v:mid="14" v:groupcontext="shape" transform="translate(0,-2.61781)">			<title>Sheet.14</title>			<path d="M0 150 L13.73 150" class="st5"></path>		</g>		<g id="shape15-24" v:mid="15" v:groupcontext="shape" transform="translate(12.9665,-2.84217E-14)">			<title>Sheet.15</title>			<path d="M0 150 L4.53 147.38 L0 144.76 L0 150 Z" class="st6"></path>		</g>	</g>	<g id="shape17-26" v:mid="17" v:groupcontext="shape" transform="translate(335.625,-91.1445)">		<title>Sheet.17</title>		<desc>Waylandsink</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="52.5" cy="128.75" width="105" height="42.5"></v:textrect>		<path d="M0 147 A3.00007 3.00007 -180 0 0 3 150 L102 150 A3.00007 3.00007 -180 0 0 105 147 L105 110.5 A3.00007 3.00007					 -180 0 0 102 107.5 L3 107.5 A3.00007 3.00007 -180 0 0 0 110.5 L0 147 Z" class="st3"></path>		<text x="18.76" y="132.35" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Waylandsink</text>		</g>	<g id="shape19-29" v:mid="19" v:groupcontext="shape" transform="translate(70.9983,-65.471)">		<title>Sheet.19</title>		<desc>qtiqmmfsrc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="52.5" cy="128.75" width="105" height="42.5"></v:textrect>		<path d="M0 147 A3.00007 3.00007 -180 0 0 3 150 L102 150 A3.00007 3.00007 -180 0 0 105 147 L105 110.5 A3.00007 3.00007					 -180 0 0 102 107.5 L3 107.5 A3.00007 3.00007 -180 0 0 0 110.5 L0 147 Z" class="st7"></path>		<text x="21.4" y="132.35" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtiqmmfsrc</text>		</g>	<g id="group21-32" transform="translate(193.498,-57.6618)" v:mid="21" v:groupcontext="group">		<title>Sheet.21</title>		<g id="shape22-33" v:mid="22" v:groupcontext="shape" transform="translate(8.59313E-14,-2.99181)">			<title>Sheet.22</title>			<path d="M13.19 150 L0 150 L0 97.87 L13.19 97.87 L13.19 150 Z" class="st8"></path>			<path d="M13.19 150 L0 150 L0 97.87 L13.19 97.87" class="st5"></path>		</g>		<g id="shape23-36" v:mid="23" v:groupcontext="shape" transform="translate(12.3188,2.84217E-14)">			<title>Sheet.23</title>			<path d="M0 144.02 L5.18 147.01 L0 150 L0 144.02 Z" class="st6"></path>		</g>		<g id="shape24-38" v:mid="24" v:groupcontext="shape" transform="translate(12.3188,-52.1349)">			<title>Sheet.24</title>			<path d="M0 150 L5.18 147.01 L0 144.02 L0 150 Z" class="st6"></path>		</g>	</g>	<g id="shape25-40" v:mid="25" v:groupcontext="shape" transform="translate(193.498,213.279) rotate(180)">		<title>Sheet.25</title>		<path d="M0 150 L17.5 150" class="st5"></path>	</g>	<g id="shape26-43" v:mid="26" v:groupcontext="shape" transform="translate(70.9983,213.279) rotate(180)">		<title>Sheet.26</title>		<path d="M0 150 L17.5 150" class="st5"></path>	</g>	<g id="group27-46" transform="translate(16.875,-72.0717)" v:mid="27" v:groupcontext="group">		<title>Sheet.27</title>		<g id="shape28-47" v:mid="28" v:groupcontext="shape">			<title>Sheet.28</title>			<path d="M22.89 120.7 L13.73 120.7 L9.16 126.19 L3.66 126.19 C1.64 126.19 0 127.83 0 129.86 L0 146.34 C0 148.36 1.64						 150 3.66 150 L32.96 150 C34.98 150 36.62 148.36 36.62 146.34 L36.62 129.86 C36.62 127.83 34.98 126.19						 32.96 126.19 L27.47 126.19 L22.89 120.7 Z" class="st9"></path>		</g>		<g id="shape29-49" v:mid="29" v:groupcontext="shape" transform="translate(12.8181,-9.15581)">			<title>Sheet.29</title>			<ellipse cx="5.49349" cy="144.507" rx="5.49349" ry="5.49349" class="st9"></ellipse>		</g>	</g>	<g id="group37-51" transform="translate(330.5,-13.1369)" v:mid="37" v:groupcontext="group">		<title>Sheet.37</title>		<g id="shape32-52" v:mid="32" v:groupcontext="shape" transform="translate(15.1882,0)">			<title>Sheet.32</title>			<desc>Qualcomm</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="26.0894" cy="143.7" width="52.18" height="12.6"></v:textrect>			<rect x="0" y="137.4" width="52.1788" height="12.6" class="st10"></rect>			<text x="0" y="146.85" class="st11" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>Qualcomm  </text>			</g>		<g id="shape33-55" v:mid="33" v:groupcontext="shape" transform="translate(3.09752E-14,-0.218623)">			<title>Sheet.33</title>			<path d="M0 148.5 A1.50003 1.50003 -180 0 0 1.5 150 L10.5 150 A1.50003 1.50003 -180 0 0 12 148.5 L12 139.5 A1.50003						 1.50003 -180 0 0 10.5 138 L1.5 138 A1.50003 1.50003 -180 0 0 0 139.5 L0 148.5 Z" class="st7"></path>		</g>		<g id="shape35-57" v:mid="35" v:groupcontext="shape" transform="translate(89.1246,0)">			<title>Sheet.35</title>			<desc>开源</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="10.5" cy="143.7" width="21.01" height="12.6"></v:textrect>			<rect x="0" y="137.4" width="21" height="12.6" class="st10"></rect>			<text x="0" y="147.19" class="st12" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>开源</text>			</g>		<g id="shape36-60" v:mid="36" v:groupcontext="shape" transform="translate(73.9363,-0.218623)">			<title>Sheet.36</title>			<path d="M0 148.5 A1.50003 1.50003 -180 0 0 1.5 150 L10.5 150 A1.50003 1.50003 -180 0 0 12 148.5 L12 139.5 A1.50003						 1.50003 -180 0 0 10.5 138 L1.5 138 A1.50003 1.50003 -180 0 0 0 139.5 L0 148.5 Z" class="st3"></path>		</g>	</g></g>
</svg>

## 运行应用程序

1. 确保您已完成[前提条件](https://docs.qualcomm.com/doc/80-70022-50SC/topic/mm_sample_apps_prerequisites.html)。
2. 在目标设备的终端中，使用以下命令运行用例。为应用程序指定参数（如摄像头宽度、高度和存储 JPEG 文件的最大拍照计数）。

        gst-snapshot-stream-example -W 1280 -H 720 -w 3840 -h 2160 -c 5Copy to clipboard
3. 要停止用例，请使用 CTRL +
                    C。
4. 在目标设备的终端中，在 SSH shell 中运行以下命令以显示可用的帮助选项：

        gst-snapshot-stream-example --helpCopy to clipboard

## 预期输出

应用程序生成输出以在显示器上预览，并将 JPEG 文件存储到设备上的相应位置。

用例停止后，拍照输出文件保存于路径中 `/etc/media/`。

## Pipeline 流

下表列出了实时拍照 pipeline 中使用的插件：

| 插件 | 说明 |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtiqmmfsrc.html) | 采集视频流并将其送到 capsfilter 中。 |
| Capsfilter | 将源分支为两个单独的 pipeline。 <br>在一个 pipeline 中，强制执行对原始视频数据的约束，然后将视频数据发送到 [Waylandsink](https://docs.qualcomm.com/doc/80-70022-50SC/topic/waylandsink.html) 以进行实时预览。 |
| Capsfilter | <ol class="ol" id="gst-snapshot-stream-example__ol_imm_wmy_nbc"><br>                                    <li class="li">在另一个 pipeline 中，使用 multi filesink 将帧写入多个文件。</li><br><br>                                    <li class="li">拍照或视频流的帧将保存到磁盘。</li><br><br>                                </ol> |
|  |  |

**Parent Topic:** [运行摄像头的示例应用程序](https://docs.qualcomm.com/doc/80-70022-50SC/topic/camera-sample-applications.html)

Last Published: Nov 05, 2025

[Previous Topic
多个流](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/gst-multi-stream-example.md) [Next Topic
RTMP 摄像头流传输](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/gst-rtmp-stream-example.md)