0

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.

5
  • probably because you're missing the starting / on your -i. Commented Mar 18, 2015 at 14:51
  • 1
    Check destination directory permissions Commented Mar 18, 2015 at 14:51
  • sorry that's my mistake,i have given '/' in my code,i have updated my code Commented Mar 18, 2015 at 14:52
  • destination file folder permissions are 0777 given Commented Mar 18, 2015 at 14:53
  • Give me any suggestions i have struggling with this issue. Commented Mar 18, 2015 at 14:57

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

I removed the new-line characters from your command since this breaks the command (notice it's a single line with no "Enter" in it).
in my code i have written echo exec($cmd) is it correct?
Php using my own folders

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.