Ogg Vorbis utilities
Command Line – Ogg Vorbis
With the addition of its supporting utilities, Ogg Vorbis competes with other free audio formats.
Support for the free Ogg Vorbis audio format [1] is included by default in most Linux distributions. However, if you want to do more than play an Ogg file or rip a CD to the format using a desktop application, you need more than the Ogg codec. Although all-purpose tools are available for audio files, the most convenient tools for manipulating Ogg files are the format's supporting utilities, most of which are contained in the vorbis-tools package [2]. With these utilities, you can convert, play, and edit Ogg files and their meta-comments from the command line.
Ogg Vorbis is an audio format that uses lossy compression, like MP3. Unlike FLAC, Xiph.Org's other free format that is popular with audiophiles for its high sound quality, Ogg has never been particularly popular. Many music players do not support it at all. Moreover, now that the MP3 format no longer has a restricted license, there is less reason for advocates of software freedom to use Ogg – although old habits die hard. However, there are still occasions where the smaller files created by lossy compression are useful, such as when using a player with limited memory, and at an equivalent sampling rate and file size, Ogg files offer higher sound quality than MP3s. Especially at their highest settings, Ogg files remain a reasonable compromise between file size and quality. By using the available utilities, you can get the most out of this often under-rated audio format.
oggenc
The basic command-line tool for making that conversion from .raw
, .wav
, .aiff
, or even .flac
is oggenc
(Figure 1). Ordinarily, .flac
would be preferable to .ogg
in terms of sound quality, but you might choose to create an .ogg
file to produce a smaller file, especially one intended to be played where high sound quality would be wasted, such as on a bus or downtown.
Converting a file is as simple as typing the basic file followed by the file to convert, which will produce an .ogg
file of medium quality with the same root name. Should you want a different name for the output file, add --output=FILE
. You may also want more control over the quality of the output; you can achieve this by using the option --quality=NUMBER
, where 1
is the lowest quality and 10
the highest. Similarly, if the output file is intended for playing on a mono system, you can use --downmix
to reduce the quality of a stereo source file.
oggenc
also offers considerable control over comments. You can eliminate comments altogether with --discard-comments
. Or possibly you may prefer simply to edit comments with a series of options that take the structure --comment=VALUE
and include such standard comments as artist, genre, date, track number, and title. You can also use --lyrics=FILE
, which will display the words to a song in a music player like Amarok.
Still other options set the minimum and maximum bit rates, as well as other advanced options, about which average users are unlikely to care. See the oggenc
man page for complete details.
ogg123
ogg123
(Figure 2) is a playback command of considerable versatility. The simplest structure for the command is:
ogg123 --device=SOUNDSYSTEM INPUT-FILE
On most modern Linux systems, the sound system will be pulse
, but if that doesn't work, then try alsa
or oss
. The input file is an .ogg
or .flac
file or a space-separated list of files.
However, that is only the beginning. You can create a playlist in which the paths to a file name are entered one per line and then use it with the --playlist option
. You can use --skipSECONDS
to set the start of playback and --endSECONDS
to quit playback. With --repeat
, the files specified will play again from the first one. Alternatively, --shuffle
will play a list of files once in random order, while --random
will play the list of files randomly over and over. If you are having trouble with playback, the option --buffer=KILOBYTES
may improve performance.
ogginfo
Vorbis files contain a wealth of information about themselves, and ogginfo
(Figure 3) displays it all, starting with bit rates, moving through comments, going on to the data length or file time and playback time in minutes and seconds, and ending with the average bit rates.
For convenience, you can query multiple files at one time by specifying files in a space-separated list after the basic command. However, even a single file returns more than a screenful of information on anything except the largest screens, so you should probably pipe ogginfo
through the less
command so that the output is more manageable.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.