4 <title>libvorbisenc - Documentation</title>
5 <link rel=stylesheet href="style.css" type="text/css">
8 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
9 <table border=0 width=100%>
11 <td><p class=tiny>libvorbisenc documentation</p></td>
12 <td align=right><p class=tiny>libvorbisenc release 1.1 - 20040709</p></td>
16 <h1>Libvorbisenc Setup Examples</h1>
18 VBR is always the recommended mode for Vorbis encoding when
19 there's no need to impose bitrate constraints. True VBR encoding will
20 always produce the most consistent quality output as well as the
21 highest quality for a the bits used.
23 <p>The following code examples prepare a
24 <a href="vorbis_info.html">vorbis_info</a> structure for encoding
25 use with libvorbis.<p>
27 <h2>Example: encoding using a VBR quality mode</h2>
29 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
30 <tr bgcolor=#cccccc><td><pre><b>
31 vorbis_info_init(&vi);
33 /*********************************************************************
34 Encoding using a VBR quality mode. The usable range is -.1
35 (lowest quality, smallest file) to 1.0 (highest quality, largest file).
36 Example quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR
37 *********************************************************************/
39 ret = vorbis_encode_init_vbr(&vi,2,44100,.4);
41 /*********************************************************************
42 do not continue if setup failed; this can happen if we ask for a
43 mode that libVorbis does not support (eg, too low a quality mode, etc,
44 will return 'OV_EIMPL')
45 *********************************************************************/
48 </b></pre></td></tr></table>
50 <h2>Example: encoding using average bitrate (ABR)</h2>
52 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
53 <tr bgcolor=#cccccc><td><pre><b>
54 vorbis_info_init(&vi);
56 /*********************************************************************
57 Encoding using an average bitrate mode (ABR).
58 example: 44kHz stereo coupled, average 128kbps ABR
59 *********************************************************************/
61 ret = vorbis_encode_init(&vi,2,44100,-1,128000,-1);
63 /*********************************************************************
64 do not continue if setup failed; this can happen if we ask for a
65 mode that libVorbis does not support (eg, too low a bitrate, etc,
66 will return 'OV_EIMPL')
67 *********************************************************************/
70 </b></pre></td></tr></table>
72 <h2>Example: encoding using constant bitrate (CBR)</h2>
74 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
75 <tr bgcolor=#cccccc><td><pre><b>
76 vorbis_info_init(&vi);
78 /*********************************************************************
79 Encoding using a constant bitrate mode (CBR).
80 example: 44kHz stereo coupled, average 128kbps CBR
81 *********************************************************************/
83 ret = vorbis_encode_init(&vi,2,44100,128000,128000,128000);
85 /*********************************************************************
86 do not continue if setup failed; this can happen if we ask for a
87 mode that libVorbis does not support (eg, too low a bitrate, etc,
88 will return 'OV_EIMPL')
89 *********************************************************************/
92 </b></pre></td></tr></table>
94 <h2>Example: encoding using VBR selected by approximate bitrate</h2>
96 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
97 <tr bgcolor=#cccccc><td><pre><b>
98 vorbis_info_init(&vi);
100 /*********************************************************************
101 Encode using a quality mode, but select that quality mode by asking for
102 an approximate bitrate. This is not ABR, it is true VBR, but selected
103 using the bitrate interface, and then turning bitrate management off:
104 *********************************************************************/
106 ret = ( vorbis_encode_setup_managed(&vi,2,44100,-1,128000,-1) ||
107 vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE2_SET,NULL) ||
108 vorbis_encode_setup_init(&vi));
110 /*********************************************************************
111 do not continue if setup failed; this can happen if we ask for a
112 mode that libVorbis does not support (eg, too low a bitrate, etc,
113 will return 'OV_EIMPL')
114 *********************************************************************/
117 </b></pre></td></tr></table>
121 <table border=0 width=100%>
123 <td><p class=tiny>copyright © 2000-2004 vorbis team</p></td>
124 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>
126 <td><p class=tiny>libvorbisenc documentation</p></td>
127 <td align=right><p class=tiny>libvorbisenc release 1.1 - 20040709</p></td>