RaMeSh
RaMeSh

Reputation: 3424

FFMPEG not working in php code

I have tried with ffmpeg for video thumbnail creation. In windows its working fine, but in Linux(centos) it's not working.

i have tried the following command:

 $cmd = "/usr/local/bin/ffmpeg -i  /opt/lampp/htdocs/mydashboard/sites/default/files/content_videos/".$video."
-ss 00:00:01.435 -f image2 -vframes 1     /opt/lampp/htdocs/mydashboard/sites/default/files/content_images/".$videoname."-thumb.jpg";

    echo exec($cmd);

The abovecommand is working in the Linux command line and thumbnails are creating in destination folder, i have given static video file.

But the same command is not working as expected in the php script.

Any help is greatly appreciated.

Upvotes: 0

Views: 785

Answers (1)

aergistal
aergistal

Reputation: 31227

You have a new-line character in your command. Use a single line:

$cmd = "/usr/local/bin/ffmpeg -i  /opt/lampp/htdocs/mydashboard/sites/default/files/content_videos/".$video." -ss 00:00:01.435 -f image2 -vframes 1     /opt/lampp/htdocs/mydashboard/sites/default/files/content_images/".$videoname."-thumb.jpg";

Also, the -ss parameter needs to be before -i in order to seek the input file.

Upvotes: 2

Related Questions