Encoding wav to ogg

Encoding a wav file of 62.193.980 bytes with oggenc can be done with different options. Below is a table with quality options and resulting filesizes:

-q 3 (default)2.640.277
-q 22.419.462
-q 12.184.447

The downmix (in previous versions downsample) option mixes stereo to mono:

-q 3 --downmix 2.208.615
-q 2 --downmix 2.066.356
-q 1 --downmix 1.925.782

The resample option resamples input to the given sample rate (in Hz) before encoding.

-q 1 --downmix --resample 220501.044.832
-q 1 --downmix --resample 11025716.829

For audiobooks, a good choice for both reasonable quality and small filesize is:

  $ oggenc -q 1 --downmix --resample 22050 input.wav

Sometimes you want to transcode, for example from mp3 to ogg format:

  $ mpg321 --stdout input.mp3 | oggenc - --raw -o output.ogg

To install both mpg321 and oggenc under Fedora:

  $ yum -y install mpg321 vorbis-tools

Sometimes you want to transcode, for example from mp3 to ogg format:

  $ mpg321 -w - input.mp3 | oggenc - --downmix -q 1 --resample 22050 -o output.ogg

To transcode all files in a directory:

  $ for i in *mp3; do \
    mpg321 -w - "$i" | oggenc - --downmix -q 1 \
    --resample 22050 -o "`basename "$i" mp3`ogg"; \
    done

To install both mpg321 and oggenc under Fedora:

  $ yum -y install mpg321 vorbis-tools