LinuxCommandLibrary

opusenc

Encode audio files into Opus format

TLDR

Convert WAV to Opus using default options

$ opusenc [path/to/input.wav] [path/to/output.opus]
copy

Convert stereo audio at the highest quality level
$ opusenc --bitrate [512] [path/to/input.wav] [path/to/output.opus]
copy

Convert 5.1 surround sound audio at the highest quality level
$ opusenc --bitrate [1536] [path/to/input.flac] [path/to/output.opus]
copy

Convert speech audio at the lowest quality level
$ opusenc [path/to/input.wav] --downmix-mono --bitrate [6] [path/to/out.opus]
copy

SYNOPSIS

opusenc [options] input_file [output_file]

PARAMETERS

--bitrate <rate>
    Sets the bitrate in kbps. e.g., 64 for 64 kbps.

--comp <complexity>
    Sets the encoding complexity (0-10, default: 10).

--hard-cbr
    Forces constant bitrate encoding.

--vbr
    Enables variable bitrate encoding (default).

--cvbr
    Enables constrained variable bitrate encoding.

--framesize <size>
    Sets the frame size in milliseconds (2.5, 5, 10, 20, 40, or 60).

--rate <rate>
    Sets the sampling rate in Hz. If not provided, the encoder tries to infer the sampling rate from the input file.

--channels <channels>
    Sets the number of channels. If not provided, the encoder tries to infer the number of channels from the input file.

--downmix-mono
    Downmix to mono.

--downmix-stereo
    Downmix to stereo (if more than 2 channels).

--ignore-length
    Ignores the data length in the input file.

--padding <size>
    Sets the maximum padding in bytes.

--comment <field>=<value>
    Adds a comment to the Opus stream metadata.

--title <title>
    Sets the title metadata.

--artist <artist>
    Sets the artist metadata.

--album <album>
    Sets the album metadata.

--genre <genre>
    Sets the genre metadata.

--date <date>
    Sets the date metadata.

--tracknumber <number>
    Sets the track number metadata.

--version
    Displays the version information and exits.

--help
    Displays the help message and exits.

DESCRIPTION

The opusenc command-line tool encodes audio files into the Opus format. It is part of the libopus tools, which provide a simple and efficient way to convert audio data to the Opus codec. Opus is a lossy audio compression format known for its high quality at low bitrates, making it suitable for streaming, VoIP, and general audio storage.

opusenc allows you to specify various parameters, such as bitrate, sample rate, and number of channels, to fine-tune the encoding process. It supports a variety of input formats, including WAV, FLAC, and raw audio. This utility is very important for those trying to encode high quality audio at a reasonably small size. It's open-source nature makes it very portable, and can be compiled on many platforms.

FILE NAMING

If the output_file is not specified, opusenc creates a file with the same name as the input_file but with the '.opus' extension.

HISTORY

opusenc was developed as part of the libopus project by Xiph.org. The Opus codec was designed to provide high-quality audio compression at low bitrates, combining the best features of the SILK and CELT codecs. Its development aimed at creating a royalty-free audio codec suitable for a wide range of applications.

SEE ALSO

opusdec(1)

Copied to clipboard