[vorbis] converting WAV to ogg

Frank Heckenbach frank at g-n-u.de
Fri Mar 9 16:38:04 PST 2001



Jeremy C. Reed wrote:

> I am trying to convert some a few WAV files to ogg format (using
> vorbis-tools-1.0beta4 oggenc).
> 
> I tried:
> 
>  $ oggenc -o nash.ogg nash.wav 
>  ERROR: Wav file is unsupported subformat (must be 16 bit PCM
>  or floating point PCM
>  ERROR: Input file "nash.wav" is not a supported format
> 
> And:
>  splay -d - nash.wav | oggenc -r -o nash.ogg -
> 
> The resulting file when played with ogg123 played so fast I couldn't
> understand it.
>
> For example, the wav playing normally:
>  real    0m30.018s
>  user    0m0.021s
>  sys     0m0.011s
> 
> And the ogg version:
>  real    0m3.826s
>  user    0m0.564s
>  sys     0m0.013s
> 
> What is PCM?

PCM (Pulse Code Modulation) describes the method by which an audio
signal is represented as digital data. Most WAV files use signed 16
bit words, but the WAV format supports more exotic encodings as
well. oggenc doesn't support all of them.

>From the oggenc manpage:

       -r, --raw
              Assume input data is raw 44.1 kHz, 16 bit,  little-
              endian audio data with no header information.

So, while splay seems to handle the PCM encoding of your file
(provided it can play it properly), its output is still not suitable
for oggenc, i.e. it's either 8 bit or mono or another sampling rate
(probably much lower, according to your timings), or several of the
above.

> What are some (Unix command-line) tools to decode WAV files to the raw
> format that oggenc can use?

You could try sox:

ox nash.wav -t raw -ws -r 44100 -c 2 - | oggenc -r -o nash.ogg -

or, if sox doesn't recognize your WAV file either, perhaps:

play -d - nash.wav | \
sox -t raw [options according to the format] -t raw -ws -r 44100 -c 2 - | \
oggenc -r -o nash.ogg -

(If you're on a big-endian system, you might have to add -x to the
sox options.)

Frank


-- 
Frank Heckenbach, frank at g-n-u.de
http://fjf.gnu.de/
PGP and GPG keys: http://fjf.gnu.de/plan

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis mailing list