0

I've read this question How to convert a web form uploaded mp3 to wav using PHP and ffmpeg? that is the reverse process I need. I think it's necessary to use ffmpeg-php. How can I install it to my linux server (I think there's Debian, certainly Apache 2.2.16) and manage the ffmpeg-php extension only for one site, a virtualhost? Have I to modify php.ini or there's another way to manage the extensions?

Community
  • 1
  • 1
chattago2002
  • 45
  • 2
  • 15
  • Firstly StackOverflow is about programming questions, not server configuration. The way your question is currently worded, it is not possible to give you any real advice as you have not specified exactly what OS and version is in use,( you need to be sure if it is Debian rather than think it could be ), the configuration and packages used are very different for different OS's so without that information any answer will be at best a guess which could break your configuration. – Anigel Jun 10 '13 at 16:10
  • Why do you need the ffmpeg-php extension at all? The linked question invokes the `ffmpeg` binary via `shell_exec` or similar, which doesn't require a PHP extension; since PHP extensions [can't reliably be loaded at runtime](http://php.net/manual/en/function.dl.php) and [by nature can't be loaded per virtualhost](https://bugs.php.net/bug.php?id=30100), you're not really gaining anything by using ffmpeg-php, except perhaps an object-oriented interface whose use in this context would require abandoning entirely the rather sensible solution you already have to hand. – Aaron Miller Jun 10 '13 at 18:00

1 Answers1

0

The link you reference is using shell_exec so here's how you can do what you are asking in shell_exec:

shell_exec('ffmpeg -i ' . $_FILES['uploadedfile']['tmp_name'] . ' file.mp3');

That converts the the uploaded file to file.mp3. Change file.mp3 to be wherever you want the file.

chrislondon
  • 12,487
  • 5
  • 26
  • 65
  • what I've to do is the convertion of an audio file (usually from wav to mp3) immediately when the file is uploaded by the user to my server. I'm here to listen your advices :) – chattago2002 Jun 11 '13 at 08:54
  • What do you want to do with the file after it's converted? The code I posted can be used in your PHP code where the form sends the data. – chrislondon Jun 11 '13 at 13:26