LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


Streaming Media With Linux
Pages: 1, 2, 3, 4, 5, 6

Ogg Vorbis

Ogg Vorbis: The Ogg Vorbis Codec Project

The Xiphophorus group wants to ensure that you have free access to open Internet multimedia standards. Ogg Vorbis is the group's combined "wrapper" file format (Ogg) and audio codec (Vorbis) with technical specifications equal to MP3 and RealAudio, but free of the complications imposed by the proprietary nature of those formats. The project's open-source software is licensed under the GPL, with the Vorbis libraries now under the protection of the BSD license.



Download the vorbis_nightly_cvs.tgz file from the Vorbis CVS FTP site. Create a holding directory for the package (something like $HOME/OggVorbis is good), move the package into it, then unpack it with tar xzvf vorbis_nightly_cvs.tgz. Directories will be created for the various parts of the system, including these components:

  • ao -- the Ogg Vorbis multi-platform audio library
  • ogg -- library for the Ogg wrapper
  • vorbis -- library for the Vorbis encoder
  • vorbis-tools -- Vorbis utilities (oggenc, ogg123, vorbiscomment)
  • vorbis-plug-ins -- Vorbis plug-ins for various players

Note: Ogg Vorbis beta4 should be officially available by the time this article is published. The packages are in the same order as the CVS material, but the individual builds are handled by the familiar procedure of ./configure; make; make install. The directions given here remain valid for the current CVS versions.

You'll want to compile the code in the first four directories before compiling the plug-ins. Enter each directory and run these commands to build the software:

Related Articles

Streaming Media With Linux (Part 2)

Creating Great Audio for the Web

Could Ogg Vorbis Replace MP3?

Linux Audio Plug-Ins: A Look Into LADSPA

Server-Side Considerations for Video Streaming

Shooting Digital Video PDA Style

./autogen.sh
make
make install

You may need root privileges to install everything. Now enter the plug-ins directory and build the plug-ins you need. At this time, three plug-ins come with the Ogg Vorbis package, one each for Kmpg (a media player for KDE), RealPlayer, and Winamp (a popular media player for Windows). Installation rules and requirements vary with each plug-in, so be sure to read the notes for each plug-in you want to build.

Users of XMMS 1.2.4 will be pleased to note that a Vorbis plug-in is included in the source package for that program. You will need to configure the build for Ogg Vorbis support:

./configure --with-ogg-prefix=/usr/local/lib --with-vorbis-prefix=/usr/local/lib

Make XMMS in the usual manner, then manually install the libvorbis plug-in. Become root, copy the contents of $HOME/xmms-1.2.4/Input/vorbis/.libs to /usr/X11R6/lib/xmms/Input, and at last you can fire up XMMS with Vorbis support. Once XMMS is started, go into the Preferences menu and enable the Ogg Vorbis plug-in (Figure 5).

OggVorbis plug-in for XMMS.
Figure 5: Ogg Vorbis plug-in for XMMS.

Once the Ogg Vorbis package components are installed you can create your own Vorbis-encoded files with oggenc and play them with ogg123 (both of those tools are built and installed from the vorbis-tools subdirectory). To encode a file run this command sequence:

oggenc -o output.ogg input.wav

That sequence will produce an OGG-format file with default output values (see oggenc --help for the full list of command-line options). Here's a more complex example (with line breaks added for clarity), along with its diagnostic messages:

[dlphilp@localhost wav]$ oggenc -o /home/dlphilp/choral.ogg \
   -b 128 -c "An example OGG file" \
   -t "Choral Music" -a "King's College Choir" \
   choral.wav 

Opening with wav module: WAV file reader
Encoding "/home/dlphilp/choral.ogg" [ 99.6%] [ 0m00s remaining]

Done encoding file "/home/dlphilp/choral.ogg"

        File length:  0m 54.0s
        Elapsed time: 0m 50.9s
        Rate:         1.0621
        Average bitrate: 125.6 kb/s

where:

  • -o specifies the output file name
  • -b declares the encoding bit rate
  • -c the comment field
  • -t title field
  • -a artist's name

Note that the input argument (choral.wav) takes no flag and must appear at the end of the command sequence.

Users of Grip (described above) will be pleased to know the most recent versions include support for oggenc as one of Grip's default encoders. Open the Config/MP3 tabs, then select oggenc from the encoder list. Grip's default settings for oggenc specify the encoder's output as MP3, but those settings can be changed easily (Figure 6). Using oggenc, Grip becomes a splendid system for ripping and converting CD audio to Ogg Vorbis files.

Oggenc custom settings in Grip.
Figure 6. Oggenc custom settings in Grip.

The Ogg file format was designed with an excellent system for comments and descriptive fields similar to the ID3 tags found with many MP3 files. However, Ogg tags are more flexible and much better defined and organized than ID3. The vorbiscomment utility lists and modifies these fields:

  • Title
  • Version
  • Album
  • Track Number
  • Artist
  • Organization
  • Description
  • Genre
  • Date
  • Location
  • Copyright
  • ISRC

Martin Cameron's Vocoditor simplifies editing the Vorbis comment fields, providing a handy Perl/Gtk graphic interface to vorbiscomment. You can create new comments or modify existing entries, then save the Ogg file along with the edited fields (Figure 7).

Vocoditor, a Vorbis comment fields editor.
Figure 7. Vocoditor, a Vorbis comment fields editor.

Playing a standalone Ogg file is equally easy. Here's an example using ogg123 to play the file created above with oggenc:

[dlphilp@localhost dlphilp]$ ogg123 -d oss choral.ogg 
Playing from file choral.ogg.
Unrecognized comment: 'An example OGG file'
Title: Choral Music
Artist: King's College Choir
Bitstream is 1 channel, 44100Hz
Encoded by: Xiphophorus libVorbis I 20010218
Done.

where the -d flag specifies the output device which may be null, the OSS /dev/dsp (used in the example), a WAV file written to disk, or the audio hardware on machines running Irix and Solaris.

Vorbis vs. MP3: My impressions

I ran BladeEnc and oggenc on the same WAV file to establish some performance comparisons. The input was a CD-quality WAV file (16-bit stereo with a sampling rate of 44.1 kHz) 3 minutes and 20 seconds long, and both encoders were employed with only their default values. The results were interesting:

File  Size (Mbyte) Encoding Time (minutes/seconds)
 
test.wav 35.1      -
test.mp3  3.2  2m 46.0s
test.ogg  2.7  3m 29.8s

Note that BladeEnc encoded with a fixed bit-rate of 128 Kbps, while oggenc used a variable bit-rate that defaults to 160 Kbps for stereo files. Clearly, oggenc yielded the better compression ratio, but the higher default bit-rate contributes to the longer processing time.

I do not claim that this test represents anything other than a crude comparison. Careful tuning would certainly improve performance from each encoder, but the figures do place Ogg Vorbis in a favorable light. I hold a similar conclusion from a subjective evaluation of the audio quality from the encoded files, though again I caution the reader to consider that the encoding was untuned.

In my opinion, Vorbis truly does have the potential to replace MP3 as a preferred network streaming audio file format. While bypassing the controversial or inhibiting aspects of MP3 and RealAudio, it encourages a community development effort in the domain of streaming media. Plug-ins are already available for rendering Ogg Vorbis files in media players for Windows, the Mac, and Linux/Unix platforms, and the upcoming Icecast 2.0 supports streaming audio in the Ogg format. The future is definitely looking bright for Ogg Vorbis.

Pages: 1, 2, 3, 4, 5, 6

Next Pagearrow




Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!


Linux Resources
  • Linux Online
  • The Linux FAQ
  • linux.java.net
  • Linux Kernel Archives
  • Kernel Traffic
  • DistroWatch.com


  • Sponsored by: