Opening malformed MP3 files

From Audacity Development Manual
Jump to: navigation, search



In old versions of Audacity, error checking was disabled in Audacity's MP3 importer. However, it was found that some malformed MP3s could cause serious problems, so error checking was enabled.

Unfortunately we subsequently discovered that malformed MP3s are rather common, and received numerous reports of MP3s failing to import.

In recent versions of Audacity the error checking has been toned down so that most MP3s will still import even if they contain small errors. Unfortunately a small number of malformed MP3s are sufficiently damaged that they still get caught by the error checking.

Turning off error checking entirely would be dangerous.

Contents

  1. Malformed MP3 error message
  2. Workaround-1 - using the libmad audio decoder
  3. Workaround-2 - using the FFmpeg audio decoder


Malformed MP3 error message

Sometimes when trying to import an MP3 file you may see the following message:

Malformed MP3 error message.png

This indicates that Audacity's default MP3 importer ("libmad") detected an error in the file.

There are millions of "faulty" MP3 files downloaded from the Internet every day that will play correctly in other software, but not in Audacity.

So the question is: How does one import a "slightly faulty" MP3 that plays in other applications, but is rejected by Audacity's default MP3 importer?

The answer is: Import it with FFmpeg instead of importing with libmad.



Workaround-1 - using the file type filter

In the File > Import > Audio dialog, select "FFmpeg compatible files" as the file type choice filter. See: importable file-types.

Import settings for importing malformed MP3 files.png

Because "FFmpeg compatible files" has been selected, only files that are supported by FFmpeg appear in the file browser, and on selecting a file and clicking the Open button, Audacity will attempt to open the file using FFmpeg.


The benefit of doing it this way is that you will still be able to import properly formed MP3s using libmad, by setting the file type choice filter to "All files", "All supported files" or "MP3 files". This has the benefit that ID3 metadata tags are better supported than when using FFmpeg.


Workaround-2 - using Extended Import rules

This is probably the more convenient method for most users, because you can set it and forget it.

Advice If you use Metadata tags, see "Limitations" below.
  1. Ensure that the FFmpeg library is installed.
  2. Edit > Preferences > Extended Import
  3. Click the Add New Rule button
  4. Type: *.mp3 in the "File Extensions" column.
  5. Drag "FFmpeg compatible files" to the top of the "Importer order" column,
    or click on "FFmpeg compatible files" and then use the Move filter up button repeatedly to move it to the top.
  6. De-select (un-check) "Attempt to use filter in OpenFile dialog first"
  7. Click the OK button
Prefs settings for importing malformed MP3 files.png
Note regarding the setting for "Attempt to use filter in OpenFile dialog first":
  • When enabled, if you select "MP3 files" as the file type filter in the Import (or "open") file browser, then Audacity will attempt to use libmad to import the selected file, and if the selected file is one of these "faulty" MP3 files, then you will see the malformed MP3 error message.
  • When disabled not selected), then the custom "Extended Import" rules apply regardless of the file browser file type filter setting. FFmpeg will always be used for MP3 files.

Limitations

  1. All MP3 files will always be imported in future with FFmpeg, so "Artist" and "Year" tags will not be imported.
  2. FFmpeg does not support Metadata as well as libmad. It misses out the "Artist" and "Year" tags, while libmad supports all of Audacity's metadata fields.