Question

I need a MP3 as well as an OGG version of audio files uploaded by users. Most people just convert MP3 over to OGG and keep both files on-hand. I, however, would prefer to use a PHP file instead that would take the MP3, format it as an OGG, and then display. So a PHP script that only temporarily converts it for the user. I've looked all over and the only thing I can find are scripts that save the file as an OGG, instead of just changing it before display.

So, is this possible, or is keeping two files on-hand the only way to provide both display formats?

Was it helpful?

Solution

While it's possible to do the conversion on-demand by shelling out to some sort of conversion utility like ffmpeg, avconv, or mencoder, doing so is CPU-intensive, and will make your server fall over under even relatively light load. Doing the conversion ahead of time is going to work much better at scale, and is far simpler too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top