How convert High bitrate mp3 to lower rate using ffmpeg in android

Android Team picture Android Team · Mar 22, 2017 · Viewed 20.7k times · Source

We want to convert 320kbps mp3 file to 128kbps mp3 so currently we are using below ffmpeg command but its not working.

ffmpeg -i input.mp3 -codec:a libmp3lame -qscale:a 5 output.mp3

Result:-the output bitrate same as input mp3.

And we are following the FFmpeg Encoding guideline for that here is the link :- https://trac.ffmpeg.org/wiki/Encode/MP3

so please suggest any solution.

Answer

VC.One picture VC.One · Mar 28, 2017

I tried your shown command (tested on Windows / commandline) :

ffmpeg -i input.mp3 -codec:a libmp3lame -qscale:a 5 output.mp3

Result : It works for me. However the -qscale:a 5 makes FFmpeg decide on an average bitrate for you. With one (320k) MP3 file I got it giving a close convert of 134kbps. This is expected since :

lame option   Average kbit/s  Bitrate range kbit/s    ffmpeg option
   -V 5             130           120-150                -q:a 5

Solution :
Instead of making the internal mp3 frames hold different bitrates (that vary to acommodate the "current" perceived audio, eg: think "silent" parts using smaller rate of bits/bytes compared to "busy" audio parts), so just set a constant bitrate of 128kbps as you need.

I would just set it to constant 128kbps manually and explicitly with :

ffmpeg -i input.mp3 -codec:a libmp3lame -b:a 128k output.mp3