I have never been able to get FFmpeg working with exec() for some reason. If you can't either, then know you can do it using the popen() and pclose() commands.
I'm using it now to run FFmpeg from PHP and convert video files to .flv. It works perfectly, except for one small issue: if you close the process immediately, your page will load, but you have no way of knowing when the conversion is complete. If you leave the process open, you can read from it and get the current conversion status, but then your page will hang blank until the conversion is finished and the process ends.
It's a catch-22 that I'm working on getting around, but for small audio files the conversion shouldn't take too long.
Anyway, the code I'm using:
pclose(popen('ffmpeg -i ORIGINAL_FILE.MP4 -ar 22050 NEW_FILE.FLV 2>&1', 'r'));
(I'm actually trying to monitor the status, but like I said, you don't need to do that for audio files that will convert quickly).
-IMP 😉 🙂