我下載ffmpeg
並安裝它作曲。當我嘗試使用基本使用代碼時,出現此錯誤。在bin文件夾中,我有ffmpeg
,ffplay
和ffprobe
exe文件。另外,我爲c:ffmpeg\bin
設置了環境變量。在窗口上安裝php ffmpeg
Fatal error: Uncaught exception
'Alchemy\BinaryDriver\Exception\ExecutableNotFoundException' with message 'Executable not found, proposed : c:\ffmpeg\bin\binffprobe.exe' in C:\xampp\htdocs\core\vendor\alchemy\binary-driver\src\Alchemy\BinaryDriver\AbstractBinary.php:160 Stack trace: #0
C:\xampp\htdocs\core\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\Driver\FFProbeDriver.php(48): Alchemy\BinaryDriver\AbstractBinary::load('c:\ffmpeg\bin\b...', NULL, Object(Alchemy\BinaryDriver\Configuration)) #1 C:\xampp\htdocs\core\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\FFProbe.php(207): FFMpeg\Driver\FFProbeDriver::create(Array, NULL) #2 C:\xampp\htdocs\core\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\FFMpeg.php(117): FFMpeg\FFProbe::create(Array, NULL, NULL) #3 C:\xampp\htdocs\core\demo2.php(9): FFMpeg\FFMpeg::create(Array) #4 {main} Next exception 'FFMpeg\Exception\ExecutableNotFoundException' with message 'Unable to load FFProbe' in C:\xampp\htdocs\core\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\Driver\FFProbeDriver.php:50 Stack trace: #0 C: in C:\xampp\htdocs\core\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\Driver\FFProbeDriver.php on line 50
這是我的php代碼;
require_once 'vendor/autoload.php';
$ffmpeg = \FFMpeg\FFMpeg::create([
'ffmpeg.binaries' => 'c:\ffmpeg\bin\binffmpeg.exe',
'ffprobe.binaries' => 'c:\ffmpeg\bin\binffprobe.exe'
]);
$video = $ffmpeg->open('video.mpg');
$video
->filters()
->resize(new FFMpeg\Coordinate\Dimension(320, 240))
->synchronize();
$video
->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
->save('frame.jpg');
$video
->save(new FFMpeg\Format\Video\X264(), 'export-x264.mp4')
->save(new FFMpeg\Format\Video\WMV(), 'export-wmv.wmv')
->save(new FFMpeg\Format\Video\WebM(), 'export-webm.webm');`