opusenc (1) - Linux Man Pages

opusenc: encode audio into the Opus format


opusenc - encode audio into the Opus format


opusenc [ -h ] [ -V ] [ --bitrate kbit/sec ] [ --vbr ] [ --cvbr ] [ --hard-cbr ] [ --comp complexity ] [ --framesize 2.5, 5, 10, 20, 40, 60 ] [ --expect-loss pct ] [ --downmix-mono ] [ --downmix-stereo ] [ --max-delay ms ] [ --save-range file ] [ --set-ctl-int ctl=value ] [ --comment tag=value ] [ --artist author ] [ --title track title ] [ --raw ] [ --raw-bits bits/sample ] [ --raw-rate Hz ] [ --raw-chan N ] [ --raw-endianness flag ] [ --ignorelength ] input.wav output.opus


opusenc reads audio data in either raw, Wave, or AIFF format and encodes it into an Opus stream. If the input file is "-" audio data is read from stdin. Likewise, if the output file is "-" opus data is written to stdout.

Unless quieted opusenc displays fancy statistics about the encoding progress.


-h, --help
Show command help
-V, --version
Show the version number
--bitrate N.nnn
Encoding bitrate in kbit/sec (6-256 per channel)
Default for >=44.1kHz input is 64kbps per mono stream, 96kbps per coupled pair.
Use variable bitrate encoding (default)
Use constrained variable bitrate encoding
Use hard constant bitrate encoding
--comp N
Encoding computational complexity (0-10, default: 10). Zero gives the fastest encodes but lower quality, while 10 gives the highest quality but slower encoding.
--framesize N
Maximum frame size in milliseconds (2.5, 5, 10, 20, 40, 60, default: 20)
Smaller framesizes achieve lower latency but less quality at a given bitrate.
Sizes greater than 20ms are only interesting at fairly low bitrates.
--expect-loss N
Percentage packet loss to expect (default: 0)
Downmix to mono
Downmix to stereo (if >2 channels input)
--max-delay N
Maximum container delay in milliseconds (0-1000, default: 1000)
--save-range file
Saves check values for every frame to a file
--set-ctl-int x=y
Pass the encoder control x with value y (advanced) Preface with s: to direct the ctl to multistream s
This may be used multiple times
--comment tag=value
Add an extra comment. This may be used multiple times, and all instances will be added to each of the input files specified. The argument should be in the form "tag=value". See the vorbis-comment specification for well known tag names: http://www.xiph.org/vorbis/doc/v-comment.html
--artist artist
Set the artist comment field in the comments to artist
--title title
Set the track title comment field to title
Raw (headerless) PCM input
--raw-bits N
Set bits/sample for raw input (default: 16)
--raw-rate N
Set sampling rate for raw input (default: 48000)
--raw-chan N
Set number of channels for raw input (default: 2)
--raw-endianness [0/1]
Set the endianness for raw input: 1 for bigendian, 0 for little (defaults to 0)
Always ignore the datalength in Wave headers. Opusenc automatically ignores the length when its implausible (very small or very large) but some STDIN usage may still need this option to avoid truncation.


Simplest usage. Take input as input.wav and produce output as output.opus:

opusenc input.wav output.opus

Produce a very high quality encode with a target rate of 160kbps:

opusenc --bitrate 160 input.wav output.opus

Record and send a live stream to an Icecast HTTP streaming server using oggfwd:

arecord -c 2 -r 48000 -twav - | opusenc --bitrate 96 - - | oggfwd icecast.somewhere.org 8000 password /stream.opus


While it is possible to use opusenc for low latency streaming (e.g. with --max-delay set to 0 and netcat instead of Icecast) it's not really designed for this, and the Ogg container and TCP transport aren't the best tools for that application. Shell pipelines themselves will often have high buffering. The ability to set framesizes as low as 2.5 ms in opusenc mostly exists to try out the quality of the format with low latency settings, but not really for actual low latency usage.
Interactive usage should use UDP/RTP directly.


Gregory Maxwell <greg [at] xiph.org>


opusdec(1), opusinfo(1), oggfwd(1)