[FFmpeg-user] convert audio files to serve them on website

David Froger david.froger at mailoo.org
Wed Jan 20 01:03:20 EET 2021


I'm building a website that allow talks to be uploaded (HTTPS POST)
and then be streamed (html5 audio element) or downloaded (HTTPS GET).
I'm also thinking to make them available as podcast. As I have no
experience with audio files, I'm looking for advices.

I would like the upload/download/stream to be as portable as possible:
Currently, the talks may be recorded for example from a voice record, a
smartphone, a tablet. It is then directly uploaded to the website. I've
encountered these formats: (.mp3, .m4a, .3gp) but I would like to
support as much formats as possible. It may then be streamed or
downloaded from one of the major desktop (GNU/Linux, OSX, Windows) or
mobile/tablet (Androïd, IOS) browsers.

So I would like to convert the uploaded file with ffmpeg before serving
it (done by the webserver).

Some questions I have:
- Would .mp3 be the most appropriate format?
- Should I adapt the ffmpeg command according to the input file, or can I use
  an "universal command", something like: ffmpeg -i file.{.m4a,3gp,...} -vn file.mp3
- Should I add "-acodec libmp3lame", or is it implicit from the output
  file .mp3 extension?
- Is there any benefit from adding other options? For example here
  https://stackoverflow.com/a/12952172 I've seen "-ar 44100", but why
  not just keep the input frequency? (same for "-ac 2" and "-b:a 192k",
  why not just keep what is in the input, is it just to optimize the
  size of the output file?) Any other useful option?

Thanks for reading!

More information about the ffmpeg-user mailing list