16

I have used the avconv utility to convert an MP4 file downloaded from Youtube to an MP3:

$ avconv -i RembrandtPussyhorse.mp4 RembrandtPussyhorse.mp3
avconv version 0.8.9-6:0.8.9-0ubuntu0.12.10.1, Copyright (c) 2000-2013 the Libav developers
built on Nov  9 2013 19:12:35 with gcc 4.7.2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'RembrandtPussyhorse.mp4':
Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2013-06-23 14:26:41
Duration: 01:03:42.60, start: 0.000000, bitrate: 167 kb/s
    Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 384x288, 69 kb/s, 25 fps, 25 tbr, 50 tbn, 50 tbc
    Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 96 kb/s
    Metadata:
    creation_time   : 2013-06-23 14:27:30
Output #0, mp3, to 'RembrandtPussyhorse.mp3':
Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    TDEN            : 2013-06-23 14:26:41
    TSSE            : Lavf53.21.1
    Stream #0.0(und): Audio: libmp3lame, 44100 Hz, stereo, s16, 200 kb/s
    Metadata:
    creation_time   : 2013-06-23 14:27:30
Stream mapping:
Stream #0:1 -> #0:0 (aac -> libmp3lame)
Press ctrl-c to stop encoding
size=   89594kB time=3822.65 bitrate= 192.0kbits/s    
video:0kB audio:89593kB global headers:0kB muxing overhead 0.000284%

$ ls -la
-rw-rw-r-- 1 dotancohen dotancohen  91743973 Dec 26 11:24 RembrandtPussyhorse.mp3
-rw-rw-r-- 1 dotancohen dotancohen  80171515 Jun 24  2013 RembrandtPussyhorse.mp4

Notice that the MP3 file (audio only) is now larger than the input MP4 file (audio and video). Double-blind listening tests with the two files leads to consistent results within people (i.e. the same person says that the same file sounds better) but inconsistent across people (i.e. different people disagree as to which is better).

Is there any objective way to determine if the sound quality degraded in the conversion? I don't have the original CD to compare to. I do realize that sound quality could not have increased, but if there is a tool that could, say, analyze the waveform or such and give a value of 'quality' then I would be interested. This needs to run on Kubuntu Linux. Thanks.

1
  • 1
    "Sound quality" can be subjective (how does it sound to you or me, which you've done) or objective (how closely does a copy of the sound correspond to the reference sound). If you're looking for a measure of deviance from the original, there may be tools that will help. Maybe. If you want to know which one sounds best? Pick for yourself. Sound itself is subjective, and I'd simply listen to the two one a range of audio equipment, and then make a choice which one you'd keep based on your observations. Dec 26, 2013 at 19:45

5 Answers 5

11

If you truly want an objective measure, load both files into a tool that can do basic effects processing and mixing (Audacity for instance), and then invert one and mix them together. What ever is left is the difference between the two files - if they were identical, only pure silence should remain.

3
  • This, sir, is an wonderfully elegant idea (assuming they start/end at the same time). Jun 15, 2016 at 11:25
  • 3
    This is good for telling if the files are different, but not for telling if one is objectively better.
    – dotancohen
    Dec 19, 2022 at 6:44
  • While this does not cover the general case of comparing audio quality, in my case I was specifically looking for a way to know if converting a wav to flac 16-bit was indeed preserving all information, and this proved it right.
    – hsandt
    Jan 22 at 19:52
8

The most scientific way to identify changes or degradation between the two files is viewing the waveform on an oscilloscope.

You can use a audio editing program like Audacity to see if there is any clipping in either file. You may also want to apply a limiter or replay gain to the file.

Foobar has an ABX Comparator tool that will do a blind comparison of two audio files or clips. The listener votes a specified number of times as the tracks are played and the results are shown at the end so that the listener is not influenced by right or wrong answers throughout the test.

2
  • 3
    This is probably your best bet. Most people have untrained ears, so they can't hear the differences between compressed music and FLAC-style recordings. Dec 26, 2013 at 20:46
  • 3
    @LeeHarrison Especially when listening through commodity equipment. Dec 27, 2013 at 2:35
6

Just in case, in addition to the other answers (e.g. Derek Charles's), the steps:

  1. Import both audio/video files into Audacity (video may require FFmpeg);

  2. Apply "Invert" effect to any single one (i.e. Audacity -> Menu -> Effect -> Special -> Invert);

  3. Match the time of the tracks:

    enter image description here

  4. Select both tracks and create a "mix" of these (e.g. Audacity -> Menu -> Tracks -> Mix -> Mix and Render to New Track):

    enter image description here

    As it's seen, the mix contains data and it means that the tracks are not identical. Let's try another.

  5. The following mix seems relatively oddly empty, silent, or lonely... isn't it?:

    enter image description here

    Just in case, the "negative" spectrogram means it's "selected" (e.g. via mouse).

  6. Let's verify if the mix has at least anything! To do so, we could try checking the extremum of the amplitude or "volume". To do, Audacity has an effect called "Amplify" (i.e. Audacity -> Menu -> Effect -> Volume and Compression -> Amplify...):



    Field New Peak Amplitude indicates -Infinity which means that there is no data to calculate, thus the "mix" track stores no audio - the sources of the mix are identical.

  7. And voila!


If the tracks were identical, the result will be silence. To check that it is absolute silence, select the full (mix) track, and open the "Amplify" effect. If the Amplify effect says that the "New Peak Amplitude" is "-infinity", then the mix track is totally silent and the two imported files have identical audio.

Source: at forum.audacityteam.org

4
  • 4
    This is Derek Charles' answer, but it is nice that you include the explicit steps. This method is good for telling if the files are different, but not for telling if one is objectively better.
    – dotancohen
    Dec 19, 2022 at 6:45
  • @dotancohen true, but if you were able to compare both files to a non-compressed (or just simply higher quality) source file, then the one with the inverted mix track which contains less data is going to be closer to the origin/source. Basically, a three-way diff (if you're familiar with source code merge tools).
    – James
    Jan 22, 2023 at 0:45
  • @Artfaith is there any way of aligning the time of the tracks besides just zooming wayyyy in and manually eyeballing it?
    – James
    Jan 22, 2023 at 0:48
  • @James, I believe it would require some sort of AI since the data may differ too much in case of compression or pre-editing for example. It may include such tasks as to locate the first "note" and match all the "notes" throughout the whole masterpiece of yours (i.e. time-scaling, cross-fading etc.). Please check the following: forum.audacityteam.org/viewtopic.php?t=85515#p276600 (How To align two different recordings of the same source...), manual.audacityteam.org/man/audio_alignment.html , manual.audacityteam.org/man/tracks_menu_align_tracks.html
    – Artfaith
    Jan 22, 2023 at 20:23
4

What you could do is to import both files in a audio editor such as Audacity. Invert one of the imported songs and you can now listen to the "difference" between them. Note that you have to be spot on e.g. the waveform need to be perfectly aligned for this to work.

From here on you can see what is "missing" (or added) to the source waveform and a spectrum analyzer or spectrogram will show you the details.

1

You can use Audacity to open file and review the waveform, it would be a manual process.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .