Reducing bitrate in conversion of mp3 and ogg
I can save space by reducing bitrates of songs to x*, the value beyond which humans don't discern any difference. If so, how to reduce the bitrates with CLI:
1. mp3 to mp3 conversion
2. during mp3 to ogg conversion
3. ogg to ogg conversion
Of course, if the original bitrate is inferior than this "x", I don't want to artificially increase, I dare say.
* Reference to other question: What is the maximum audio bitrate humans can distinguish?
Solution 1:
Do not do this. Transcoding from a lossy format to another lossy format will only decrease quality. You won't save any meaningful space. No matter if it is from mp3 to mp3, ogg to ogg or mp3 to ogg. You will lose quality. They are called lossy formats for a reason.
Do the test yourself: convert the same song 5 (or 10) times from 128 to 128. Yes, same bitrate. Quality will be inferior than original file. Every conversion introduces artifacts that will lower the perceived quality. A file that was transcoded from 320 to 256 than to 160 will sound worse than if encoded directly from source to 160
If you really want to save space, get your original, un-encoded, lossless files, and convert them once to your desired bitrate. My strong suggestion? Go VBR. lame's -V5 for casual listening (average ~130, much higher quality than any other 160 or 192 CBR), or -V3 if you're very picky about quality.
Do not use CBR if you're trying to save space. Its a dumb format: why keep a constant, say, 160 kpbs if some passages of the song would require much less than that to achieve "perceived perfection"? Those "wasted" bits could be used more efficiently in other passages where complexity (lots of instruments, multiple (and high) frequencies, etc) would require more bits.
VBR can do that. Goes up all the way to 320 when that is needed, to keep quality, and reduce down to 96 (or less) to save space when it doesnt require many bits for same perceived quality.
In other words: VBR's are both more economical (saves when not needed) and higher quality (increases when needeed). A wise choice if you want a good balance between less disk space and great quality.
Solution 2:
To do this you could use ffmpeg with libavcodec-extra-52.
cd
to the directory of the file, then:
ffmpeg -i input.file.mp3 -ab 64 -f ogg output.ogg
or
ffmpeg -i input.file.mp3 -ab 64 -f mp3 output.mp3
The number after -ab
is the bitrate. If you want to use VBR then replace -ab
for -aq
.
Be aware of MestreLion advice.