Question

We are designing an application that needs to support uploading short audio files from the client side (wav, aiff, ogg, flac, mp3, ...)

It should also support playing those songs in the client application after downloading them from the server (no need for streaming at the moment) and also exporting them to the users' local computer.

In what format should we store those files in the server?

For example if one user uploaded a wav file, should we store it in the server as an mp3 file?

Thank you

Was it helpful?

Solution

There is no best format as such. Depends on use cases. Let us analyze yours

  • Users will upload files from clients in various formats
  • You want user clients to play files after downloading them

Optimization parameters would be - Quality of audio - Time take to download a file (size of files) - Future efforts and device support

Quality of audio: If you transcode properly with reasonable bitrate there isn't too much quality loss. That is the whole point of mp3/aac compression anyways. You can't tell the difference between 128Kbps AAC 44.1 KHz and a raw sample unless you had fantastic audio equipment in the first place and a good set of ears. So unless this is content production application don't worry too much. Ensure you give reasonable quality.

Size of files: Wav files will be big compared to compressed content.

Future proofing and device support:

The most commonly supported audio formats are mp3 and aac. AAC is better than MP3. But you should get a good encoder for it (say nero). If your clients are PC's HE-AAC is a good choice. If it is mobile devices stick to AAC-LC. (no support for HE-aac in many of them) In the future if you add streaming (I am guessing you will, it is the next logical step) the choice becomes more important. Not all devices support mp3 streaming. AAC streaming is more common.

Give all of the above I would say go for AAC.

OTHER TIPS

Generally, you will want to keep the original quality asset, if you have the space to do so. Converting from one lossy format to another degrades quality.

That being said, if you get a WAV file, you can losslessly compress that to FLAC and cut 30-50% of the file size down. (Don't convert lossy compressed files, such as MP3, to FLAC as you will actually be making the file bigger.)

For the transcoding part, I recommend looking into FFMPEG.

It will be better if you use Transcode-and-store approach, 1) this will enable you to make sure that you have associated required metadata and other techdetails with the audio uploaded by the user before storing them in data base

2) having one common audio format will also enable you to manage the data easily

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