From Audacity Wiki
Revision as of 14:52, 16 February 2021 by PeterSampson (talk | contribs) (cruft removal)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Peter 13Feb18: ToDo-2 QuickTime is deprecated by Apple.
OGG is an open, free container format for digital multimedia, but the term is commonly used to mean the high-quality lossy, size-compressed audio file format known as Ogg Vorbis (Vorbis-encoded audio inside an OGG container). Audacity fully supports Ogg Vorbis.
Other codecs used in OGG containers are Speex (a lossy compressed codec optimised for speech) and Opus (a higher quality lossy codec with low latency, making it suitable for internet transmission of both speech and music). Current Audacity supports Speex in an OGG container (and raw SPX Speex files) if you add the optional FFmpeg library to your computer.

Encoding and quality settings

Ogg Vorbis (hereafter called "OGG") differs from the popular MP3 lossy compressed format in that it does not use explicit bit rates in its quality settings. When exporting to OGG in Audacity, you choose a quality setting from 0 to 10. This tells the encoder a very approximate average number of bits to use for the encoding so as to maintain the quality given the nature of the material. This is a form of variable bit rate encoding where extra bits are used when the audio is harder to encode, and less when the audio is simpler. This avoids the fluctuations in quality that can often be perceived with many fixed bit rate encodings.

It should be noted that OGG does include a controlled bit rate encoding mode, but this does not give especially good results and Audacity does not support it. Its main use is for streaming over restricted connections.

While MP3 does allow for variable bit rate encoding, generally speaking OGG provides the same quality for a lower filesize compared to MP3, or looked at another way, higher quality for the same filesize.

These are the nominal bit rates implied for each OGG quality setting:

Quality Bit rate
-q0 64 kb/s
-q1 80 kb/s
-q2 96 kb/s
-q3 112 kb/s
-q4 128 kb/s
-q5 160 kb/s
-q6 192 kb/s
-q7 224 kb/s
-q8 256 kb/s
-q9 320 kb/s
-q10 500 kb/s

Audacity's default OGG export quality setting is -q5, implying a bit rate of approximately 160 kbps. While opinions are always subjective, many would feel this quality to be "transparent" for casual listening - that is, with no easily perceptible losses compared to the original audio. The consensus might probably be that using MP3, a variable bit rate encoding at 192 kbps or higher (with resulting larger file size) would be necessary to achieve similar quality.

Metadata tags

OGG supports metadata tags containing track, title and artist information similar to the ID3 tag standard for MP3. OGG tags are fully supported in the current Audacity; they can be viewed and edited using the Metadata Editor under the File menu.

Importing multiple stream files

There is a known problem when importing an OGG file that inludes multiple OGG encoded audio streams, that Audacity can only access the first logical stream in such a file. Multiple stream OGG files are often found where the file has been recorded or created from a streaming radio source, and typically, each song will be an individual stream. As a result you may find upon importing a long OGG file that Audacity will only display the first few minutes (or the first song) in the file. This is a common problem shared by most tools that support OGG.

The easiest general solution is to convert the OGG file to WAV before importing it into Audacity. You can convert from OGG to WAV in SuperPlayer  for Windows, FFMPEGX  on a Mac, or mplayer  on Linux.

Alternatively, iTunes users can add OGG support to iTunes by installing the OGG codecs for QuickTime. You can then convert the OGG to WAV or AIFF by right-clicking or control-clicking over the file in iTunes and using the "Convert to" option on the context menu. For users on Mac only, Ogg Drop also adds OGG support to iTunes, as well as providing an easy drag'n'drop interface to convert AIFF and AIFC files, Audio CD tracks, uncompressed QuickTime soundtracks and System Sound files to an Ogg Vorbis file.

Direct editing without re-encoding

If you import an OGG file into Audacity and then re-encode it by exporting it as an OGG, the exported file will be of lesser quality than the original OGG. Some quality loss is inevitable whenever you encode to a lossy format. Users of MP3 files face exactly the same problem when importing, editing and exporting an MP3 file.

If you only want to do simple volume edits of OGG files such as normalisation or fades, or if you want to cut or join OGGs, it's possible to use tools other than Audacity to do so without re-encoding. In these tools, the OGG files are not decompressed upon opening as Audacity does, which then requires them to be lossily re-encoded, but are opened and edited directly without losses. The following are recommendable tools.

vcut infile.ogg outfile1.ogg outfile2.ogg [ cutpoint | +cutpoint]
where cutpoint is a sample number. If the cutpoint is prefixed with '+', the cutpoint is an integer number of seconds.

OGG usage in iTunes and QuickTime

iTunes and QuickTime can only play OGG files with a hack. You need to install the appropriate Xiph.Org QuickTime Components for Windows or Mac.

Alternatively on Mac only you can download and install Oggdrop which as well as allowing you to play OGG files in iTunes or QuickTime functions as a standalone application allowing you to encode CD tracks or audio files in other formats to OGG.

Warning icon iPods, iPads and iPhones cannot play OGG files.