> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/zh-cn/wen-da/14-how-can-i-embed-a-video-in-my-pdf-using-latex.md).

# 我如何使用 LaTeX 在 PDF 中嵌入视频？

过去可以通过 [`media9` 宏包](https://ctan.org/pkg/media9?lang=en) 但由于 Adobe 已于 2020 年底停止对 Flash 的支持， **……的各个版本** [**`media9` 宏包**](https://ctan.org/pkg/media9?lang=en) **依赖 Flash 的……不应再使用** 将视频或其他多媒体内容嵌入由 LaTeX 生成的 PDF 文件中，包括在 Overleaf 上创建的任何项目。不过，很可能…… `media9` 宏包 [会由其作者更新](https://gitlab.com/agrahn/media9) 以使用非 Flash 的方法将视频嵌入 LaTeX 生成的 PDF 中。

## 非 Flash 视频嵌入：概念验证

的作者 `media9` 发布了一个 [在 tex.stackexchange 上的概念验证示例](https://tex.stackexchange.com/a/516102) ，演示了如何使用一种不依赖 Flash 的技术将视频嵌入 PDF 中。演示该代码的一个 Overleaf 项目可以在 [这里](https://www.overleaf.com/read/rcfqksxktygc)——请注意，视频不会在 Overleaf 的预览面板中播放；请改为下载 PDF，并在合适的查看器中打开，例如 Adobe Reader。

## 截至 2021 年 2 月的情况

随着 Flash 最近刚刚结束支持，PDF 中嵌入的视频或声音的播放现在依赖于宿主操作系统内置的音视频播放软件。在 Flash 时代之后，用于播放嵌入 PDF 中视频的技术格局有些不稳定，尤其是对于依赖 Windows 10 的用户，因为某些 Windows 10 安装存在视频播放问题。Windows 10 的一个解决方法是 [于 2021 年 2 月 10 日发布在 Adobe 支持社区论坛上](https://community.adobe.com/t5/acrobat-reader/playing-embedded-video-without-flash/td-p/11266205/page/2)——你需要找到该日期 Himanshu Sagar 发布的条目。

该 `media9` 宏包的作者指出（[这里](https://stackoverflow.com/a/64789038) 和 [这里](https://tex.stackexchange.com/a/516102)） *就目前而言*，最佳做法可能是提供视频文件的链接，而不是将其嵌入。选择在 PDF 中提供视频内容链接的用户，需要确保这些视频对任何阅读你的 PDF 文档的人都可用。

关于 PDF 中嵌入的视频内容在 Flash 之后的状况的进一步讨论，例如 `.mp4` 文件，可 [在 Adobe 的在线论坛中找到](https://community.adobe.com/t5/acrobat-reader/playing-embedded-video-without-flash/td-p/11266205). 对于 LaTeX 用户，更多信息和讨论可在 tex.stackexchange 上找到：

* [Media9 到 2020 年 12 月已变得过时。LaTeX 中嵌入视频/音频还有替代方案吗？](https://tex.stackexchange.com/questions/516029/media9-is-becoming-obsolete-dec-2020-any-alternatives-for-embedding-video-audio/)
* [2020 年 12 月后 Overleaf 中 media9 的替代方案](https://tex.stackexchange.com/questions/577986/alternatives-for-media9-after-dec-2020-in-overleaf)

## PDF 中的 Flash：简要背景与历史

Adobe 于 2005 年收购了一家名为 Macromedia 的公司时获得了 Flash 技术（见 [维基百科](https://en.wikipedia.org/wiki/Macromedia) 或 [这里](https://www.adexchanger.com/data-driven-thinking/flash-in-the-pan-historical-lessons-of-adobes-macromedia-acquisition/) 中的历史和总体概述）。2008 年 6 月，Adobe 发布了一个 [ISO 32000 PDF 规范的扩展](https://www.adobe.com/content/dam/acom/en/devnet/pdf/adobe_supplement_iso32000.pdf) ，引入了 PDF 对嵌入 PDF 文件中的基于 Flash 内容的支持，为 PDF 文件包含各种形式的“富媒体”提供了一种便捷方式，包括视频、声音和 Flash 动画。对 PDF 规范的这些扩展与 [Adobe Reader 9 的发布](https://en.wikipedia.org/wiki/Adobe_Acrobat_version_history) 同时出现，它支持查看和播放嵌入式基于 Flash 的“富媒体”。

Flash 曾是创建、嵌入和共享丰富交互式内容的一项极受欢迎的技术——包括在网页中——但随着时间推移，对 Flash 的支持逐渐减少，同时出现了新的开放 Web 技术和标准，进一步削弱了 Flash 在技术组合中的作用。最终，事情已经非常明朗：2017 年 7 月 25 日，Adobe [宣布](https://blog.adobe.com/en/publish/2017/07/25/adobe-flash-update.html) 其对 Flash 的支持将在 2020 年底停止。如今，Adobe 最新的 PDF 产品已不再支持嵌入或播放（显示）基于 Flash 的媒体格式——`*.flv` 和 `*.swf` 文件。另见 [Flash Player 生命周期结束：对 Reader 和 Acrobat 的影响](https://helpx.adobe.com/uk/acrobat/kb/flash-format-support-in-pdf.html).

从技术角度来看，你完全可以通过 LaTeX 宏包或你自己的自定义宏将相应的运算符注入输出 PDF 文件，从而把基于 Flash 的媒体嵌入 PDF；但你的内容将不受支持，因此在当前和未来的 PDF 查看应用程序中都无法供读者使用。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/zh-cn/wen-da/14-how-can-i-embed-a-video-in-my-pdf-using-latex.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
