I usually use gstreamer for such purposes, since it automatically detects most media formats and decodes them for you:
gst-launch filesrc location=input-file ! decodebin ! audioconvert ! audioresample ! lame bitrate=192 ! filesink location=output-file.mp3
Of course, you will have to call it from PHP as a separate process, but still.
source
share