1

I'm using this script: GitHub Script Link

This script uses FFMPEG to convert MP4 to AVI and from AVI to MP3. But I always getting the error:

You must have installed FFMPEG in order to use this function

But I have installed FFMPEG on my Linux Server. This is the output of my CLI (puTTY):

FFMPEG

As you can see I have it installed. I'm sorry the script is to big to post it here but you can take a look.

Thanks for every help!

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
  • try running `which ffmpeg` and see what you get. That's what the script does to detect it: `private function has_ffmpeg() { $sh = `which ffmpeg`; return (bool) (strlen(trim($sh)) > 0); }` – ADyson Sep 25 '17 at 08:43
  • maybe your ffmpeg folder is not on the $PATH? – Daniel Maiochi Sep 25 '17 at 08:44
  • 3
    You forgot to cross out u85540703 in the first line of the screenshot. – Alex Blex Sep 25 '17 at 08:47
  • @AlexBlex oh lord fail hahah :D upvote granted ... –  Sep 25 '17 at 08:56
  • @ADyson you mean I should run which ffmpeg in PuTTY or as PHP Code? –  Sep 25 '17 at 08:56
  • @Daniel Maiochi how can I check that? And if not how can I add that? –  Sep 25 '17 at 08:56
  • @lukay97 directly in PuTTY. That's what the script is doing (it just start a shell in the background and executes the command and captures the output. Then it checks if there's any output or not and bases its response on that). – ADyson Sep 25 '17 at 08:57
  • @ADyson I executed it and I dont get anything. No Error No Output. Just a new line. –  Sep 25 '17 at 09:01
  • "No output" is the key. Look at that function I posted. It returns false if there's no output from the shell script (i.e. the length of the response is 0). So the script considers that ffmpeg is not installed. `which` only searches through folders defined in your `$PATH`. Therefore, as Daniel said, make sure your $PATH contains the folder in which the ffmpeg executables are stored. http://www.thegeekstuff.com/2012/07/linux-export-command-examples/ shows you how to check, and how to add things. You can find loads more examples online, for all the various distros. – ADyson Sep 25 '17 at 09:05
  • Please post this comment as answer so I can mark it as Solution. Thank you –  Sep 25 '17 at 09:08

1 Answers1

1

Run which ffmpeg from your PuTTY console, and see what you get. That's exactly what the script does to detect it:

private function has_ffmpeg() { 
  $sh = `which ffmpeg`; 
  return (bool) (strlen(trim($sh)) > 0);
}

It returns false if there's no output from the shell script (i.e. the length of the response is 0).

which only searches through folders defined in your $PATH. If you get no output when you run that command directly, then the script will get the same. This means the script considers that ffmpeg is not installed.

Therefore, as mentioned in the comments already, make sure your $PATH contains the folder in which the ffmpeg executables are stored. http://thegeekstuff.com/2012/07/linux-export-command-examples shows you how to check, and how to add things to it. You can find loads more examples online, for all the various distros.

ADyson
  • 57,178
  • 14
  • 51
  • 63
  • I cant get it how I can set the PATH to ffmpeg. So if you have time can you provide me an example how I can set it? –  Sep 25 '17 at 09:23
  • Try as per this, (using the profile for the user account that the script will run under): https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux . Depending on your distro it might be a different file. You can look it up. – ADyson Sep 25 '17 at 09:30
  • Distro is Linux. I'm very new to Linux. So I dont understand anything on this Stack Thread. I only want that I get the Path when my Script executes "which ffmpeg". But even with this tutorials I dont know how to get it work. My Path of ffmpeg is src/ffmpeg-3.3.4/~/bin –  Sep 25 '17 at 09:37
  • No, O/S is Linux. Distro is like Ubuntu, CentOS, Fedora, one of those. Have you actually followed those instructions? What did you do? What was the result? I can't really tell you any more than what is written there already, other than my hint to make sure you do it for the user account under which your webserver will run, because it's that context in which the script will run and get the path. – ADyson Sep 25 '17 at 10:07
  • Oh. Well then its Ubuntu –  Sep 25 '17 at 10:10
  • ok so those instructions in that link I gave are specific for Ubuntu anyway. I mention it only because some distros have small differences in the ways and locations they store some of these settings. BTW how did you install ffmpeg, exactly? – ADyson Sep 25 '17 at 10:12