Covert .mp3 to .wav and .ogg from command - gHacks Tech News

Covert .mp3 to .wav and .ogg from command

I have a ton of various music files on my machine that are in various states of migrating from .mp3 to different formats. The primary reason for this is because of the issue of licensing between Linux and the MP3 format. And although there are GUI tools to do nearly every job you need, there are times when the command line is still your friend. For instance, say you want to do batch jobs - the command line is good for this. Or say you want to (for whatever reason) secure shell into a remote machine and then convert your files. For whatever reason you need, it's good to know that the tools are available for the job.

The tools I am talking about are mpg123 and mpg321. Although mpg321 claims to be a drop-in replacement for mpg123, I still prefer to use both tools (the former for converting .mp3 to .wav and the latter for converting .mp3 to .ogg). And in this article you will see how simple it is (using the command line) to convert these file types.

Installation

Since we will be using the command line for the conversion, we'll install the tools from the command line. The distribution I am using for example is based on the recent, stable Debian. You will not need to add any repositories to your /etc/apt/sources.list file, because all of the tools are found on the standard repositories. To install these tools, follow these steps:

  1. Open up a terminal window.
  2. If needed, su to root (if you use sudo in place of root, just add sudo to the beginning of the installation commands below).
  3. Issue the command apt-get install mpg123 mpg321 vorbis-tools

That's it. Now let's take a look at how the tools are used.

Convert .mp3 to .wav

The first conversion is to .wav. Why use .wav? First and foremost, the .wav file is not compressed and is lossless, so the sound is better. The only downfall is that the files are much bigger. So, if you have a particular file and you want to retain as much quality as you can, .wav is the format to use. Of course, in this instance we are converting a lossy file type (.mp3) so there is already diminished sound quality. But why diminish it further? To make this conversion, the command looks like this:

mpg123 -w output_file.wav input_file.mp3

Where output_file is the name of the .wav file that will be converted from the mp3 file named input_file. So let's say you want to convert the file Rush_Tom_Sawyer.mp3 to .wav. That command would look like:

mpg123 -w Rush_Tom_Sawyer.wav Rush_Tom_Sawyer.mp3

Convert .mp3 to .ogg

The .ogg format is the open source equivalent to .mp3 and is supported by many players. The .ogg format is a good format to use when creating "mix cd's" (I'm old, I still want to say "mix tapes"), because you can fit more files per CD than if you were using the .wav format. But to convert the .mp3 to .ogg the command looks like:

mpg321 Input_File.mp3 -w raw && oggenc raw -o Output_file.ogg

Let's examine the same file we converted to .wav above. The command to convert to .ogg from .mp3 would look like:

mpg321 Rush_Tom_Sawyer.mp3 -w raw && oggenc raw -o Rush_Tom_Sawyer.ogg

Easy right?

Final thoughts

Now you can get crafty and create batch scripts that will allow you to do batch conversions. Naturally many will think "Why would I go through that, when I can just download a handy GUI tool like Soundconverter to do the job? Why? Because it's always smart to have the command line option around. One day you might need it.





  • We need your help

    Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

    We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.

    If you like our content, and would like to help, please consider making a contribution:

    Comments

    1. Backtrack said on February 5, 2010 at 5:07 pm
      Reply

      I just wanna thank Jack for his useful articles about Linux.

    2. David Herman said on February 5, 2010 at 7:47 pm
      Reply

      Thanks for your articles, they show that the command line is not nearly as confusing as its reputation. Learning a couple of commands at a time soon leads to being comfortable w/ using the cli.

      Just thought I’d mention that conversion from one lossy format (mp3) to another (ogg) often gives (and should be expected to result in) files that have extremely degraded sound quality. (un listenable)

      Since each format “throws away” different pieces of the original audio file you end up w/ the worst of both worlds.

      I wish there were a way to restore the original quality audio from these formats but that is just not possible. Your best bet for good quality is to start w/ an uncompressed source or a lossless format such as flac.

      Thanks for the article, I just didn’t want people to follow the examples blindly, converting all of their mp3’s to ogg and then blaming the ogg format for their ruined music collection.

      Thanks

    3. Dave said on February 5, 2010 at 10:32 pm
      Reply

      Correct me, if I am wrong but I can’t quite see the point of trying to up-convert a relatively low quality mp3 file, which has already had the stuffing knocked out it (approx. 90% thrown away from a genuine .wav file or standard CD track), to what should be a higher quality format. The information has already been lost, so there is no way it will sound any better on conversion. Probably worse if converted to another lossy format. In the case of an mp3 to wav convert, it will just take up needless space with no gain in quality whatsoever. Can’t be improved. No point. As previous poster David Herman intimates, for top notch quality, original .wav files are the way to go for the ultra-fussy, although I have to say I have no problem listening to an mp3 with a higher bit-rate.

    4. OWl said on February 6, 2010 at 12:38 pm
      Reply

      As stated above.. converting an mp3 to wav will give you nothing in terms of quality, it will sound the same as the mp3 while taking up around 10 times as much harddrive space. Not very useful.
      And transcoding between two lossy formats isn’t very recommended either… It will just come out worse quality wise.

      As for the mp3 vs. linux issue…There are ways to play mp3’s on a linux box, haven’t had any issues yet.

    5. unknown said on February 7, 2010 at 2:40 am
      Reply

      Just like the previous post said, but I’ll make it simpler: whenever you convert something there’s a loss. This is a fact connected to any conversion not being 100% perfect (which is a physical impossibility). Digital formats aim at reducing this problem with great success, but still this fact must be considered — if only in principle.

      So converting mp3 to wav leads to the same sound at most. But one might use it for mp3-incompatible older equipment or for licensing reasons, as the article mentions.

      Converting mp3 to ogg saves some space because it uses less bytes for the same sound quality. One problem now is that fewer equipment plays ogg than those which play mp3. Again, no quality gain is possible.

      Perhaps a better idea would be converting wav sounds to mp3 or ogg to save space.

      If one uses KDE, it is possible to create new right-click actions associated with mp3, wav or ogg.

      Thus did a friend of mine, so that he can just right-click on a file and click on “Convert to mp3” or “Convert to ogg”. Pretty easy.

      Another good idea is converting mid or mod music to mp3/ogg for e.g. listening while driving. Sounds great.

      Or so my friend said to me. ;-)

    6. click here to convert any files to OGG, Pookito's Way said on February 7, 2010 at 5:46 am
      Reply

      Dude, nice bolg, but I do have a different version of all this. I think that the most powerful tool for Vorbis conversion is ffmpeg2thora. With that tool I can take any music file and convert it Vorbis AKA “OGG” format. I included a link to my Blog but the short version is ffmpeg2thora –novideo –no-skeleton input.file -o outputfule.ogg and there you have it. you can also use the -V option to specifiy the bitrate that your file would need, like -V 128 would just work. any how. nice talking to you

      Click on the link above and it will take you to my blog,

    7. kwanbis said on February 7, 2010 at 6:11 am
      Reply

      Wow, you are promoting transcoding from mp3 to ogg? That is very bad idea. At most, do MP3 to FLAC.

    8. thomas.tmc said on February 7, 2010 at 10:48 pm
      Reply

      “because of the issue of licensing between Linux and the MP3 format”

      Has there ever not been an issue? I can’t remember when there wasn’t and MP3s have still been easy enough to play on Linux and most probably always will be. Are you saying to use linux you must give up MP3/M4A MPEG/MPEG-4, DVDs, BDs, etc? This statement just seems totally insane to me. Maybe it’s just because I value the sound of my music and understand how compression devastates it. I can see switching formats, and just ripping CDs in OGG instead of MP3, or downloading lossless FLACs and converting them to OGG, but to recode MP3s because of a silly reason such as “the issue of licensing between Linux and the MP3 format” is nuts. I just read this article and all I hear is, “Guess what guys, I found a great way to get to the bottom of the cliffs real quick, you just jump off. When I get out of the Hospital I’ll show you, it’s great.”

    9. zvaral said on February 8, 2010 at 11:13 am
      Reply

      Converting mp3 to ogg won’t mean quality degradation! This is a misbelief! Both encodings use Fast Fourier Transformation (FFT) to compress the wav doing this that way that they cut out some frequency ranges from the sampled sound in the spectral region. So if you convert your mp3 to wav it will have the same quality than the mp3. If you compress your wav to ogg it will have the same quality than the wav because the ogg conversion cut out those frequencies which have already been missing from the original mp3.

      By the way thanks for the article. I use this method very frequently because my Chinese mp4 player, fortunately, plays the ogg format as well.

    10. kwanbis said on February 8, 2010 at 2:26 pm
      Reply

      Where did you got that bs zvaral? MP3 would drop some information, Vorbis would drop some more information. Quality would be worse. I recommend you to go to hydrogenaudio to learn.

    11. zvaral said on February 8, 2010 at 2:55 pm
      Reply

      mp3 compression cut the “unnecessary” high and low frequency components of the sound (and compress). ogg compression does the same but allowing more frequency components than mp3. Frequency threshold is different but ogg would consider a broader range of frequency (say better quality). When you re-compress your wav file ogg compression will not cut any additional frequency because that information is already missing due to the original mp3 compression. Q.E.D.

    12. kwanbis said on February 8, 2010 at 3:05 pm
      Reply

      lossy encoders like ogg and mp3 work by discarding information. Your mp3’s have had sound information discarded, by converting to ogg you will be discarding even more information. That said, depending on the original material, the target bitrate, and the listeners ears, they COULD not hear a difference. But it doesn’t means that quality has not degraded from the original MP3, and it does not means that some other persons would not be able to hear the quality lose. Again, do yourself a favor, and go to http://www.hydrogenaudio.org to educate yourself.

    13. zvaral said on February 8, 2010 at 4:27 pm
      Reply

      I still have the necessary education and you, kwanbis, should understand the simple fact that ogg compression of a lossy format is not simple subtraction but filtering. If you have ten apples and two of them are rotten and you through away the rotten ones (mp3 conversion) you still have eight apples. If you give them to anybody else and tell him to filter out the rotten apples (ogg conversion) you still remain eight apples. This is simple, isn’t? Therefore mp3 to ogg conversion does not essentially degrade the quality.

    14. kwanbis said on February 8, 2010 at 4:32 pm
      Reply

      You are COMPLETELLY WRONG. If you where right, i could take an original OGG, uncompress it to WAV, compress it again, repeat 20 times, and the final OGG should be the same as the first OGG. Try it. And let me know.

    15. zvaral said on February 8, 2010 at 4:40 pm
      Reply

      Yes, the final ogg should have the same quality like the first one if you use the same compression level in each recompression step. The second step does not take away anything from the original file just filter it the same way as it was done by the original compression. I can see you start to understand.

    16. kwanbis said on February 8, 2010 at 4:43 pm
      Reply

      No, no. I’m asking YOU to try that. It is NEVER the same file.

    17. zvaral said on February 8, 2010 at 6:10 pm
      Reply

      Ok. The experiment was performed and I have to report that my theory was proven. Namely the first ogg file is practically the same than the last one decoded and compressed ten times.

      Let’s see what I did. I had a wav file:
      10 Mozart – Alleluia.wav

      I used the following command to compress to an ogg file having a file name of ‘a.ogg’ and a bitrate of 128 kbit/sec:

      oggenc -b 128 –managed 10\ Mozart\ -\ Alleluia.wav -o a.ogg

      You can see the ogginfo output of the file here below:
      Processing file “a.ogg”…

      New logical stream (#1, serial: 276a7d0e): type vorbis
      Vorbis headers parsed for stream 1, information follows…
      Version: 0
      Vendor: Xiph.Org libVorbis I 20070622
      Channels: 2
      Rate: 44100

      Nominal bitrate: 128.000000 kb/s
      Upper bitrate: 4294967.295000 kb/s
      Lower bitrate: 4294967.295000 kb/s
      Vorbis stream 1:
      Total data length: 2697192 bytes
      Playback length: 2m:51.106s
      Average bitrate: 126.105759 kb/s
      Logical stream 1 ended

      What is followed now is a loop to decode the ogg file and reencode it with the same bitrate ten times:

      for p in `seq 1 10`
      do
      oggdec a.ogg
      oggenc -b 128 –managed a.wav
      done

      The ogginfo output of the final ogg:

      Processing file “a.ogg”…

      New logical stream (#1, serial: 4cdfa231): type vorbis
      Vorbis headers parsed for stream 1, information follows…
      Version: 0
      Vendor: Xiph.Org libVorbis I 20070622
      Channels: 2
      Rate: 44100

      Nominal bitrate: 128.000000 kb/s
      Upper bitrate: 4294967.295000 kb/s
      Lower bitrate: 4294967.295000 kb/s
      Vorbis stream 1:
      Total data length: 2696857 bytes
      Playback length: 2m:51.106s
      Average bitrate: 126.090096 kb/s
      Logical stream 1 ended

      What you can see that the average bit rate decreased during the ten compressions with 0.016 kb/s which belongs to a relative error of 0.000126 which result shows that the changes are really unsignificant! This is practically zero! Do you understand, this is 0.012% whereas every measurement has an acceptable relative error of 1-5%. Also change of the file size is in this range of magnitude too.

      Finally the ten times compressed ogg file had an excellent quality. I mean like the first one.

      I hope you are convinced!

      1. benq said on February 8, 2010 at 6:53 pm
        Reply

        @zvaral: Sorry, the fact that the bitrate is “practically the same” does not tell you anything ybout the sound quality! Wow, after 10 conversions you have white noise and this white noise ist at 128 kb/s … practically the same bitrate than the original *music* file.

        So, I have done the following:
        – convert some of my *.ogg files (quality 8 encoded) into *.mp3 (vbr);
        – transfer the transcoded files on my media players (Nokia 5800 XM or Cowon D2, each used with the same UltimateErars 5 SuperFi Pro In Ear) and
        – listen to them.
        Result: I can do a blind test and identify the transcoded files easily. I can hear a rather remarkable quality loss on the transcoded files.

        Therefore, I would not recommend transcoding from any lossy file format into any other lossy file format.

        If one wants to do a more mathematical test of this: take a *.wav (a), compress to *.mp3, transcode to *.ogg, uncompress to *.wav (b) and then compare *.wav (a) and *.wav (b) with audacity (or use your ears).

    18. kwanbis said on February 8, 2010 at 6:27 pm
      Reply

      1st, “practically the same” is not “the same”, meaning, there where changes, meaning your theory is wrong. 2nd, how did you checked the quality? Did you ABX the thing?

    19. harriseldon said on February 8, 2010 at 7:30 pm
      Reply

      pacpl is a good tool as well (Perl Audio Converter)
      pacpl.sourceforge.net
      It has built-in mass processing options as well

    20. zvaral said on February 8, 2010 at 10:08 pm
      Reply

      Dear benq, you state something which is not supported by facts. How did you do the conversion which yielded a worse quality mp3? As you could see I gave an exact explanation and documented my claims. And everyone can follow and test what I did. And I gave also an ear test after all which seemed perfect. Therefore the white noise theory is wrong.

      Dear kwanbis, you stated if I compress an ogg file twenty times all compression will give a different file. I proved this is not true. At least among rational frames. I do not understand how somebody can be so simple that he/she does not understand all the mathematics behind these algorithms and say bs to a well established claim. Sad story.

      1. benq said on February 10, 2010 at 3:19 pm
        Reply

        Sorry, I did not make a scientific theory about that, I used what comes with Amarok’s transcoding capacities, however, the end result files had about the same size (vbr) than the input ogg files, so I am confident that the transcoding did attempt to match the bitrate as closely as possible.

        Here is what the “makes” of vorbis say:
        You can convert any audio format to Ogg Vorbis. However, converting from one lossy format, like MP3, to another lossy format, like Vorbis, is generally a bad idea. Both MP3 and Vorbis encoders achieve high compression ratios by throwing away parts of the audio waveform that you probably won’t hear. However, the MP3 and Vorbis codecs are very different, so they each will throw away different parts of the audio, although there certainly is some overlap. Converting a MP3 to Vorbis involves decoding the MP3 file back to an uncompressed format, like WAV, and recompressing it using the Ogg Vorbis encoder. The decoded MP3 will be missing the parts of the original audio that the MP3 encoder chose to discard. The Ogg Vorbis encoder will then discard other audio components when it compresses the data. At best, the result will be an Ogg file that sounds the same as your original MP3, but it is most likely that the resulting file will sound worse than your original MP3. In no case will you get a file that sounds better than the original MP3.

        see http://www.vorbis.com/faq/

        I can confirm the above quote with my unscientific test. I did what average Joe would do and I can trust my ears. mp3 to ogg is a don’t.

    21. kwanbis said on February 8, 2010 at 10:19 pm
      Reply

      zvaral, if you where right, recompressing a file would give the EXACT same file.

      Not only did you mention it was not the same (you said almost the same), but doing a very simpe test, you can find out:

      I did this test, starting with a WAV song:

      oggenc -q 5 0.wav -o 1.ogg && oggdec 1.ogg && md5sum 1.wav
      1387e468ebbf492f3ed1f35035c64a0b 1.wav

      oggenc -q 5 1.wav -o 2.ogg && oggdec 2.ogg && md5sum 2.wav
      dfb05b074b151b167142914677a15f5a 2.wav

      oggenc -q 5 2.wav -o 3.ogg && oggdec 3.ogg && md5sum 3.wav
      67e8db83ae3937efb6914fd5ca1b9eec 3.wav

      oggenc -q 5 3.wav -o 4.ogg && oggdec 4.ogg && md5sum 4.wav
      752d7db0afccc41eb118dca11075a654 4.wav

      oggenc -q 5 4.wav -o 5.ogg && oggdec 5.ogg && md5sum 5.wav
      40c67f4b4ebe19e0bd5c9a49eaf300f4 5.wav

      oggenc -q 5 5.wav -o 6.ogg && oggdec 6.ogg && md5sum 6.wav
      07ecb05413b464ebaaa4bb3d76ebd576 6.wav

      As you can see, each time, the md5 checksum is different.

      That means there have been changes on the file.

      Not only that, i did an analysis of the original file, and the final file, here is the screen, after 20 iterations. As you can see, the information is not the same:

      http://imgur.com/YDTXI.png

      http://imgur.com/vUcgY.png

    22. zvaral said on February 8, 2010 at 11:43 pm
      Reply

      I am very sorry but your test is wrong. If you had checked what I had written in my test you would have seen this immediately. You had had to use the –manage option because oggenc would use the VBR encoding algorithm by default. You need a CBR encoding if you want to get something similar to the previous encoding. I hope I do not have to explain why.

      Once more (and last) the difference in a few bits (0.012%) between two large music files does not make sense and won’t be distinguished with any human sense. By the way this negligible, very small difference is also a property of the fast Fourier transformation due to the high sensitivity of small numerical values at the edge of the filtering function.

    23. kwanbis said on February 9, 2010 at 12:16 am
      Reply

      You just show you don’t understand the encoding process.

      Ok, i did the CBR 128, 20 times, as you wanted. Each time, the MD5 was different:

      e442a998a8bd93725e3a5de99f727ba8 a.wav
      b4d41cb8e2685f6982352880fb3b438f a.wav
      aab47387fbc5bf1239182b38cf10c75c a.wav
      af6f28b957609aa1b4b97e6bd40478e6 a.wav
      5294d9e3bdd27f5db0eee5bb0ac33d0a a.wav
      b24fe2e6e18338c16bf75b1ffec0f074 a.wav
      85e27e05fe04c034eee517e4a920bbff a.wav
      e837928aa7c0083e9ec1b05a5a9b06ad a.wav
      f1a8255cbb69f88d12500cf6214a4901 a.wav
      115f5882000ccf7eb76fdf12853a8a73 a.wav
      731820e658a07fc40ddff071f1f37101 a.wav
      1bc92d747e87761886aaff94286385a4 a.wav
      175dd2aeea415df432cb7d900063faa2 a.wav
      d2c73a805afc960e84070e81e683f4f5 a.wav
      566cd0055107191379f0ad7fdecd267c a.wav
      67b789479c0d6e3b3e65ae9c1667aceb a.wav
      d1784ee02d1d71a799669342703f39e3 a.wav
      3d8d0a96f54344cfdebd87d1f4fd65a1 a.wav
      b2b2f48d7c79a6e9f56b044dd298eef2 a.wav
      7db46b04cc37795f2e403fe8bb2309d3 a.wav

      Then, i did 2 graphs of the original and final wav, with audacity.

      http://imgur.com/89MrG.png

      http://imgur.com/X1Yuu.png

      Again, this probes, if it ever was the need, you are wrong.

      I invite you again to go to hydrogenaudio to lear a little bit.

      You would find very knowledgeable people.

    24. zvaral said on February 9, 2010 at 10:04 am
      Reply

      You are wrong again! Of course if you have a single bit difference between two files the md5sum will give a totally different result. This is not a proof! And I do not say that two files after recompression will be 100% same but 99.988%. On the other hand you do not know what you are doing. Of course, you do not have to compare the original wav file and the ten times compressed one. But a compressed file and a later compressed one. Your graphs clearly shows that you used the original wav file first because the high frequency components are presented but second you use a compressed and decoded file where the high frequency components are missing. This is what sound compression do. Finally, I invite you to study a bit more Fourier analysis and do not cheat!

      1. thomas.tmc said on February 9, 2010 at 11:08 am
        Reply

        zvaral, you are wrong…

        Just based on the psychoacoustic model of the encoder alone, both OGG and MP3 would have to use very close to the same model, which they don’t. All the various MP3 encoders implement widely varying psychoacoustic models, while OGG’s approach is unique.

        Also, it’s not true to say that since the original audio has already been encoded at 128 kbps once it will not be effected by re-encoding it again at 128 kbps.

        I’ll give you that not always does the common sense result turn out to be the actual result… but in this case it is. Lossy compression put through more lossy compression actually results in extremely LOSSY compression. Go figure…

    25. Owl said on February 9, 2010 at 12:53 pm
      Reply

      I’m gonna skip any screens of wavefoms, MD5 checksums and what have you and just get to it..

      First off you sort of assume that the ogg and mp3 formats are one and the same, that the codecs used to encode do exacly the same things.. this is not true. Vorbis and Lame (for instance) does things differently, discard different things in different ways.. They are not the same and do not remove the same things.

      And if you don’t believe me… take it from the Vorbis guys themselves.
      http://www.vorbis.com/faq/#transcode

      Alright on to the test…
      I tried several different ways of encoding, using “-b 128” for the mp3s and the same settings on the ogg conversion as you zvarai.

      1. wav –> mp3 –> wav –> mp3… repeat until you’ve done it 10 times.
      2. wav –> ogg –> wav –> ogg… repeat.
      3. wav –> mp3 –> wav –> ogg… repeat.
      4. wav –> mp3 –> ogg –> mp3… repeat.
      5. wav –> mp3 –> mp3 —> mp3… repeat.

      you can see where this is going right..?

      6. wav –> ogg –> ogg –> ogg… repeat.

      Results then…
      The difference between the first and the second encode is nominal in all tests, hard to tell a difference, but they do sound a little different. The difference between the first and the last encode, in all tests, is like night and day.. encode ten sounds really really bad. I don’t know how you can’t hear a difference man, it’s an apparant change in sound. It sounds like some old streaming realmedia file (if you remember those). You can listen to them in sequence and you’ll hear the sound gradually degrade as you go.

      Anyways.. I didn’t really do this for an online argument, but to settle my own curiosity after reading your results.

    26. zvaral said on February 9, 2010 at 3:21 pm
      Reply

      Dear Folk,

      I know mp3 and ogg is different. But the final problem was if you reencode an ogg file many times if it degrade the quality. This although a little relate to encoding from mp3 to ogg.

      Please, see my analysis here below and decide your self.

      https://docs.google.com/fileview?id=0BzG2hFQvTug6NTcyMTI3ZWQtYmYzMS00MDhmLWE3NDUtMDA2NDMxM2RmOWRl&hl=en

      Yours

    27. kwanbis said on February 9, 2010 at 6:51 pm
      Reply

      zvaral, First of all, this post was about mp3 -> ogg. Then you stated that your theory was only applicable between OGG -> OGG. Anyway.

      Since it seems it is difficult for you to grasp the concepts, let me try to give you an analogy. If you go to a models party (wav file), it would be easy to discard the ugglier ones (first encode), since they would stand out easily from the models. Now, if you make a party, each time with the remaining ladies, it would be each time more difficult to discard uggly ones, cause you already did on the previous parties.

      Now, so you can really see what i mean, i have encoded a WAV once, and then 99 more times.

      And since you like numbers so much, i have this graphics for you.

      Do you still think they look the same?

      Try it, encode a wav 1 and another 99 times, and then LISTEN to the songs. Do you think they sound the same? (If you do, you should go to a doctor).

      http://imgur.com/j2xvw.png
      http://imgur.com/E7jkP.png
      http://imgur.com/kZqFi.png
      http://imgur.com/IvfPE.png

    28. zvaral said on February 10, 2010 at 3:09 pm
      Reply

      I made some analyses on mp3 and ogg conversions and also to convert from one format to an other one. The results are really-really exciting!!! I recommend it for anybody. You will see that ogg has a superior performance over mp3!

      The document is here:
      https://docs.google.com/fileview?id=0BzG2hFQvTug6NWY3ZGUyMTEtYTA4Yi00NDYzLTgyZDUtZTZiNTJiMGUxOWJj&hl=en

    29. kwanbis said on February 10, 2010 at 3:19 pm
      Reply

      zvaral. Because of the nature of the psycoacustic methods, comparing graphics is not correct to determine if an encoder is better than other. In general, Vorbis is a better format than MP3, but LAME, has improved so much, that most users won’t tell the difference. I recommend you again to go to hydrogenaudio an learn a little. In HydrogenAudio, you would find the devs of foobar2000, lame, vorbis, nero aac, flac, wavpack, tak, eac, dbpoweramp, etc. People that have been working for YEARS on audio issues.

    30. Owl said on February 10, 2010 at 3:23 pm
      Reply

      “But the final problem was if you reencode an ogg file many times if it degrade the quality.”
      The answer to that is yes zvaral. That’s a nice pdf and all but did you actually listen to the 10th encode you did? I think not, because if you did you wouldn’t be arguing. A thought experiment and a theoretical conclusion does not suffice, it doesn’t matter how nicely presented it is :)

      I did check the frequency grafs in Audacity and they are very similar, not an exact match, but very similar. The audio however isn’t when you LISTEN to it. Do the experiment and listen to the files ok.

      Or listen to my test, nothing fishy in the zips, just 3 wav/ogg files. After 1, 10 and 20 ogg encodes done exactly as you wrote zvaral. It’s a 30s snippet of one of my own crappy tunes, so don’t worry about any copyright stuff :)
      The 3 wav files: http://www.sendspace.com/file/ntphd1
      Or the 3 ogg files: http://www.sendspace.com/file/z2ufl9

    31. zvaral said on February 10, 2010 at 5:41 pm
      Reply

      You are right guys, it may occur that the quality changes. But not this is what I wanted to tell you. What I wanted to tell you is that this is not statutory! What I claim is that quality loss converting from one format to an other one is not essential. Ok, it may occur, but if you know what you do this is not always happen.

      This is supported by benq as well who gave us some quotes from the vorbis faq:

      “The decoded MP3 will be missing the parts of the original audio that the MP3 encoder chose to discard. The Ogg Vorbis encoder will then discard other audio components when it compresses the data. At best, the result will be an Ogg file that sounds the same as your original MP3, but it is most likely that the resulting file will sound worse…”

      Thus, at best you will obtain the same quality ogg which fact is also scientifically justified by my document posted a few hours before:
      https://docs.google.com/fileview?id=0BzG2hFQvTug6NWY3ZGUyMTEtYTA4Yi00NDYzLTgyZDUtZTZiNTJiMGUxOWJj&hl=en

      Take Care!

    32. kwanbis said on February 10, 2010 at 6:48 pm
      Reply

      “but it is most likely that the resulting file will SOUND WORSE”. Re-Encoding looses a little bit of information each time. How important depends on the listener ears. There are people that can tell on the first encode, and there would be people that can not tell after 5 encodes. But you ALWAYS LOOSE QUALITY at each re-encode. Even on the same format.

    33. zvaral said on February 10, 2010 at 7:53 pm
      Reply

      By the way Owl, you did not do the same than me because you used VBR encoding instead of CBR. Of course, it is very difficult to keep the quality using VBR after subsequent compressions. My 10 times compressed file has almost the same quality than the first compression. And the difference is only that amount you can see on the graphs I posted in the first document (because there are some):
      https://docs.google.com/fileview?id=0BzG2hFQvTug6NTcyMTI3ZWQtYmYzMS00MDhmLWE3NDUtMDA2NDMxM2RmOWRl&hl=en

    34. Owl said on February 10, 2010 at 10:01 pm
      Reply

      If it’s VBR it’s because you used VBR, since I used the exact same switches as you when encoding… As I clearly stated :)

    35. zvaral said on February 11, 2010 at 11:50 am
      Reply

      The problem with your sound sample, Owl, is that it is full of noise-like effects. This means that every spectral components of your sound sample is almost equally presented. (You can try it to plot with the code I showed you before.) This was not my case therefore I had not to care too much about the high frequency components. The simplest solution to get essentially the same sound quality after ten times re-encoding with ogg to choose a higher bit rate because higher frequencies require higher number of sampling points. I’ve tried it with 192 and the quality was OK but you can choose even higher and I am sure you won’t here any difference.

      You have also the choice to change the spectral treatment behaviour of vorbis encoder with the
      –advanced-encode-option
      and their properly selected parameters which helps to prevent loosing any further information after existing encoded files.

      This is also a proof that you can avoid loosing information If you know what you do. So, loosing information after lossy file conversion is not statutory. But everybody speak about that it is always happen which is not true. Not always.

      And do not forget that we are talking about a lot of encodings with the same encoder. In practice you need only one or two encodings. Turning to the original subject you do not have to fear of encoding any mp3 to ogg. The reverse order is problematic (as benq also stated above) but I showed you that mp3 files uses less information and ogg won’t change it after re-encoding with the same parameters.

      Sorry guys, but I have to deal with my official project now.:-) But do not forget mp3 to ogg is ok. See again:
      https://docs.google.com/fileview?id=0BzG2hFQvTug6NWY3ZGUyMTEtYTA4Yi00NDYzLTgyZDUtZTZiNTJiMGUxOWJj&hl=en

      And take care!

    36. kwanbis said on February 11, 2010 at 2:51 pm
      Reply

      Zvaral, you are the most suborn people in the world. Time after time we proved you wrong, gave you reasons, told you to try yo LISTEN to the encodes, etc. You keep telling the same BS.

      EVEN THE VORBIS OFFICIAL PAGE SAYS IT IS WRONG TO DO MP3 TO VORBIS (IT IS NOT CALLED OGG).

      But you keep insisting!

      Yo never replied to my previous post, where i clearly show you the degradation after doing simply 99 encodes (so it is more obvious).

      So, if you want to believe MP3->Vorbis is OK, do so, but do not help spread a lie.

    37. Tom said on April 21, 2016 at 12:50 am
      Reply

      I searched for

      linux convert mp3 to ogg command line mpg321

      for a icecast test with a server

      I have, plan on putting it back online.

      I really could care less about sound quality

      and more about getting some simple ogg files to test with,
      the old files I have linc to use for free are in mp3 format,
      I have to convert them to OGG format.

      I originally got them off CD to mp3, then to wav & had to re-sample to mp3 at 44khz,
      I then converted some to ogg and they sound fine to me over the test station.
      I’m just lookinf for some simple tools to get the job done on a debian system.

      BTW whats the error rate from live recording to cd, or to mp3/ogg on desktop or broadcasting,

      there has to be a lot of loss there?

    Leave a Reply