Blame doc/vorbisenc/examples.html

Packit 06404a
<html>
Packit 06404a
Packit 06404a
<head>
Packit 06404a
<title>libvorbisenc - Documentation</title>
Packit 06404a
<link rel=stylesheet href="style.css" type="text/css">
Packit 06404a
</head>
Packit 06404a
Packit 06404a
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
Packit 06404a
Packit 06404a
Packit 06404a

libvorbisenc documentation

Packit 06404a

libvorbisenc version 1.3.2 - 20101101

Packit 06404a
Packit 06404a
Packit 06404a
Packit 06404a

Libvorbisenc Setup Examples

Packit 06404a
Packit 06404a
VBR is always the recommended mode for Vorbis encoding when
Packit 06404a
there's no need to impose bitrate constraints.  True VBR encoding will
Packit 06404a
always produce the most consistent quality output as well as the
Packit 06404a
highest quality for a the bits used. 
Packit 06404a
Packit 06404a

The following code examples prepare a

Packit 06404a
vorbis_info structure for encoding
Packit 06404a
use with libvorbis.

Packit 06404a
Packit 06404a

Example: encoding using a VBR quality mode

Packit 06404a
Packit 06404a
Packit 06404a
 
Packit 06404a
   vorbis_info_init(&vi;;
Packit 06404a
Packit 06404a
  /*********************************************************************
Packit 06404a
   Encoding using a VBR quality mode.  The usable range is -.1
Packit 06404a
   (lowest quality, smallest file) to 1.0 (highest quality, largest file).
Packit 06404a
   Example quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR 
Packit 06404a
   *********************************************************************/
Packit 06404a
  
Packit 06404a
   ret = vorbis_encode_init_vbr(&vi,2,44100,.4);
Packit 06404a
Packit 06404a
  /*********************************************************************
Packit 06404a
   do not continue if setup failed; this can happen if we ask for a
Packit 06404a
   mode that libVorbis does not support (eg, too low a quality mode, etc,
Packit 06404a
   will return 'OV_EIMPL')
Packit 06404a
   *********************************************************************/
Packit 06404a
Packit 06404a
   if(ret) exit(1);
Packit 06404a
Packit 06404a
Packit 06404a

Example: encoding using average bitrate (ABR)

Packit 06404a
Packit 06404a
Packit 06404a
 
Packit 06404a
   vorbis_info_init(&vi;;
Packit 06404a
Packit 06404a
  /*********************************************************************
Packit 06404a
   Encoding using an average bitrate mode (ABR).
Packit 06404a
   example: 44kHz stereo coupled, average 128kbps ABR 
Packit 06404a
   *********************************************************************/
Packit 06404a
  
Packit 06404a
   ret = vorbis_encode_init(&vi,2,44100,-1,128000,-1);
Packit 06404a
Packit 06404a
  /*********************************************************************
Packit 06404a
   do not continue if setup failed; this can happen if we ask for a
Packit 06404a
   mode that libVorbis does not support (eg, too low a bitrate, etc,
Packit 06404a
   will return 'OV_EIMPL')
Packit 06404a
   *********************************************************************/
Packit 06404a
Packit 06404a
   if(ret) exit(1);
Packit 06404a
Packit 06404a
Packit 06404a

Example: encoding using constant bitrate (CBR)

Packit 06404a
Packit 06404a
Packit 06404a
 
Packit 06404a
   vorbis_info_init(&vi;;
Packit 06404a
Packit 06404a
  /*********************************************************************
Packit 06404a
   Encoding using a constant bitrate mode (CBR).
Packit 06404a
   example: 44kHz stereo coupled, average 128kbps CBR 
Packit 06404a
   *********************************************************************/
Packit 06404a
  
Packit 06404a
   ret = vorbis_encode_init(&vi,2,44100,128000,128000,128000);
Packit 06404a
Packit 06404a
  /*********************************************************************
Packit 06404a
   do not continue if setup failed; this can happen if we ask for a
Packit 06404a
   mode that libVorbis does not support (eg, too low a bitrate, etc,
Packit 06404a
   will return 'OV_EIMPL')
Packit 06404a
   *********************************************************************/
Packit 06404a
Packit 06404a
   if(ret) exit(1);
Packit 06404a
Packit 06404a
Packit 06404a

Example: encoding using VBR selected by approximate bitrate

Packit 06404a
Packit 06404a
Packit 06404a
 
Packit 06404a
   vorbis_info_init(&vi;;
Packit 06404a
Packit 06404a
  /*********************************************************************
Packit 06404a
   Encode using a quality mode, but select that quality mode by asking for
Packit 06404a
   an approximate bitrate.  This is not ABR, it is true VBR, but selected
Packit 06404a
   using the bitrate interface, and then turning bitrate management off:
Packit 06404a
   *********************************************************************/
Packit 06404a
Packit 06404a
   ret = ( vorbis_encode_setup_managed(&vi,2,44100,-1,128000,-1) ||
Packit 06404a
           vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE2_SET,NULL) ||
Packit 06404a
           vorbis_encode_setup_init(&vi));
Packit 06404a
Packit 06404a
  /*********************************************************************
Packit 06404a
   do not continue if setup failed; this can happen if we ask for a
Packit 06404a
   mode that libVorbis does not support (eg, too low a bitrate, etc,
Packit 06404a
   will return 'OV_EIMPL')
Packit 06404a
   *********************************************************************/
Packit 06404a
Packit 06404a
   if(ret) exit(1);
Packit 06404a
Packit 06404a
Packit 06404a


Packit 06404a

Packit 06404a
Packit 06404a
Packit 06404a

copyright © 2000-2010 Xiph.Org

Packit 06404a

Ogg Vorbis

Packit 06404a
Packit 06404a

libvorbisenc documentation

Packit 06404a

libvorbisenc version 1.3.2 - 20101101

Packit 06404a
Packit 06404a
Packit 06404a
Packit 06404a
</body>
Packit 06404a
Packit 06404a
</html>