1opusenc(1) opus-tools opusenc(1)
2
3
4
6 opusenc - encode audio into the Opus format
7
8
10 opusenc [ -h ] [ -V ] [ --help-picture ] [ --quiet ] [ --bitrate kbit/s
11 ] [ --vbr ] [ --cvbr ] [ --hard-cbr ] [ --music ] [ --speech ] [ --comp
12 complexity ] [ --framesize 2.5, 5, 10, 20, 40, 60 ] [ --expect-loss pct
13 ] [ --downmix-mono ] [ --downmix-stereo ] [ --no-phase-inv ] [ --max-
14 delay ms ] [ --title 'track title' ] [ --artist author ] [ --album
15 'album title' ] [ --tracknumber 'track number' ] [ --genre genre ] [
16 --date YYYY-MM-DD ] [ --comment tag=value ] [ --picture filename|speci‐
17 fication ] [ --padding n ] [ --discard-comments ] [ --discard-pictures
18 ] [ --raw ] [ --raw-bits bits/sample ] [ --raw-rate Hz ] [ --raw-chan N
19 ] [ --raw-endianness flag ] [ --ignorelength ] [ --serial serial number
20 ] [ --save-range file ] [ --set-ctl-int ctl=value ] input.wav out‐
21 put.opus
22
23
25 opusenc reads audio data in Wave, AIFF, FLAC, Ogg/FLAC, or raw PCM for‐
26 mat and encodes it into an Ogg Opus stream. If the input file is "-"
27 audio data is read from stdin. Likewise, if the output file is "-" the
28 Ogg Opus stream is written to stdout.
29
30 Unless quieted opusenc displays fancy statistics about the encoding
31 progress.
32
33
35 General options
36 -h, --help
37 Show command help
38
39 -V, --version
40 Show the version number
41
42 --help-picture
43 Show help on attaching album art
44
45 --quiet
46 Enable quiet mode. No messages are displayed.
47
48
49 Encoding options
50 --bitrate N.nnn
51 Set target bitrate in kbit/s (6-256 per channel)
52
53 In VBR mode this specifies the average rate for a large and
54 diverse collection of audio. In CVBR and Hard-CBR mode it speci‐
55 fies the specific output bitrate.
56
57 The default for input with a sample rate of 44.1 kHz or higher
58 is 64 kbit/s per mono stream and 96 kbit/s per coupled pair.
59
60 --vbr Use variable bitrate encoding (default)
61
62 In VBR mode the bitrate may go up and down freely depending on
63 the content to achieve more consistent quality.
64
65 --cvbr Use constrained variable bitrate encoding.
66
67 Outputs to a specific bitrate. This mode is analogous to CBR in
68 AAC/MP3 encoders and managed mode in Vorbis coders. This deliv‐
69 ers less consistent quality than VBR mode but consistent
70 bitrate.
71
72 --hard-cbr
73 Use hard constant bitrate encoding.
74
75 With hard-cbr every frame will be exactly the same size, similar
76 to how speech codecs work. This delivers lower overall quality
77 but is useful where bitrate changes might leak data in encrypted
78 channels or on synchronous transports.
79
80 --music
81 Override automatic detection and tune low bitrate encoding for
82 music. By default, music is detected automatically and the
83 classification may vary over time.
84
85 Tuning impacts lower bitrates that involve tradeoffs between
86 speech clarity and musical accuracy, and has no impact at
87 bitrates typically used for high quality music encoding.
88
89 --speech
90 Override automatic detection and tune low bitrate encoding for
91 speech. By default, speech is detected automatically and the
92 classification may vary over time.
93
94 Tuning impacts lower bitrates that involve tradeoffs between
95 speech clarity and musical accuracy, and has no impact at
96 bitrates typically used for high quality music encoding.
97
98 --comp N
99 Set encoding computational complexity (0-10, default: 10). Zero
100 gives the fastest encodes but lower quality, while 10 gives the
101 highest quality but slower encoding.
102
103 --framesize N
104 Set maximum frame size in milliseconds (2.5, 5, 10, 20, 40, 60,
105 default: 20)
106 Smaller framesizes achieve lower latency but less quality at a
107 given bitrate.
108 Sizes greater than 20ms are only interesting at fairly low
109 bitrates.
110
111 --expect-loss N
112 Set expected packet loss in percent (default: 0)
113
114 --downmix-mono
115 Downmix to mono
116
117 --downmix-stereo
118 Downmix to stereo (if >2 channels input)
119
120 --no-phase-inv
121 Disable use of phase inversion for intensity stereo. This trades
122 some stereo quality for a higher quality mono downmix, and is
123 useful when encoding stereo audio that is likely to be downmixed
124 to mono after decoding.
125
126 --max-delay N
127 Set maximum container delay in milliseconds (0-1000, default:
128 1000)
129
130
131 Metadata options
132 --title title
133 Set the track title comment field to title
134
135 --artist artist
136 Set the artist comment field to artist. This may be used multi‐
137 ple times to list contributing artists individually. Note that
138 some playback software does not display multiple artists grace‐
139 fully.
140
141 --album album
142 Set the album or collection title field to album
143
144 --tracknumber N
145 Set the track number comment field to N
146
147 --date YYYY-MM-DD
148 Set the date comment field to YYYY-MM-DD. This may be shortened
149 to YYYY-MM or YYYY.
150
151 --genre genre
152 Set the genre comment field to genre. This option may be speci‐
153 fied multiple times to tag a track with multiple overlapping
154 genres.
155
156 --comment tag=value
157 Add an extra comment. This may be used multiple times. The
158 argument should be in the form "tag=value". See the vorbis-com‐
159 ment specification for well known tag names:
160 https://www.xiph.org/vorbis/doc/v-comment.html
161
162 --picture filename|specification
163 Attach album art for the track.
164
165 Either a filename for the artwork or a more complete specifica‐
166 tion form can be used. The picture is added to a META‐
167 DATA_BLOCK_PICTURE comment field similar to what is used in
168 FLAC. The specification is a string whose parts are separated
169 by | (pipe) characters. Some parts may be left empty to invoke
170 default values. Passing a plain filename is just shorthand for
171 the "||||filename" specification.
172
173 The format of specification is [type]|[media-type]|[descrip‐
174 tion]|[widthxheightxdepth[/colors]]|filename
175
176 type is an optional number describing the nature of the picture.
177 Defined values are from one of:
178
179 0: Other
180 1: 32x32 pixel 'file icon' (PNG only)
181 2: Other file icon
182 3: Cover (front)
183 4: Cover (back)
184 5: Leaflet page
185 6: Media (e.g., label side of a CD)
186 7: Lead artist/lead performer/soloist
187 8: Artist/performer
188 9: Conductor
189 10: Band/Orchestra
190 11: Composer
191 12: Lyricist/text writer
192 13: Recording location
193 14: During recording
194 15: During performance
195 16: Movie/video screen capture
196 17: A bright colored fish
197 18: Illustration
198 19: Band/artist logotype
199 20: Publisher/studio logotype
200
201 The default is 3 (front cover). More than one --picture option
202 can be specified to attach multiple pictures. There may only be
203 one picture each of type 1 and 2 in a file.
204
205 media-type is optional and is now ignored.
206
207 description is optional. The default is an empty string.
208
209 The next part specifies the resolution and color information,
210 but is now ignored.
211
212 filename is the path to the picture file to be imported.
213
214
215 --padding n
216 Reserve n extra bytes for metadata tags. This can make later tag
217 editing more efficient. Defaults to 512.
218
219 --discard-comments
220 Don't propagate metadata tags from the input file.
221
222 --discard-pictures
223 Don't propagate pictures or art from the input file.
224
225
226 Input options
227 --raw Interpret input as raw PCM data without headers
228
229 --raw-bits N
230 Set bits/sample for raw input (default: 16)
231
232 --raw-rate N
233 Set sampling rate for raw input (default: 48000)
234
235 --raw-chan N
236 Set number of channels for raw input (default: 2)
237
238 --raw-endianness [0/1]
239 Set the endianness for raw input: 1 for big endian, 0 for little
240 (default: 0)
241
242 --ignorelength
243 Ignore the data length in Wave headers. Opusenc automatically
244 ignores the length when its implausible (very small or very
245 large) but some STDIN usage may still need this option to avoid
246 truncation.
247
248
249 Diagnostic options
250 --serial n
251 Force use of a specific stream serial number, rather than one
252 that is randomly generated. This is used to make the encoder
253 deterministic for testing and is not generally recommended.
254
255 --save-range file
256 Save check values for every frame to a file
257
258 --set-ctl-int x=y
259 Pass the encoder control x with value y (advanced). Preface
260 with s: to direct the ctl to multistream s
261 This may be used multiple times
262
263
265 Simplest usage. Take input as input.wav and produce output as out‐
266 put.opus:
267 opusenc input.wav output.opus
268
269 Produce a very high quality encode with a target rate of 160 kbit/s:
270 opusenc --bitrate 160 input.wav output.opus
271
272 Record and send a live stream to an Icecast HTTP streaming server using
273 oggfwd:
274 arecord -c 2 -r 48000 -twav - | opusenc --bitrate 96 - - |
275 oggfwd icecast.somewhere.org 8000 password /stream.opus
276
278 While it is possible to use opusenc for low latency streaming (e.g.
279 with --max-delay set to 0 and netcat instead of Icecast) it's not
280 really designed for this, and the Ogg container and TCP transport
281 aren't the best tools for that application. Shell pipelines themselves
282 will often have high buffering. The ability to set framesizes as low as
283 2.5 ms in opusenc mostly exists to try out the quality of the format
284 with low latency settings, but not really for actual low latency usage.
285 Interactive usage should use UDP/RTP directly.
286
287
289 Gregory Maxwell <greg@xiph.org>
290
291
293 opusdec(1), opusinfo(1), oggfwd(1)
294
295
296
297Xiph.Org Foundation 2012-08-31 opusenc(1)