MP3

From Audacity Wiki
(Difference between revisions)
Jump to: navigation, search
m (ID3 Metadata Tags: typos)
(Tips for troubleshooting MP3 export problems: set a P2 in an existing ednote to maintain focus)
 
Line 55: Line 55:
  
 
==Tips for troubleshooting MP3 export problems==
 
==Tips for troubleshooting MP3 export problems==
{{ednote|'''Peter07Jan17:''' Do some (all?) of these belong better in Manual>FAQ ? }}
+
{{ednote|'''Peter07Jan17:''' [[ToDo-2]] Do some (all?) of these belong better in Manual>FAQ ? }}
 
<div id="hang"></div>
 
<div id="hang"></div>
 
===Crash or excessive processing time on export===
 
===Crash or excessive processing time on export===

Latest revision as of 12:44, 10 November 2017

Gale 08Jan 16: ToDo Check over Talk:MP3 in case anything useful is still there which should be here or somewhere else.
Gale 07May14: I updated this page for current Audacity, though some of what I updated is duplicative of the Manual and could be trimmed. I think we need an MP3 page because of the importance of the format, even if we lose most of the Lame Installation content. I think some of the "troubleshooting content" on that page e.g. the list of valid sample rate/ bit rate combinations is ideal material for this page. MP3 encoding and decoding is such a complex matter that I doubt you could ever fit everything into the Manual.
  • Gale 17Jun14: As per my comment above I reverted your deletion of Lame Installation and set a P2 to incorporate useful material from there to this page (or possibly elsewhere). Lame Installation is also linked to quite a lot so when it is finally deleted, it needs a redirect. I suggest it redirects here because if it goes to the Manual that may not address the question the link was addressing.
    • Peter 07Jan17: I transferred the LAME "Legal Issues" to this page. It's looking likely that after 2.1.3 is released I will deprecate the Lame Installation page, but leave it as s stub page with redirects.
    • Peter 07Jan17: I also transferred the Troubleshooting section - do some (all?) of these belong better in Manual>FAQ ?
MP3  is a size-compressed, lossy audio format. This means that it uses less disk space to store audio than uncompressed formats like WAV, but loses some of the original sound quality in doing so. To reduce the quality loss, the audio removed is mainly outside the adult range of hearing, and the artefacts  it introduces are chosen so they are largely masked by louder or more prominent sounds. The actual quality achieved depends on the bit rate you encode at, higher bit rates giving better quality but resulting in larger files.
Other compressed lossy formats exist that work in a broadly similar way, such as MP2 and the more modern and arguably superior OGG and M4A formats.
 
Related article(s):


Contents

[edit] MP3 support in Audacity using the LAME MP3 encoder

Audacity can both import audio in MP3 format, and export to MP3 format. Audacity can use the LAME  MP3 encoding library in order to export MP3s, but we do not distribute LAME because of patent restrictions. Instead, you need to download LAME separately.

Warning icon

Legal Issues

While the LAME source code is free, the encoding technology that ready-compiled LAME binaries use is patented. The patents are held by Fraunhofer and administered by Thomson. Patenting raises a theoretical possibility that in some countries a user might need to pay a licence fee to legally encode MP3s. This might vary according to the purpose of the encoding and whether the software being used is licensed.

There is no definitive list of countries where the patents unambiguously hold sway. However they are generally assumed to be enforceable in USA, Canada, the EEC and Japan. This means that in these countries (in theory), software that encodes MP3s must be licensed by the patent holders, and that anyone encoding MP3s with unlicensed encoders may also be infringing patents.

The best advice that can be given is that the user makes their own decision, based on their conscience, the country they are in, and taking into account the following:

  • The patent holders have tended to enforce licence fees against commercial rather than free MP3 encoders
  • Thomson themselves have said that no license is needed by individuals creating music libraries of MP3 files for personal use (interpretations vary whether that sanctions using unlicensed encoders, free or otherwise)
  • Existing MP3 patents will expire worldwide between 2010 and 2012 (but not until 2017 in the USA)
  • The possibility remains at least in the USA that patents could be extended.

[edit] Downloading and Installing LAME

Instructions for downloading and installing LAME are in the FAQ section in the Audacity Manual.

[edit] Settings

See the Setup section in MP3 Export Options in the Audacity Manual.

[edit] ID3 Metadata Tags

MP3 files contain "metadata" at the start of the file as ID3 tags . These tags typically contain information such as Track Title, Artist Name, Year and Genre. Some of this information may be visible in the playing window of software and hardware players. The tags can be edited with Audacity's Metadata Tags editor.

See the MP3 Export Options page in the Audacity Manual for details


[edit] Other MP3 editing tools

MP3 files of the same bit rate, sample rate, number of channels and stereo encoding mode can typically be split, joined or volume-adjusted non-destructively with the below tools without the need for lossy re-encoding.

  • MP3DirectCut for Windows (this can also be run on Linux under WINE)
    • MP3 DirectCut can also direct edit raw AAC files (except for volume adjustment). M4A files must be extracted to raw AAC.
  • Audion for Mac OS 8, OS 9 and OS X 10.0 to 10.5 (PPC only)
  • Macsome for OS X (Intel Mac only). It can perform lossless split, trim, cut and volume adjustments on M4A files as well as MP3.
  • mp3splt - Cross-Platform tool for splitting MP3, OGG and FLAC files. It can split files by silence detection or by time point (it can accept an Audacity Label Track.txt file as input). It does not perform volume adjustments. Direct Windows and Mac download links:
  • mp3wrap - Cross-Platform command-line only tool for joining MP3 files.
For more advanced edits such as effects, the audio needs to be decompressed in an editor like Audacity, so you must then accept any perceptible quality loss from re-encoding the MP3.

[edit] Tips for troubleshooting MP3 export problems

Peter07Jan17: ToDo-2 Do some (all?) of these belong better in Manual>FAQ ?

[edit] Crash or excessive processing time on export

If Audacity crashes or hangs when exporting MP3s, or the export takes a long time to process, the usual reason is that your chosen Project Rate (the sample rate bottom left of the Audacity screen) is very different from the sample rate of the audio track on the screen (as shown in Hz on the Track Control Panel above the mute/solo buttons). As a result, resampling has to be done while exporting, which can create problems on long tracks. Try resampling the track to your chosen Project Rate before exporting as MP3. To do this, select all the track by clicking in the Track Control Panel, then Tracks > Mix and Render. If there is any silence added to the end of the track as a result of the resampling, you can select and delete it. Now when you export the MP3, the process should go smoothly and quickly. If it doesn't, there could be a number of reasons, e.g. if you have a virus scanner set to scan all created files, this will slow the process of writing the exported file considerably. The higher the bit rate you export at, the larger the file will be, so giving a greater time penalty if you enable virus scanning.

[edit] Exported MP3 invalid / will not play

Sometimes the exported MP3 may be invalid and only a few bytes in size; as a result, it will not play and give an error.

The safest solution is to always set your Project Rate to 44100 Hz. Make a rule to check this before you export, because importing a file of some other sample rate may change the Project Rate to that rate.

LAME will automatically downsample from 44 100 Hz to a lower sample rate at 56 kbps or lower, because low bit rates may give poor quality with higher sample rates. If especially desired, any valid sample rate/bit rate combination can be enforced by using the command line exporter in the current version of Audacity (choose "external program" in "Save as type" in the Export File dialog). Or export as WAV from Audacity, then use LAME.exe at the command line to convert to MP3.

HINT: If you want to choose specific sample rate/bit rate combinations, the following shows those permitted in the MP3 specification, and which will properly export from Audacity (with or without resampling):

MPEG-1 layer III sample frequencies (kHz): 32 48 44.1:
bit rates (kbps): 32 40 48 56 64 80 96 112 128 160 192 224 256 320

MPEG-2 layer III sample frequencies (kHz): 16 24 22.05:
bit rates (kbps): 8 16 24 32 40 48 56 64 80 96 112 128 144 160

MPEG-2.5 layer III sample frequencies (kHz): 8 12 11.025:
bit rates (kbps): 8 16 24 32 40 48 56 64 80 96 112 128 144 160

[edit] Exported MP3 plays too fast

If the MP3 plays at the wrong speed (usually too fast), then the sample rate you exported it at is unsuitable for your player application. Once again, the safe solution is to always set your Project Rate to 44100 Hz. This was a known problem with Adobe Flash Player until some way into version 9: for the file to play properly, the sample rate had to be 11025 Hz or a multiple thereof, such as 22050 Hz or 44100 Hz. This is fixed in the current Adobe Flash Player.

[edit] Exported MP3 has low volume or no sound

If you can see your exported MP3 is playing because the timer on the media player is moving, but it has no sound, make sure the sound device is not muted (in the player or in the system control panel), and make sure the correct playback device is being used (in the player preferences or in the system control panel). If this is not the problem, go back to Audacity and make sure the -....+ gain slider on the Track Control Panel (where the mute/solo buttons are) is set centrally at "Gain: 0 db". If this slider is over to left, it will reduce or kill the volume in the exported MP3.

[edit] ID3 Metadata Tags

Make sure when you use the "Edit Metadata Tags" dialog that you complete this by pressing OK, not escaping or cancelling it.

[edit] Exported MP3 larger than imported one

If you import an MP3 file into Audacity, then after export you find it is much larger than before, this is because the bit rate you exported it at is higher than the bit rate of the original file.

Audacity defaults to 128 kbps bit rate then remembers the last used bit rate if you change it.

If you need the exported MP3 to be the same size as before:

  1. Find out the bit rate of the imported file by opening it in Windows Media Player and clicking File > Properties, or in iTunes, right-click or control-click over the file and click Get Info. You can also use standalone programs like MediaInfo.
  2. Click File > Export, choose "MP3 Files" in the file types list, then click the Options button.

If you export a low bit rate MP3 at the same bit rate as the original you will be degrading its quality much more than if you exported it at a higher bit rate. The penalty of the higher bit rate is that the new file would be larger and that file merge tools might no longer be able to join the new MP3 to others that had the original bit rate. If you export a high bit rate MP3 at the same bit rate you are helping to minimise quality loss (but are not saving anything in file size).

[edit] All MP3 exports are lossy

Every MP3 export reduces the quality of the original file because Audacity does not edit the file directly. Instead, Audacity decompresses the MP3 upon import to lossless PCM. This does not undo the audio losses caused by the original MP3 compression, but it enables more complex edits such as equalisation and other signal filtering to be made.

Having been decompressed, the MP3 therefore has to be re-encoded as a new compressed MP3 when exporting. The lower the bit rate exported at, the more quality will be lost with that re-encoding.

If you only want to do simple cut, copy, paste, fade and volume edits to your MP3 files, you can do so without audio losses in other tools that can edit MP3 directly without decompressing and re-encoding. Examples are:

  • mp3wrap - Cross-Platform command-line only tool for joining MP3 files.

MP3 files of the same bit rate, sample rate, number of channels and stereo encoding mode can be typically be joined non-destructively with any of the above tools without the need for lossy re-encoding.

Personal tools

Donate securely by PayPal, using your credit card or PayPal account!