How to convert wav to ogg and mp3 using VBR
How to convert wav to ogg and to mp3 with VBR and excellent end quality?
If possible, using soundconverter
or ffmpeg
.
Incidentally, I tried to see whether soundconverter
uses VBR and there is nothing about it in the GUI preferences, so it is not clear. Does it?
Solution 1:
For MP3, I strongly suggest using Lame , considered by many (including me) THE best MP3 encoder, specially for VBR.
sudo apt-get install lame
And to encode:
lame -V 5 file.wav file.mp3
This will create a high-quality MP3 VBR file around ~130kbps, which is great for casual listening. Use -V 3
for average bitrates around ~200kbps
If you want to create id3v1 and id3v2 tags at the same time, you can use:
lame -V 5 --add-id3v2 --pad-id3v2 --ignore-tag-errors --ta artist --tl album --tt title --tn track --ty year --tg genre --tc comment file.wav file.mp3
For OGG, the most traditional encoder is Vorbis
sudo apt-get install vorbis-tools
And to encode:
oggenc -q 3 -o file.ogg file.wav
Ogg is VBR by default. -q 3
stands for default quality, you may change 3 from -1 to 10, or omit the option. Also, output file is optional. If you omit -o file.ogg
it will automatically create a file with same name as input and .ogg extension. It also supports multiple input files (you can encode several at once, for example, using *.wav)
And for tagging:
oggenc -a artist -t title -l album -G genre -c comment -o file.ogg file.wav
Last but not least, since you seem to be very interested in encoding, an amazing forum for audio technical details and awesome source of knowledge is HydrogenAudio
And, for GUI, you said it yourself: soundconverter
is a great choice. It does have VBR for MP3 (for OGG, its the format's default, so don't worry).
Solution 2:
For Variable bitrate in OGG format, transform it with ffmpeg which is avconv on Ubuntu (see here for difference)
avconv -i inputFileName -c:a libvorbis -qscale [0-255] targetFileName.ogg
Quality for qscale option
- 0: worst quality
- 255: best quality
Which one to choose
My tests results are followings
- <= 6 is the quality <= 192kb/s and a difference could be listened, but for voice 1 is sufficient and from a flac music file (which is lossless file format) @ 5 I cannot tell the difference
- For High quality music prefer values upper than 8. But from a flac >10 the file size was not higher, and for the following example, I cannot tell the difference after 8 even with strong bass and trebles.
Results of testings from a flac file
From a recording of an album I think is a reference in term of recording and mastering quality, preceding digits are the qscale values, sizeof file and resulting bitrate
0_Michael_Jackson-Dangerous_01.Jam.ogg 2.7M 65 kb/s
1_Michael_Jackson-Dangerous_01.Jam.ogg 3.3M 81 kb/s
2_Michael_Jackson-Dangerous_01.Jam.ogg 4.1M 100 kb/s
3_Michael_Jackson-Dangerous_01.Jam.ogg 4.8M 116 kb/s
4_Michael_Jackson-Dangerous_01.Jam.ogg 5.4M 131 kb/s
5_Michael_Jackson-Dangerous_01.Jam.ogg 6.9M 169 kb/s
6_Michael_Jackson-Dangerous_01.Jam.ogg 8.5M 209 kb/s
7_Michael_Jackson-Dangerous_01.Jam.ogg 11M 248 kb/s
8_Michael_Jackson-Dangerous_01.Jam.ogg 12M 294 kb/s
9_Michael_Jackson-Dangerous_01.Jam.ogg 15M 365 kb/s
10_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
11_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
12_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
13_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
14_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
15_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
16_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
17_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
18_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
19_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
20_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
21_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
22_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
23_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
24_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
25_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
26_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
27_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
28_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
29_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
30_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
31_Michael_Jackson-Dangerous_01.Jam.ogg 20M 491 kb/s
Michael_Jackson-Dangerous_01.Jam.flac 39M