如何在 PHP 中获取 .flv 第一帧的快照?

发布于 2024-10-06 19:09:40 字数 41 浏览 10 评论 0原文

并将其另存为图像。

PHP 可以完成这样的工作吗?

And save it as an image.

Is this kind of job possible in PHP?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

静谧幽蓝 2024-10-13 19:09:40

PHP 有一个 ffmpeg 库,您可以使用它来实现此目的。利用 ffmpeg_movie 您可以将视频文件作为对象返回:

$movie = new ffmpeg_movie('/path/to/.flv');

然后您可以继续使用getFrame() 方法,该方法将帧作为 ffmpeg_frame 对象返回,该对象的方法 toGDImage() 返回一个 GD 框架的图像。显然需要启用GD库。

PHP has an ffmpeg library which you can use for this. Utilizing ffmpeg_movie you can return a video file as an object:

$movie = new ffmpeg_movie('/path/to/.flv');

You can then go on and use the getFrame() method, which returns the frame as an ffmpeg_frame object, which has the method toGDImage() which returns a GD image of the frame. Obviously the GD library needs to be enabled.

呆° 2024-10-13 19:09:40

请参阅此问题

所有解决方案似乎都依赖于 FFMPEG(因此这不太可能适用于共享网络托管)。

See this question.

All the solutions seem to rely on FFMPEG (so it's unlikely this would work on shared web hosting, for example).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文