簡體   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