Climb Tree
Climb Tree

Reputation: 490

Change MP3 bitrate

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?

Upvotes: 0

Views: 2034

Answers (1)

TGrif
TGrif

Reputation: 5941

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.

Upvotes: 1

Related Questions