gpt4 book ai didi

PHP-FFMpeg 先决条件

转载 作者:行者123 更新时间:2023-12-04 23:00:43 27 4
gpt4 key购买 nike

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

我将 src/FFMpeg 文件夹复制到我的包含文件夹中,并确保我的自动加载器知道在哪里可以找到所有内容。

作为测试,我制作了一个简单的脚本:

$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,以便我可以更新 memcache 中的正确键。
$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);
});

我需要澄清“开”的方法。我浏览了 https://ffmpeg-php.readthedocs.org/en/latest/_static/API/并且无法弄清楚这种方法是如何工作的。任何帮助,将不胜感激。

最佳答案

您应该关注 recommended instructions in the 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 提供的驱动程序

希望这可以帮助 :)

关于PHP-FFMpeg 先决条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21288373/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com