如何使用 PHP 对视频进行编码?
我有兴趣在我的服务器上安装 ffmpeg
或类似的东西,以便我可以上传文件,自动将它们编码为 FLV,然后提供嵌入式播放器以在我的页面上使用。
问题是我不知道从哪里开始。我不想花几天时间编写基于 Web 的编码服务,因为我对使用开箱即用的解决方案更感兴趣。
到目前为止,我的研究使我找到了 FFMPEG
以及可能的 Gallery2
:它集成了 ffmpeg
,gallery 2 框架提供用户帐户和FTP 上传设施。
有人知道可以在 Linux 上安装的其他开源编码解决方案吗?
I'm interested in installing ffmpeg
or somesuch on my server so I can upload files, automatically encode them to FLV and then serve up a embedded player to use on my pages.
The problem is that I don't know where to start. I don't want to have to spend days coding a web based encoding service, as I'm more interested in using an out of the box solution.
My research so far has led me to FFMPEG
and possibly Gallery2
: it has a ffmpeg
integrated and the gallery 2 framework provides user accounts and FTP upload facilities.
Is anyone aware of other open source encoding solutions which you can install on Linux?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
有 PHP 的 ffmpeg 扩展。
There is ffmpeg extension for PHP.
还有
memcoder
,它的作用与ffmpeg
可以,但是您必须对绑定ffmpeg
/memcoder
、PHP
以及上传的视频。一般工作流程类似于:
post
上传CLI带有所有所需参数的
命令并将文件存储在另一个已知位置There is also
memcoder
, that does the same thing thatffmpeg
does, but you will have to code the glue that bindsffmpeg
/memcoder
,PHP
and the uploaded videos together.The general workflow would be something like:
post
CLI
command with all the desired parameters and store the file in another known location您还可以查看 VLC,因为它可以转码并充当 FLV 流的服务器。主要应用程序是用于播放视频的用户界面,但可以从命令行调用它来执行服务 - 而不是播放。
还有 libvlc,它是编写 VLC 的 C 库。 VLC 基于 ffmpeg,可能会让您的生活更轻松一些。
You could also have a look at VLC since it can transcode and act as a server for your FLV streams. The main application is a user interface to playback the video but it can be invoked from the command-line to do the serving - rather than playing.
Also there is libvlc which is the C library upon which VLC is written. VLC is based upon ffmpeg and might just make your life a little easier.
您应该查看您选择的编码器的文档,我过去曾成功使用过 ffmpeg。然后你的工作流程看起来像这样。
ffmpeg 非常容易通过几个命令行参数启动和运行。
You should check out the docs for your chosen encoder, I have used ffmpeg successfully in the past. Then your workflow looks something like this.
ffmpeg was really easy to get up and running with a couple of command line arguments.