2

I've searched the internet for days to find out how to install ffmpeg (and lame) on XAMPP for Mac (PHP). But I didn't find the key to my quetsion.

I need to covert mp3's on my webserver (php) using lame, but I like to test it on my XAMPP for Mac first. I think I need the "php_ffmpeg.dll" which can be downloaded at Sourceforge. I found a step-by-step description here but this question only refers to XAMPP for Windows. But I need it for Mac.

Can anyone help to supply a step-by-step description?

Community
  • 1
  • 1
Guido Lemmens 2
  • 2,317
  • 5
  • 23
  • 29

1 Answers1

3

The DLL file is not what you need, they're only for Windows.

Follow these instructions to install ffmpeg on your Mac, then use one of PHP's program execution functions to call the ffmpeg executable from your PHP code.

bfavaretto
  • 71,580
  • 16
  • 111
  • 150
  • I have installed lame like described in the instruction of your first link. Converting mp3's on my command prompt is working fine now! I try to use the execution functions in php like "exec" but this seems to fail, even after restaring my Xampp server locally. Do you know how to config php.ini to use exec functions? – Guido Lemmens 2 Jan 24 '12 at 17:36
  • Sorry, I don't know! But I googled it and haven't seen many similar issues... All I could say is, pass the full path for lame to `exec`, and make sure you're not running PHP in safe mode. – bfavaretto Jan 24 '12 at 17:56
  • Yes, i disabled save mode, but still nothing happens with a test script. Any suggestions? – Guido Lemmens 2 Jan 24 '12 at 18:00
  • I will give an example of php code: `code exec("lame track1.mp3 -m m -S -f -b 16 --resample 8 track1_1.mp3");` – Guido Lemmens 2 Jan 24 '12 at 18:07
  • Try passing the full path to lame, like `exec("/full/path/to/lame track1.mp3 -m m -S -f -b 16 --resample 8 track1_1.mp3");` (replace "/full/path/to" with the path to the actual directory where the lame binary was installed). Also, use full paths to the input and output files. – bfavaretto Jan 24 '12 at 18:12
  • Hmmm.. does this sounds a bit strange? The lame binary has installed outside of the Xampp webserver somewhere on my mac (i have no clue where it has been instelled). But i will give it a try.. – Guido Lemmens 2 Jan 24 '12 at 18:15
  • That's normal, if you followed those instructions exactly, it should be under your user home, at `~/lame`(i.e., full path to the binary would be /Users/YourUsernameHere/lame/lame) – bfavaretto Jan 24 '12 at 18:19
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/7014/discussion-between-guido-lemmens-2-and-bfavaretto) – Guido Lemmens 2 Jan 24 '12 at 22:20
  • Well, i've figured it out: To find the (local)location of the lame encoder path just run `locate lame | grep bin` in de cmd prompt. My lame encoder was located in `/usr/local/bin/lame`, so the php-code would be `exec("/usr/local/bin/lame track1.mp3 -m m -S -f -b 16 --resample 8 track1_1.mp3");` Thanks for your patience @bfavaretto – Guido Lemmens 2 Jan 25 '12 at 00:45
  • Just a tip, in the instruction for the installation of ffmpeg is a SVN repository mentioned for getting the ffmpeg source, but they recently moved to git. So now use `git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg` instead of `svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg`. – Koen. Feb 09 '12 at 21:11