Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/libvorbis-1.2.0/doc/vorbisenc/examples.html @ 16

Last change on this file since 16 was 16, checked in by landauf, 17 years ago

added libvorbis

File size: 4.9 KB
Line 
1<html>
2
3<head>
4<title>libvorbisenc - Documentation</title>
5<link rel=stylesheet href="style.css" type="text/css">
6</head>
7
8<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
9<table border=0 width=100%>
10<tr>
11<td><p class=tiny>libvorbisenc documentation</p></td>
12<td align=right><p class=tiny>libvorbisenc release 1.1 - 20040709</p></td>
13</tr>
14</table>
15
16<h1>Libvorbisenc Setup Examples</h1>
17
18VBR is always the recommended mode for Vorbis encoding when
19there's no need to impose bitrate constraints.  True VBR encoding will
20always produce the most consistent quality output as well as the
21highest quality for a the bits used.
22
23<p>The following code examples prepare a
24<a href="vorbis_info.html">vorbis_info</a> structure for encoding
25use with libvorbis.<p>
26
27<h2>Example: encoding using a VBR quality mode</h2>
28
29<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
30<tr bgcolor=#cccccc><td><pre><b> 
31   vorbis_info_init(&vi);
32
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   *********************************************************************/
38 
39   ret = vorbis_encode_init_vbr(&vi,2,44100,.4);
40
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   *********************************************************************/
46
47   if(ret) exit(1);
48</b></pre></td></tr></table>
49
50<h2>Example: encoding using average bitrate (ABR)</h2>
51
52<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
53<tr bgcolor=#cccccc><td><pre><b> 
54   vorbis_info_init(&vi);
55
56  /*********************************************************************
57   Encoding using an average bitrate mode (ABR).
58   example: 44kHz stereo coupled, average 128kbps ABR
59   *********************************************************************/
60 
61   ret = vorbis_encode_init(&vi,2,44100,-1,128000,-1);
62
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   *********************************************************************/
68
69   if(ret) exit(1);
70</b></pre></td></tr></table>
71
72<h2>Example: encoding using constant bitrate (CBR)</h2>
73
74<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
75<tr bgcolor=#cccccc><td><pre><b> 
76   vorbis_info_init(&vi);
77
78  /*********************************************************************
79   Encoding using a constant bitrate mode (CBR).
80   example: 44kHz stereo coupled, average 128kbps CBR
81   *********************************************************************/
82 
83   ret = vorbis_encode_init(&vi,2,44100,128000,128000,128000);
84
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   *********************************************************************/
90
91   if(ret) exit(1);
92</b></pre></td></tr></table>
93
94<h2>Example: encoding using VBR selected by approximate bitrate</h2>
95
96<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
97<tr bgcolor=#cccccc><td><pre><b> 
98   vorbis_info_init(&vi);
99
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   *********************************************************************/
105
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));
109
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   *********************************************************************/
115
116   if(ret) exit(1);
117</b></pre></td></tr></table>
118
119<br><br>
120<hr noshade>
121<table border=0 width=100%>
122<tr valign=top>
123<td><p class=tiny>copyright &copy; 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>
125</tr><tr>
126<td><p class=tiny>libvorbisenc documentation</p></td>
127<td align=right><p class=tiny>libvorbisenc release 1.1 - 20040709</p></td>
128</tr>
129</table>
130
131</body>
132
133</html>
Note: See TracBrowser for help on using the repository browser.