opusenc(1)
π opusenc(1) β the opus-tools glow-up π
okay bestie, sit down, hydrate, and let me tell you about opusenc from the opus-tools collection. she encodes audio into the Opus format and she is, frankly, iconic. π
β¨ NAME β¨
opusenc β encode audio into the Opus format π¦
β¨ SYNOPSIS β¨
opusenc [ -h ] [ -V ] [ --help-picture ] [ --quiet ] [ --bitrate kbit/s
] [ --vbr ] [ --cvbr ] [ --hard-cbr ] [ --music ] [ --speech ] [ --comp
complexity ] [ --framesize 2.5, 5, 10, 20, 40, 60 ] [ --expect-loss pct
] [ --downmix-mono ] [ --downmix-stereo ] [ --no-phase-inv ] [ --max-
delay ms ] [ --title 'track title' ] [ --artist author ] [ --album
'album title' ] [ --tracknumber 'track number' ] [ --genre genre ] [
--date YYYY-MM-DD ] [ --comment tag=value ] [ --picture
filename|specification ] [ --padding n ] [ --discard-comments ] [
--discard-pictures ] [ --raw ] [ --raw-bits bits/sample ] [ --raw-rate
Hz ] [ --raw-chan N ] [ --raw-endianness flag ] [ --ignorelength ] [
--serial serial number ] [ --save-range file ] [ --set-ctl-int ctl=value
] input.wav output.opus
πΈ DESCRIPTION πΈ
So basically, opusenc reads your audio in Wave, AIFF, FLAC, Ogg/FLAC, or raw PCM format and encodes it into an Ogg Opus stream. no cap, that's the whole job and she does it gorgeously.
if the input file is -, the audio data gets read from stdin. and yeah, same energy for the other side: if the output file is -, the Ogg Opus stream is written to stdout. pipes, bestie. pipes. π
unless you quiet her, opusenc shows off fancy statistics about the encoding progress, and honestly? she's a little bit of a main character about it. π
β¨ OPTIONS β¨
π«Ά General options π«Ά
-h,--helpβ show command help π-V,--versionβ show the version number π·οΈ--help-pictureβ show help on attaching album art πΌοΈ--quietβ enable quiet mode. literally no messages are displayed. silence. π€«
π₯ Encoding options π₯
--bitrate N.nnnβ set target bitrate in kbit/s (6-256 per channel)
in VBR mode this specifies the average rate for a large and diverse collection of audio. in CVBR and Hard-CBR mode it specifies the specific output bitrate.
the default for input with a sample rate of 44.1 kHz or higher is 64 kbit/s per mono stream and 96 kbit/s per coupled pair.
--vbrβ use variable bitrate encoding (default)
in VBR mode the bitrate may go up and down freely depending on the content, to achieve more consistent quality. she's flexible like that. π
--cvbrβ use constrained variable bitrate encoding.
outputs to a specific bitrate. this mode is analogous to CBR in AAC/MP3 encoders and managed mode in Vorbis coders. it delivers less consistent quality than VBR mode but consistent bitrate. trade-offs, bestie.
--hard-cbrβ use hard constant bitrate encoding.
with hard-cbr every frame will be exactly the same size, similar to how speech codecs work. this delivers lower overall quality but is useful where bitrate changes might leak data in encrypted channels or on synchronous transports. π so if you're worried about leaking, this one's for you.
--musicβ override automatic detection and tune low bitrate encoding for music. by default, music is detected automatically and the classification may vary over time.
tuning impacts lower bitrates that involve tradeoffs between speech clarity and musical accuracy, and has no impact at bitrates typically used for high quality music encoding.
--speechβ override automatic detection and tune low bitrate encoding for speech. by default, speech is detected automatically and the classification may vary over time.
tuning impacts lower bitrates that involve tradeoffs between speech clarity and musical accuracy, and has no impact at bitrates typically used for high quality music encoding.
--comp Nβ set encoding computational complexity (0-10, default: 10). zero gives the fastest encodes but lower quality, while 10 gives the highest quality but slower encoding. glow-up vs. speed, pick your fighter. βοΈ--framesize Nβ set 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β set expected packet loss in percent (default: 0) π--downmix-monoβ downmix to mono--downmix-stereoβ downmix to stereo (if >2 channels input)--no-phase-invβ disable use of phase inversion for intensity stereo. this trades some stereo quality for a higher quality mono downmix, and is useful when encoding stereo audio that is likely to be downmixed to mono after decoding. iykyk π§--max-delay Nβ set maximum container delay in milliseconds (0-1000, default: 1000) β±οΈ
π Metadata options π
--title titleβ set the track title comment field to title--artist artistβ set the artist comment field to artist. this may be used multiple times to list contributing artists individually. note that some playback software does not display multiple artists gracefully. π (rude, but true)--album albumβ set the album or collection title field to album--tracknumber Nβ set the track number comment field to N--date YYYY-MM-DDβ set the date comment field to YYYY-MM-DD. this may be shortened to YYYY-MM or YYYY.--genre genreβ set the genre comment field to genre. this option may be specified multiple times to tag a track with multiple overlapping genres. she contains multitudes. β¨--comment tag=valueβ add an extra comment. this may be used multiple times. the argument should be in the form"tag=value". see the vorbis-comment specification for well known tag names:https://www.xiph.org/vorbis/doc/v-comment.html--picture filename|specificationβ attach album art for the track. πΌοΈπ
either a filename for the artwork or a more complete specification form can be used. the picture is added to a METADATA_BLOCK_PICTURE comment field similar to what is used in FLAC. the specification is a string whose parts are separated by | (pipe) characters. some parts may be left empty to invoke default values. passing a plain filename is just shorthand for the "||||filename" specification.
the format of specification is [type]|[media-type]|[description]|[widthxheightxdepth[/colors]]|filename
type is an optional number describing the nature of the picture. defined values are from one of:
- Other
- 32x32 pixel 'file icon' (PNG only)
- Other file icon
- Cover (front)
- Cover (back)
- Leaflet page
- Media (e.g., label side of a CD)
- Lead artist/lead performer/soloist
- Artist/performer
- Conductor
- Band/Orchestra
- Composer
- Lyricist/text writer
- Recording location
- During recording
- During performance
- Movie/video screen capture
- A bright colored fish
- Illustration
- Band/artist logotype
- Publisher/studio logotype
the default is 3 (front cover). more than one --picture option can be specified to attach multiple pictures. there may only be one picture each of type 1 and type 2 in a file. π¨
media-type is optional and is now ignored.
description is optional. the default is an empty string.
the next part specifies the resolution and color information, but is now ignored.
filename is the path to the picture file to be imported.
--padding nβ reserve n extra bytes for metadata tags. this can make later tag editing more efficient. defaults to 512.--discard-commentsβ don't propagate metadata tags from the input file. bye tags π--discard-picturesβ don't propagate pictures or art from the input file. bye art ππΌοΈ
π Input options π
--rawβ interpret input as raw PCM data without headers--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 big endian, 0 for little (default: 0)--ignorelengthβ ignore the data length 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. β οΈ
π¦ Diagnostic options π¦
--serial nβ force use of a specific stream serial number, rather than one that is randomly generated. this is used to make the encoder deterministic for testing and is not generally recommended. (testing only, bestie!)--save-range fileβ save check values for every frame to a file--set-ctl-int x=yβ pass the encoder control x with value y (advanced). preface withs:to direct the ctl to multistream s. this may be used multiple times. π§ advanced girlies only
π EXAMPLES π
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 160 kbit/s:
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
π NOTES π
so 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. π
fr fr: not her moment. she's a file encoder, not a live-streaming queen.
π AUTHORS π
Gregory Maxwell <greg@xiph.org>
π SEE ALSO π
opusdec(1), opusinfo(1), oggfwd(1)
Xiph.Org Foundation Β· 2012-08-31 Β· and that's the whole opusenc(1) page, bestie π go encode something pretty, mwah πβ¨π¦
π¦ where this page comes from
- alpine 3.24: opus-tools-doc 0.2-r2 Β· BSD-2-Clause
- arch rolling: opus-tools 0.2-7 Β· BSD
- debian bookworm: opus-tools 0.2-1+b1 Β· BSD-2-Clause
- debian trixie: opus-tools 0.2-1+b3 Β· BSD-2-Clause
- fedora 43: opus-tools 0.2-19.fc43 Β· LicenseRef-Callaway-BSD AND GPL-2.0-only
- fedora 44: opus-tools 0.2-20.fc44 Β· LicenseRef-Callaway-BSD AND GPL-2.0-only
- nixos 26.05: opus-tools 0.2
- nixpkgs unstable: opus-tools 0.2
- ubuntu noble: opus-tools 0.2-1build3 Β· BSD-2-Clause
- ubuntu questing: opus-tools 0.2-1build4
- ubuntu resolute: opus-tools 0.2-1build5 Β· BSD-2-Clause
- ubuntu stonking: opus-tools 0.2-1build5 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms