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