134 lines
4.9 KiB
HTML
134 lines
4.9 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<title>libvorbisenc - Documentation</title>
|
|
<link rel=stylesheet href="style.css" type="text/css">
|
|
</head>
|
|
|
|
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
|
|
<table border=0 width=100%>
|
|
<tr>
|
|
<td><p class=tiny>libvorbisenc documentation</p></td>
|
|
<td align=right><p class=tiny>libvorbisenc version 1.3.2 - 20101101</p></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<h1>Libvorbisenc Setup Examples</h1>
|
|
|
|
VBR is always the recommended mode for Vorbis encoding when
|
|
there's no need to impose bitrate constraints. True VBR encoding will
|
|
always produce the most consistent quality output as well as the
|
|
highest quality for a the bits used.
|
|
|
|
<p>The following code examples prepare a
|
|
<a href="../libvorbis/vorbis_info.html">vorbis_info</a> structure for encoding
|
|
use with libvorbis.<p>
|
|
|
|
<h2>Example: encoding using a VBR quality mode</h2>
|
|
|
|
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
|
|
<tr bgcolor=#cccccc><td><pre><b>
|
|
vorbis_info_init(&vi);
|
|
|
|
/*********************************************************************
|
|
Encoding using a VBR quality mode. The usable range is -.1
|
|
(lowest quality, smallest file) to 1.0 (highest quality, largest file).
|
|
Example quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR
|
|
*********************************************************************/
|
|
|
|
ret = vorbis_encode_init_vbr(&vi,2,44100,.4);
|
|
|
|
/*********************************************************************
|
|
do not continue if setup failed; this can happen if we ask for a
|
|
mode that libVorbis does not support (eg, too low a quality mode, etc,
|
|
will return 'OV_EIMPL')
|
|
*********************************************************************/
|
|
|
|
if(ret) exit(1);
|
|
</b></pre></td></tr></table>
|
|
|
|
<h2>Example: encoding using average bitrate (ABR)</h2>
|
|
|
|
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
|
|
<tr bgcolor=#cccccc><td><pre><b>
|
|
vorbis_info_init(&vi);
|
|
|
|
/*********************************************************************
|
|
Encoding using an average bitrate mode (ABR).
|
|
example: 44kHz stereo coupled, average 128kbps ABR
|
|
*********************************************************************/
|
|
|
|
ret = vorbis_encode_init(&vi,2,44100,-1,128000,-1);
|
|
|
|
/*********************************************************************
|
|
do not continue if setup failed; this can happen if we ask for a
|
|
mode that libVorbis does not support (eg, too low a bitrate, etc,
|
|
will return 'OV_EIMPL')
|
|
*********************************************************************/
|
|
|
|
if(ret) exit(1);
|
|
</b></pre></td></tr></table>
|
|
|
|
<h2>Example: encoding using constant bitrate (CBR)</h2>
|
|
|
|
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
|
|
<tr bgcolor=#cccccc><td><pre><b>
|
|
vorbis_info_init(&vi);
|
|
|
|
/*********************************************************************
|
|
Encoding using a constant bitrate mode (CBR).
|
|
example: 44kHz stereo coupled, average 128kbps CBR
|
|
*********************************************************************/
|
|
|
|
ret = vorbis_encode_init(&vi,2,44100,128000,128000,128000);
|
|
|
|
/*********************************************************************
|
|
do not continue if setup failed; this can happen if we ask for a
|
|
mode that libVorbis does not support (eg, too low a bitrate, etc,
|
|
will return 'OV_EIMPL')
|
|
*********************************************************************/
|
|
|
|
if(ret) exit(1);
|
|
</b></pre></td></tr></table>
|
|
|
|
<h2>Example: encoding using VBR selected by approximate bitrate</h2>
|
|
|
|
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
|
|
<tr bgcolor=#cccccc><td><pre><b>
|
|
vorbis_info_init(&vi);
|
|
|
|
/*********************************************************************
|
|
Encode using a quality mode, but select that quality mode by asking for
|
|
an approximate bitrate. This is not ABR, it is true VBR, but selected
|
|
using the bitrate interface, and then turning bitrate management off:
|
|
*********************************************************************/
|
|
|
|
ret = ( vorbis_encode_setup_managed(&vi,2,44100,-1,128000,-1) ||
|
|
vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE2_SET,NULL) ||
|
|
vorbis_encode_setup_init(&vi));
|
|
|
|
/*********************************************************************
|
|
do not continue if setup failed; this can happen if we ask for a
|
|
mode that libVorbis does not support (eg, too low a bitrate, etc,
|
|
will return 'OV_EIMPL')
|
|
*********************************************************************/
|
|
|
|
if(ret) exit(1);
|
|
</b></pre></td></tr></table>
|
|
|
|
<br><br>
|
|
<hr noshade>
|
|
<table border=0 width=100%>
|
|
<tr valign=top>
|
|
<td><p class=tiny>copyright © 2000-2010 Xiph.Org</p></td>
|
|
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
|
|
</tr><tr>
|
|
<td><p class=tiny>libvorbisenc documentation</p></td>
|
|
<td align=right><p class=tiny>libvorbisenc version 1.3.2 - 20101101</p></td>
|
|
</tr>
|
|
</table>
|
|
|
|
</body>
|
|
|
|
</html>
|