CirclingMinds home

Converting audio files to Ogg in Ubuntu

5 April 2010

Ubuntu provides a useful tool called dir2ogg which makes it very easy to convert audio files from various formats to Ogg.

%apt-cache show dir2ogg
==================================================
Package: dir2ogg
 dir2ogg converts MP3, M4A, WMA, FLAC, WAV files and Audio CDs to the
 open-source OGG format.
 .
 It is a Python script that simply binds together the various decoders and
 oggenc making it easier for the user to convert his/her music files. It also
 supports ID3 tags.

As you can see, it can convert files from mp3, m4a, flac, wav format to ogg.

To install

%sudo aptitude install dir2ogg

To convert all the m4a files in a directory to ogg format, run the following command:

%dir2ogg -m -q 10 directory name
# -m flag is to convert m4a audio files in the directory. 
# -q flag sets quality of the audio file (default is 3)

Useful flags:

%dir2ogg --help
dir2ogg 0.11.8 (2009-08-04), converts audio files into ogg vorbis.

Usage: dir2ogg [options] [arguments]

Options:
  -r, --recursive       convert files in all subdirectories of all directories specified as arguments
  -q N, --quality=N     quality. N is a number from 1-10 (default 3.0)
  -t, --smart-mp3       try to use similar quality as original mp3 file (overwrites -q)
  -T N, --smart-mp3-correction=N
                        decrease detected quality (implies -t)
  -n, --no-mp3          don't convert mp3s (use with '-d' or '-r')
  -a, --convert-all     convert all supported formats
  -A, --convert-ape     convert all APE files found in directories.
  -f, --convert-flac    convert all FLAC files found in directories
  -m, --convert-m4a     convert all M4A files found in directories
  -M, --convert-mpc     convert all MPC files found in directories
  -w, --convert-wav     convert all WAV files found in directories
  -W, --convert-wma     convert all WMA files found in directories
  -V, --convert-wv      convert all WV files found in directories
  --delete-input        delete input files
  -v, --verbose         verbose output