Reputation: 11
I downloaded ffmpeg
and installed it composer. when I try to use the basic usage code I'm getting this error. In the bin folder, I have ffmpeg
, ffplay
and ffprobe
exe files. Also I have environment variable set for the c:ffmpeg\bin
.
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
This is my php code;
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');`
Upvotes: 0
Views: 3080
Reputation: 186
make sure you are giving correct path of the binaries , this error is just because script is not able to found binaries ,
so maybe if m not wrong you are giving the wrong exe files name
just change this
$ffmpeg = \FFMpeg\FFMpeg::create([
'ffmpeg.binaries' => 'c:\ffmpeg\bin\binffmpeg.exe',
'ffprobe.binaries' => 'c:\ffmpeg\bin\binffprobe.exe'
]);
into this one
$ffmpeg = \FFMpeg\FFMpeg::create([
'ffmpeg.binaries' => 'c:\ffmpeg\bin\ffmpeg.exe',
'ffprobe.binaries' => 'c:\ffmpeg\bin\ffprobe.exe'
]);
you are repeating bin\bin two times,
c:\ffmpeg\bin\binffprobe.exe
good luck,
here is just a sample code to convert video into mp3
require_once 'vendor/autoload.php';
$ffmpeg = \FFMpeg\FFMpeg::create([
'ffmpeg.binaries' => 'ffmpeg\bin\ffmpeg.exe',
'ffprobe.binaries' => 'ffmpeg\bin\ffprobe.exe'
]);
$video = $ffmpeg->open('video.mp4');
//just in case you want to save thumbnail from video
$video
->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(300))
->save('frame.jpg');
//extract audio
$video->save(new FFMpeg\Format\Audio\Mp3, 'audio.mp3');
Upvotes: 1