0

I am creating something for media delivery, especially audio distribution. I am free to use Node.js on my server as backend.

I want to store only high quality audio tracks on my server and now the problem is that I want to allow user to download that track in lower bitrate also. Suppose I saved a track of 320 kbps on my server and give user an option to download that track in 128 or 64 kbps. How can I choose a library for this task?

One more question, is it possible to store the audio track of lower bitrate and then converting it into higher bitrate on backend?

halfer
  • 19,824
  • 17
  • 99
  • 186
Climb Tree
  • 490
  • 1
  • 7
  • 15

1 Answers1

1

I would use ffmpeg for the bitrate conversion (command found here).

const spawn = require('child_process').spawn;

let bitrate = '128K';
let convert = spawn('ffmpeg', ['-i', 'in.mp3', '-b:a', bitrate, 'out.mp3'])

And yes, you can store an audio track at a lower bitrate and convert it to higher bitrate, but this a destructive operation. Do not expect quality to be left unchanged by doing that.

TGrif
  • 5,725
  • 9
  • 31
  • 52
  • Hey TGrif Thanks for your response. I wanted to know that have you tried this yourself. TGrif I didn't get your answer to the second part of the question. Can you explain that once again? `Do not expect quality to be left unchanged by doing that.` – Climb Tree Dec 02 '17 at 15:06
  • Sure, I tried. The bitrate is the amount of data which describe a sound for a period of time, so if you decrease that value, the sound will be lose a part of its frequency spectrum, and you will not be able to recover the lost frequency if you force an higher bitrate convertion after that. But I guess while the sound is good enough, that will not be a major issue. – TGrif Dec 02 '17 at 16:00