简体   繁体   English

使用PHP和ffmpeg在线上传和存储视频

[英]Uploading and Storing videos online using PHP and ffmpeg

I have a website that allows users to upload videos to it, After they upload videos, I would like to be able to display them using a flash player. 我有一个网站,允许用户向其上传视频。在他们上传视频之后,我希望能够使用Flash Player进行显示。

One flash player i know is flowplayer, althrough if anyone knows a better one I will be happy to know. 我知道一个Flash Player是flowplayer,即使有人知道更好的Flash Player,我也会很高兴知道。

In any case, as I understood from a brief google search, there are no players that can play .avi/.mpeg files, but they can only play .flv files. 在任何情况下,据我从简短的Google搜索中了解到,没有播放器可以播放.avi / .mpeg文件,但他们只能播放.flv文件。

I began searching for ways to convert my user's avi's/mpeg's and found that I can use ffmpeg to convert the video to .flv using system(). 我开始寻找转换用户的avi / mpeg的方法,发现我可以使用ffmpeg使用system()将视频转换为.flv。

Is this the best solution for me? 这是对我来说最好的解决方案吗? I feel like ffmpeg takes a lot of CPU and once I have enough users the server will crash.. 我觉得ffmpeg占用大量CPU,一旦我有足够的用户,服务器就会崩溃。

Thanks! 谢谢!

Just an outline 只是一个轮廓

(Note: i don't own nor wrote a PHP video sharing site, so treat these like tips) (注意:我既不拥有也不编写PHP视频共享网站,因此请像技巧一样对待这些内容)

  • Set up your web server and PHP to be capable of accepting large files via HTTP 设置您的Web服务器和PHP,使其能够通过HTTP接受大文件
  • Let users upload their videos via a web interface 让用户通过网络界面上传视频
  • Upon successful upload add uploaded video to a queue 成功上传后,将上传的视频添加到队列中
  • Set up a fully server side script that handles video processing (No PHP) 设置处理视频处理的完全服务器端脚本(无PHP)
  • Run a cron job on this queue when your server is able to crunch uploaded videos 当您的服务器能够处理上传的视频时,对此队列执行Cron作业
  • Notify users when videos are done 视频制作完成后通知用户

Hope it helps in some way. 希望它能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM