我下载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');`