繁体   English   中英

PHP-FFMpeg前提条件

[英]PHP-FFMpeg prerequisites

我正在尝试实现 https://github.com/PHP-FFMpeg/PHP-FFMpeg

我将src / FFMpeg文件夹复制到了我的include文件夹,并确保自动装带器知道在哪里可以找到所有内容。

作为测试,我编写了一个脚本,该脚本可以简单地执行以下操作:

 
 
 
 
  
  
  $ffmpeg = FFMpeg\\FFMpeg::create(); $video = $ffmpeg->open('video.mpg');
 
 
  

我得到:

 
 
 
 
  
  
  Fatal error: Class 'Doctrine\\Common\\Cache\\ArrayCache' not found in /var/www/php/include/FFMpeg/FFProbe.php on line 203
 
 
  

我的问题是:PHP-FFMPeg是否需要Doctrine,因为文档中未对此进行说明。 我需要什么版本? 还有其他先决条件吗?

我可以为此提出一个新问题,但是我不确定是否应该这样做。 我现在已经实现了PHP-ffmpeg。 我正在使用Laravel,但是与这个问题无关。 我正在尝试启用进度监视。 它可以工作,但是我需要传递一个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); }); 

我需要澄清“ on”方法。 我浏览了https://ffmpeg-php.readthedocs.org/en/latest/_static/API/ ,但无法弄清楚此方法的工作原理。 任何帮助,将不胜感激。

您应该按照README中推荐的说明进行操作

Composer是安装PHP-FFMpeg依赖项的最简单方法

在格式上调用的“ on”方法是EventEmitter的实现。 如您所见: https ://ffmpeg-php.readthedocs.org/en/latest/_static/API/FFMpeg/Format/ProgressableInterface.html它扩展了https://github.com/igorw/evenement的EventEmitterInterface。

如果您真的对它的幕后工作方式感兴趣,请在此处查看:在此处创建进度监听器: 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提供的驱动程序

希望这可以帮助 :)

暂无
暂无

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

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