|Metrics on how you upsample an mp3
||[Sep. 8th, 2008|04:59 pm]
A little thought on mp3s, upsampling, ubuntu (gutsy) and ffmpeg.
So, any techy will see the word "upsample" and think "Oh, why do you want to do that? Really? Why? You'll not get any extra quality that way". To be honest, I'm not looking to get quality out of thin air, but I AM looking to get some stuff working on my mp3 player, and it only likes particular sample rates (otherwise everything sounds like anyone involved are severely hypothyroid patients are on barbiturates). So I did a bit of Googling, and the results were difficult to sift out, so I decided to share it with the blagosphere at large.
So, if the Ubuntu forums were to be believed, you install some packages from medibuntu, decode your mp3, resample with sox, and recode with lame. This is actually a bad plan. For some reason I can't place, this mega-inflates the new mp3. You go from about a 7.5meg file to a 30meg file. Not impressive. True, it was from 11kHz to 44kHz, and maybe a 4-time increase is to be expected, but mp3s should be able to compress it better than that, especially as you fill in junk in the middle. Even on best encoding/compression quality, it wasn't a great save.
It was later that I came across the fact that lame has a "--resample" option. It's not as bad, space-wise but still pretty bad. But not as bad as getting sox involved.
Turns out the big winner is ffmpeg. If you're going from a sample rate of 11kHz to 44kHz with it takes just over twice the space. In my mind, that's really not as bad. I'd like to see better, but at least it means I can get all of the files I wanted to upsample onto my player without using incredible amounts of space.
For those who are interested, the command used was:
ffmpeg -i infile.mp3 -ar 44100 outfile.mp3