> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 启用视频

本节概述了视频功能的前提条件、渲染视频的步骤以及验证视频播放和视频录制的方法。

以下工作流显示了开始视频功能的顺序：

![Figure: Getting started workflow for video](https://mintlify.s3.us-west-1.amazonaws.com/qualcomm-prod/zh/Technologies/Video/media/qli-video-technology/Getting-started-workflow.svg)

**图：视频入门工作流**

工作流概述了初始化和启动基于视频的系统的基本步骤：

1. **前提条件：** 构建并刷写所需的软件，并建立与目标设备的 SSH 连接。
2. **设置：** 从 SSH 终端运行必要的命令，并将预录制的视频推送到设备。
3. **运行：** 运行所需的命令以验证视频播放和录制。

## **前提条件**

* 构建并刷写软件。有关信息，请参阅 [Qualcomm Linux 构建指南](https://dragonwingdocs.qualcomm.com/Key-Documents/Firmware-Guide/build-firmware.md)。
* 使用 SSH 连接到设备。有关信息，请参阅 ***[使用 SSH 登录](https://dragonwingdocs.qualcomm.com/Key-Documents/Flash-Guide/how-to-sign-in-with-ssh)***

**使用 SSH 登录**

* 在 Linux 主机上使用 UART 控制台，根据网络连接类型找到设备的 IP 地址：

  ```bash Ethernet theme={null}
  ip address show eth2
  ```

  ```bash Wi-Fi theme={null}
  ip address show wlp1s0
  ```

* 使用 Linux 主机上获取的 IP 地址与设备建立 SSH 连接：

  ```bash theme={null}
  ssh root@ip-address
  ```

  ```text Example theme={null}
  ssh root@192.168.0.222
  ```

* 使用以下密码连接到 SSH shell：
  ```text theme={null}
  oelinux123
  ```

> [!NOTE]
>
> 将远程主机连接到与设备相同的 Wi-Fi 接入点。

## **设置视频渲染**

设置过程有助于您在显示器上渲染视频内容并将其传输到设备。

要播放视频，请将预录制的 H.264 视频传输到设备，并从 SSH 终端运行以下命令：

```text theme={null}
scp -r <file_name> root@[DEVICE IP-ADDR]:/opt
```

注意：

<ul>
  <li>视频示例 mp4 片段可以从互联网上外部下载。</li>
  <li>当提示输入密码时，输入 `oelinux123`。</li>
</ul>

## **验证播放和视频录制**

您可以在设备终端上运行一组命令以验证视频播放和录制功能。

**验证视频播放功能**

1. 要验证视频播放功能，请运行以下命令：
   ```text theme={null}
   gst-launch-1.0 filesrc location=/opt/<file_name> ! qtdemux ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! video/x-raw,format=NV12 ! waylandsink fullscreen=true
   ```
2. 要停止验证用例，选择 **<kbd>CTRL</kbd>**<kbd> + C</kbd>。

**验证视频录制功能**

1. 要验证视频录制功能，请运行以下命令：
   ```text theme={null}
   gst-launch-1.0 videotestsrc num-buffers=1000 ! video/x-raw, format=NV12,width=1280,height=720,framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=4 output-io-mode=4 extra-controls="controls,video_bitrate=1000000,video_gop_size=29;" ! h264parse ! queue ! mp4mux ! filesink location=/opt/720p_AVC.mp4
   ```
2. 要停止验证用例，选择 **<kbd>CTRL</kbd>**<kbd> + C</kbd>。
3. 要从设备提取录制的内容，请运行以下 Secure Copy Protocol (SCP) 命令：
   ```text theme={null}
   scp -r root@[DEVICE IP-ADDR]:/opt/720p_AVC.mp4 user1@[HOST IP-ADDR]:/workspace
   ```
4. 在主机上播放该内容。

## **后续步骤**

* [构建视频源组件](https://dragonwingdocs.qualcomm.com/Technologies/Video/build-video-source-components.md)
* [探索视频示例应用](https://dragonwingdocs.qualcomm.com/Technologies/Video/explore-video-sample-applications.md)
