Ashraf Hefny
Ashraf Hefny

Reputation: 538

Find the correct FFmpeg path in php

I am using FFmpeg with PHP on CentOS server. the php code is

$thumbnail = $this->generateRandomString(25);
$ffmpeg = "/usr/bin/man"; // or /usr/share/ffmpeg {not working}
$videoFile = $_FILES['file']['tmp_name'];
$imageFile = "uploads/images/video_thumbnail/$thumbnail.jpg";
$size = '340x250';
$getFrom = 10;
$cmd = "$ffmpeg -i $videoFile -an -ss $getFrom -s $size $imageFile";
shell_exec($cmd);

When running command $whereis FFmpeg

output is : ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz

So what's the correct path.

Upvotes: 2

Views: 18289

Answers (2)

Shai Alon
Shai Alon

Reputation: 990

This is an old question, but I thought to still add: You can even use the command "type ffmpeg" to get the ffmpeg location.

Upvotes: 0

Sergey Kozlov
Sergey Kozlov

Reputation: 452

Use simpe code:

$ffmpegPath = exec('which ffmpeg');
$ffprobe = exec('which ffprobe');

Upvotes: 4

Related Questions