[英]PHP-FFMpeg prerequisites
I'm attempting to implement
https://github.com/PHP-FFMpeg/PHP-FFMpeg
我正在尝试实现
https://github.com/PHP-FFMpeg/PHP-FFMpeg
I copied the src/FFMpeg folder to my includes folder and made sure my autoloader knows where to find everything.
我将src / FFMpeg文件夹复制到了我的include文件夹,并确保自动装带器知道在哪里可以找到所有内容。
as a test I made a script that simply does:
作为测试,我编写了一个脚本,该脚本可以简单地执行以下操作:
$ffmpeg = FFMpeg\\FFMpeg::create(); $video = $ffmpeg->open('video.mpg');
I get:
我得到:
Fatal error: Class 'Doctrine\\Common\\Cache\\ArrayCache' not found in /var/www/php/include/FFMpeg/FFProbe.php on line 203
My question is: does PHP-FFMPeg require Doctrine, because that is not stated in the documentation.
我的问题是:PHP-FFMPeg是否需要Doctrine,因为文档中未对此进行说明。
What version do I need?
我需要什么版本?
Are there other prerequisites?
还有其他先决条件吗?
I could create a new question for this, but I'm not sure if I should. 我可以为此提出一个新问题,但是我不确定是否应该这样做。 I now have PHP-ffmpeg implemented.
我现在已经实现了PHP-ffmpeg。 I'm using Laravel, however that should be irrelevant for this question.
我正在使用Laravel,但是与这个问题无关。 I'm trying to enable progress monitoring.
我正在尝试启用进度监视。 It works, however I need to pass in an ID so I can update the correct key in memcache.
它可以工作,但是我需要传递一个ID,以便可以更新内存缓存中的正确密钥。
$id = 12345; $format->on('progress', function ($audio, $format, $percentage) { //this works perfect, but doesn't tell me which item is being updated Cache::put("progress", $percentage, .25); //this does not work as I am unable to pass in $id, if I add it as the 4th argument above it will display the number of threads or something //Cache::put("{$id}_progress", $percentage, .25); });
I need clarification on the "on" method. 我需要澄清“ on”方法。 I looked through https://ffmpeg-php.readthedocs.org/en/latest/_static/API/ and was not able to figure out how this method works.
我浏览了https://ffmpeg-php.readthedocs.org/en/latest/_static/API/ ,但无法弄清楚此方法的工作原理。 Any help would be appreciated.
任何帮助,将不胜感激。
You should follow the recommended instructions in the README . 您应该按照README中推荐的说明进行操作 。
Composer is the easiest way to install PHP-FFMpeg dependencies Composer是安装PHP-FFMpeg依赖项的最简单方法
The "on" method called on the format is an implementation of EventEmitter. 在格式上调用的“ on”方法是EventEmitter的实现。 As you can see here : https://ffmpeg-php.readthedocs.org/en/latest/_static/API/FFMpeg/Format/ProgressableInterface.html it extends the EventEmitterInterface of https://github.com/igorw/evenement .
如您所见: https ://ffmpeg-php.readthedocs.org/en/latest/_static/API/FFMpeg/Format/ProgressableInterface.html它扩展了https://github.com/igorw/evenement的EventEmitterInterface。
If you're really interested about how it works under the hood, have a look at here : The progress listener is created here : https://github.com/PHP-FFMpeg/PHP-FFMpeg/blob/master/src/FFMpeg/Format/Audio/DefaultAudio.php#L96 and added at execution here https://github.com/PHP-FFMpeg/PHP-FFMpeg/blob/master/src/FFMpeg/Media/Video.php#L151 This is actually possible because FFMpegDriver extends the Driver provided by https://github.com/alchemy-fr/BinaryDriver 如果您真的对它的幕后工作方式感兴趣,请在此处查看:在此处创建进度监听器: https : //github.com/PHP-FFMpeg/PHP-FFMpeg/blob/master/src/FFMpeg /Format/Audio/DefaultAudio.php#L96并在此处执行时添加https://github.com/PHP-FFMpeg/PHP-FFMpeg/blob/master/src/FFMpeg/Media/Video.php#L151实际上这是可能的因为FFMpegDriver扩展了https://github.com/alchemy-fr/BinaryDriver提供的驱动程序
Hope this helps :) 希望这可以帮助 :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.