I was wondering if anyone had any advice for encoding a user uploaded .wav file to a .mp3 extension. I would like to build a PHP solution if possible. Can I call the command line LAME encoder via PHP once a file has been uploaded? Is there a better option?
Thanks!
Go ahead and call LAME. No chance of a better option existing, even more so if you take the encoder quality into account.
The easiest way to call into an external binary is exec
, while for the best integration over the encoding process you might want to use proc_open
.
I wrote a wrapper for LAME that provides convenient interface to encode wav file(s). The library is available here: https://github.com/b-b3rn4rd/phplame
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With