How to encode audio with Opus codec?











up vote
24
down vote

favorite
8












The Opus audio codec looks like the best thing ever for compressing audio. It has recently become supported in the latest ffmpeg and VLC players. However, there is no documentation I can find on how to actually encode media with it. Can someone please direct me to said docs, preferably with specifics to ffmpeg flags and usage? I have a lot of audiobooks that are taking up far too much space and Opus looks like the perfect format to keep them in.










share|improve this question


















  • 1




    You did not mention your OS.
    – LordNeckbeard
    Dec 9 '12 at 17:48















up vote
24
down vote

favorite
8












The Opus audio codec looks like the best thing ever for compressing audio. It has recently become supported in the latest ffmpeg and VLC players. However, there is no documentation I can find on how to actually encode media with it. Can someone please direct me to said docs, preferably with specifics to ffmpeg flags and usage? I have a lot of audiobooks that are taking up far too much space and Opus looks like the perfect format to keep them in.










share|improve this question


















  • 1




    You did not mention your OS.
    – LordNeckbeard
    Dec 9 '12 at 17:48













up vote
24
down vote

favorite
8









up vote
24
down vote

favorite
8






8





The Opus audio codec looks like the best thing ever for compressing audio. It has recently become supported in the latest ffmpeg and VLC players. However, there is no documentation I can find on how to actually encode media with it. Can someone please direct me to said docs, preferably with specifics to ffmpeg flags and usage? I have a lot of audiobooks that are taking up far too much space and Opus looks like the perfect format to keep them in.










share|improve this question













The Opus audio codec looks like the best thing ever for compressing audio. It has recently become supported in the latest ffmpeg and VLC players. However, there is no documentation I can find on how to actually encode media with it. Can someone please direct me to said docs, preferably with specifics to ffmpeg flags and usage? I have a lot of audiobooks that are taking up far too much space and Opus looks like the perfect format to keep them in.







audio ffmpeg vlc-media-player encoding






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 8 '12 at 23:52









MrDrMcCoy

3271314




3271314








  • 1




    You did not mention your OS.
    – LordNeckbeard
    Dec 9 '12 at 17:48














  • 1




    You did not mention your OS.
    – LordNeckbeard
    Dec 9 '12 at 17:48








1




1




You did not mention your OS.
– LordNeckbeard
Dec 9 '12 at 17:48




You did not mention your OS.
– LordNeckbeard
Dec 9 '12 at 17:48










3 Answers
3






active

oldest

votes

















up vote
26
down vote



accepted










ffmpeg -i input -acodec libopus -b:a bitrate -vbr on -compression_level 10 output


The ffmpeg documentation has a list of options and descriptions for libopus.



Make sure you compiled ffmpeg with --enable-libopus!






share|improve this answer























  • This is great! I had figured out how to encode with ffmpeg, but didn't know about the -vbr and --compression_level flags. This is exactly what I was looking for!
    – MrDrMcCoy
    Dec 5 '13 at 20:36






  • 2




    This helped me. NB, vbr on and compression_level 10 are defaults and can probably be omitted. ffmpeg.org/ffmpeg-codecs.html#Option-Mapping
    – Joshua Huber
    Oct 24 '17 at 18:12










  • Indeed, these are the default values, and in most cases they don't have to be modified. Also, note the bitrate is in bits/s, not the usual kbits/s. The default bitrate is 96000 (96 kbits/s), which is (of course arguably) a fine value. Sample command to summarize: ffmpeg -i input.flac -acodec libopus -b:a 128000 output.opus
    – Gras Double
    Aug 18 at 15:14


















up vote
13
down vote














  1. Download Opus-tools


  2. Encode:
    opusenc --bitrate 64 What_A_Feeling.wav What_A_Feeling_64.opus


  3. Decode: (to play in any media player, useful if your media player does not support opus yet):
    opusdec What_A_Feeling_64.opus What_A_Feeling_opus64.wav



(What_A_Feeling is a song name)



Detailed options displayed when running opusenc by itself:



Usage: opusenc [options] input_file output_file.opus

Encodes input_file using Opus.
It can read the WAV, AIFF, FLAC, Ogg/FLAC, or raw files.

General options:
-h, --help This help
-V, --version Version information
--quiet Quiet mode

input_file can be:
filename.wav file
- stdin

output_file can be:
filename.opus compressed file
- stdout

Encoding options:
--bitrate n.nnn Target bitrate in kbit/sec (6-256/channel)
--vbr Use variable bitrate encoding (default)
--cvbr Use constrained variable bitrate encoding
--hard-cbr Use hard constant bitrate encoding
--comp n Encoding complexity (0-10, default: 10 (slowest))
--framesize n Maximum frame size in milliseconds
(2.5, 5, 10, 20, 40, 60, default: 20)
--expect-loss Percentage packet loss to expect (default: 0)
--downmix-mono Downmix to mono
--downmix-stereo Downmix to stereo (if >2 channels)
--max-delay n Maximum container delay in milliseconds
(0-1000, default: 1000)

Diagnostic options:
--serial n Forces a specific stream serial number
--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

Metadata options:
--comment Add the given string as an extra comment
This may be used multiple times
--artist Author of this track
--title Title for this track
--album Album or collection this track belongs to
--date Date for this track
--genre Genre for this track
--picture Album art for this track
More than one --picture option can be specified.
Either a FILENAME for the picture file or a more
complete SPECIFICATION form can be used. The
SPECIFICATION is a string whose parts are
separated by | (pipe) characters. Some parts may
be left empty to invoke default values. A
FILENAME is just shorthand for "||||FILENAME".
The format of SPECIFICATION is

[TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHT
xDEPTH[/COLORS]]|FILENAME

TYPE is an optional number from one of:
0: Other
1: 32x32 pixel 'file icon' (PNG only)
2: Other file icon
3: Cover (front)
4: Cover (back)
5: Leaflet page
6: Media (e.g., label side of a CD)
7: Lead artist/lead performer/soloist
8: Artist/performer
9: Conductor
10: Band/Orchestra
11: Composer
12: Lyricist/text writer
13: Recording location
14: During recording
15: During performance
16: Movie/video screen capture
17: A bright colored fish
18: Illustration
19: Band/artist logotype
20: Publisher/studio logotype

The default is 3 (front cover). There may only be
one picture each of type 1 and 2 in a file.

MIME-TYPE is optional. If left blank, it will be
detected from the file. For best compatibility
with players, use pictures with a MIME-TYPE of
image/jpeg or image/png. The MIME-TYPE can also
be --> to mean that FILENAME is actually a URL to
an image, though this use is discouraged. The
file at the URL will not be fetched. The URL
itself is stored in the metadata.

DESCRIPTION is optional. The default is an empty
string.

The next part specifies the resolution and color
information. If the MIME-TYPE is image/jpeg,
image/png, or image/gif, you can usually leave
this empty and they can be detected from the
file. Otherwise, you must specify the width in
pixels, height in pixels, and color depth in
bits-per-pixel. If the image has indexed colors
you should also specify the number of colors
used. If possible, these are checked against the
file for accuracy.

FILENAME is the path to the picture file to be
imported, or the URL if the MIME-TYPE is -->.
--padding n Extra bytes to reserve for metadata (default: 512)
--discard-comments Don't keep metadata when transcoding
--discard-pictures Don't keep pictures when transcoding

Input options:
--raw Raw 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 n 1 for bigendian, 0 for little (defaults to 0)
--ignorelength Always ignore the datalength in Wave headers





share|improve this answer























  • Thanks, but I was hoping for something a bit more detailed. Are there variable bit rate options? What other flags can I pass to optimize the audio stream?
    – MrDrMcCoy
    Dec 9 '12 at 21:56








  • 1




    @nakedhitman The --vbr option is default. See the man page for opusenc. You can also encode with ffmpeg but it needs to be compiled with --enable-libopus after installing libopus.
    – LordNeckbeard
    Dec 9 '12 at 23:10










  • For getting an idea (not for batch conversion), an online version like this might be helpful. In case one's plan is to convert an entire collection, opusinfo (also part of opus-tools) might tell, whether the chosen encoding tool performed well.
    – Rainer Rillke
    Sep 16 '17 at 23:11


















up vote
1
down vote













The best Opus Codec commands in DOS/Windows Command would be:



For lib 1.3, smallest filesize (tape quality):



Opusenc a.wav a.opus --bitrate 24 --framesize 40 --discard-comments --discard-pictures


You will:



a- at 24kbits still have a 16kHz (32kHz stereo) sonic output, on a super small size. Any smaller, and Sonic output will drop to 11kHz



b- Increase framesize (save a few bits of data (about 6%), without perceivable loss in quality)



c- Discard unnecessary TAG info, and cover pictures that will only enlarge file size.



For lib 1.3, streaming (near CD quality) use '--bitrate 52' instead of '24'.



The default in 1.2 is 48kbits, but using 52 in 1.3, with 'framesize' set to 40, your file size is equal, but there are much less artifacts audible.



52 kbits with framesize 40, is arguably equal in quality to 160kbits MP3, at less than 1/3rd the size; while 48kbits on 1.2 equals 128kbits MP3, or only 2.5x smaller in size.



For near identical quality, you'll need between 80 to 96kbits. I hardly ever use this, as I want my audio as small as possible.



Over 96kbits, is only good for editing, and one can't audibly hear the difference between the original and the Opus encoded file.



That being said, I don't yet know how it all works in Linux.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f516806%2fhow-to-encode-audio-with-opus-codec%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    26
    down vote



    accepted










    ffmpeg -i input -acodec libopus -b:a bitrate -vbr on -compression_level 10 output


    The ffmpeg documentation has a list of options and descriptions for libopus.



    Make sure you compiled ffmpeg with --enable-libopus!






    share|improve this answer























    • This is great! I had figured out how to encode with ffmpeg, but didn't know about the -vbr and --compression_level flags. This is exactly what I was looking for!
      – MrDrMcCoy
      Dec 5 '13 at 20:36






    • 2




      This helped me. NB, vbr on and compression_level 10 are defaults and can probably be omitted. ffmpeg.org/ffmpeg-codecs.html#Option-Mapping
      – Joshua Huber
      Oct 24 '17 at 18:12










    • Indeed, these are the default values, and in most cases they don't have to be modified. Also, note the bitrate is in bits/s, not the usual kbits/s. The default bitrate is 96000 (96 kbits/s), which is (of course arguably) a fine value. Sample command to summarize: ffmpeg -i input.flac -acodec libopus -b:a 128000 output.opus
      – Gras Double
      Aug 18 at 15:14















    up vote
    26
    down vote



    accepted










    ffmpeg -i input -acodec libopus -b:a bitrate -vbr on -compression_level 10 output


    The ffmpeg documentation has a list of options and descriptions for libopus.



    Make sure you compiled ffmpeg with --enable-libopus!






    share|improve this answer























    • This is great! I had figured out how to encode with ffmpeg, but didn't know about the -vbr and --compression_level flags. This is exactly what I was looking for!
      – MrDrMcCoy
      Dec 5 '13 at 20:36






    • 2




      This helped me. NB, vbr on and compression_level 10 are defaults and can probably be omitted. ffmpeg.org/ffmpeg-codecs.html#Option-Mapping
      – Joshua Huber
      Oct 24 '17 at 18:12










    • Indeed, these are the default values, and in most cases they don't have to be modified. Also, note the bitrate is in bits/s, not the usual kbits/s. The default bitrate is 96000 (96 kbits/s), which is (of course arguably) a fine value. Sample command to summarize: ffmpeg -i input.flac -acodec libopus -b:a 128000 output.opus
      – Gras Double
      Aug 18 at 15:14













    up vote
    26
    down vote



    accepted







    up vote
    26
    down vote



    accepted






    ffmpeg -i input -acodec libopus -b:a bitrate -vbr on -compression_level 10 output


    The ffmpeg documentation has a list of options and descriptions for libopus.



    Make sure you compiled ffmpeg with --enable-libopus!






    share|improve this answer














    ffmpeg -i input -acodec libopus -b:a bitrate -vbr on -compression_level 10 output


    The ffmpeg documentation has a list of options and descriptions for libopus.



    Make sure you compiled ffmpeg with --enable-libopus!







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 20 '14 at 19:19









    LordNeckbeard

    24.8k54276




    24.8k54276










    answered Dec 5 '13 at 16:06









    Adam Chance

    53468




    53468












    • This is great! I had figured out how to encode with ffmpeg, but didn't know about the -vbr and --compression_level flags. This is exactly what I was looking for!
      – MrDrMcCoy
      Dec 5 '13 at 20:36






    • 2




      This helped me. NB, vbr on and compression_level 10 are defaults and can probably be omitted. ffmpeg.org/ffmpeg-codecs.html#Option-Mapping
      – Joshua Huber
      Oct 24 '17 at 18:12










    • Indeed, these are the default values, and in most cases they don't have to be modified. Also, note the bitrate is in bits/s, not the usual kbits/s. The default bitrate is 96000 (96 kbits/s), which is (of course arguably) a fine value. Sample command to summarize: ffmpeg -i input.flac -acodec libopus -b:a 128000 output.opus
      – Gras Double
      Aug 18 at 15:14


















    • This is great! I had figured out how to encode with ffmpeg, but didn't know about the -vbr and --compression_level flags. This is exactly what I was looking for!
      – MrDrMcCoy
      Dec 5 '13 at 20:36






    • 2




      This helped me. NB, vbr on and compression_level 10 are defaults and can probably be omitted. ffmpeg.org/ffmpeg-codecs.html#Option-Mapping
      – Joshua Huber
      Oct 24 '17 at 18:12










    • Indeed, these are the default values, and in most cases they don't have to be modified. Also, note the bitrate is in bits/s, not the usual kbits/s. The default bitrate is 96000 (96 kbits/s), which is (of course arguably) a fine value. Sample command to summarize: ffmpeg -i input.flac -acodec libopus -b:a 128000 output.opus
      – Gras Double
      Aug 18 at 15:14
















    This is great! I had figured out how to encode with ffmpeg, but didn't know about the -vbr and --compression_level flags. This is exactly what I was looking for!
    – MrDrMcCoy
    Dec 5 '13 at 20:36




    This is great! I had figured out how to encode with ffmpeg, but didn't know about the -vbr and --compression_level flags. This is exactly what I was looking for!
    – MrDrMcCoy
    Dec 5 '13 at 20:36




    2




    2




    This helped me. NB, vbr on and compression_level 10 are defaults and can probably be omitted. ffmpeg.org/ffmpeg-codecs.html#Option-Mapping
    – Joshua Huber
    Oct 24 '17 at 18:12




    This helped me. NB, vbr on and compression_level 10 are defaults and can probably be omitted. ffmpeg.org/ffmpeg-codecs.html#Option-Mapping
    – Joshua Huber
    Oct 24 '17 at 18:12












    Indeed, these are the default values, and in most cases they don't have to be modified. Also, note the bitrate is in bits/s, not the usual kbits/s. The default bitrate is 96000 (96 kbits/s), which is (of course arguably) a fine value. Sample command to summarize: ffmpeg -i input.flac -acodec libopus -b:a 128000 output.opus
    – Gras Double
    Aug 18 at 15:14




    Indeed, these are the default values, and in most cases they don't have to be modified. Also, note the bitrate is in bits/s, not the usual kbits/s. The default bitrate is 96000 (96 kbits/s), which is (of course arguably) a fine value. Sample command to summarize: ffmpeg -i input.flac -acodec libopus -b:a 128000 output.opus
    – Gras Double
    Aug 18 at 15:14












    up vote
    13
    down vote














    1. Download Opus-tools


    2. Encode:
      opusenc --bitrate 64 What_A_Feeling.wav What_A_Feeling_64.opus


    3. Decode: (to play in any media player, useful if your media player does not support opus yet):
      opusdec What_A_Feeling_64.opus What_A_Feeling_opus64.wav



    (What_A_Feeling is a song name)



    Detailed options displayed when running opusenc by itself:



    Usage: opusenc [options] input_file output_file.opus

    Encodes input_file using Opus.
    It can read the WAV, AIFF, FLAC, Ogg/FLAC, or raw files.

    General options:
    -h, --help This help
    -V, --version Version information
    --quiet Quiet mode

    input_file can be:
    filename.wav file
    - stdin

    output_file can be:
    filename.opus compressed file
    - stdout

    Encoding options:
    --bitrate n.nnn Target bitrate in kbit/sec (6-256/channel)
    --vbr Use variable bitrate encoding (default)
    --cvbr Use constrained variable bitrate encoding
    --hard-cbr Use hard constant bitrate encoding
    --comp n Encoding complexity (0-10, default: 10 (slowest))
    --framesize n Maximum frame size in milliseconds
    (2.5, 5, 10, 20, 40, 60, default: 20)
    --expect-loss Percentage packet loss to expect (default: 0)
    --downmix-mono Downmix to mono
    --downmix-stereo Downmix to stereo (if >2 channels)
    --max-delay n Maximum container delay in milliseconds
    (0-1000, default: 1000)

    Diagnostic options:
    --serial n Forces a specific stream serial number
    --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

    Metadata options:
    --comment Add the given string as an extra comment
    This may be used multiple times
    --artist Author of this track
    --title Title for this track
    --album Album or collection this track belongs to
    --date Date for this track
    --genre Genre for this track
    --picture Album art for this track
    More than one --picture option can be specified.
    Either a FILENAME for the picture file or a more
    complete SPECIFICATION form can be used. The
    SPECIFICATION is a string whose parts are
    separated by | (pipe) characters. Some parts may
    be left empty to invoke default values. A
    FILENAME is just shorthand for "||||FILENAME".
    The format of SPECIFICATION is

    [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHT
    xDEPTH[/COLORS]]|FILENAME

    TYPE is an optional number from one of:
    0: Other
    1: 32x32 pixel 'file icon' (PNG only)
    2: Other file icon
    3: Cover (front)
    4: Cover (back)
    5: Leaflet page
    6: Media (e.g., label side of a CD)
    7: Lead artist/lead performer/soloist
    8: Artist/performer
    9: Conductor
    10: Band/Orchestra
    11: Composer
    12: Lyricist/text writer
    13: Recording location
    14: During recording
    15: During performance
    16: Movie/video screen capture
    17: A bright colored fish
    18: Illustration
    19: Band/artist logotype
    20: Publisher/studio logotype

    The default is 3 (front cover). There may only be
    one picture each of type 1 and 2 in a file.

    MIME-TYPE is optional. If left blank, it will be
    detected from the file. For best compatibility
    with players, use pictures with a MIME-TYPE of
    image/jpeg or image/png. The MIME-TYPE can also
    be --> to mean that FILENAME is actually a URL to
    an image, though this use is discouraged. The
    file at the URL will not be fetched. The URL
    itself is stored in the metadata.

    DESCRIPTION is optional. The default is an empty
    string.

    The next part specifies the resolution and color
    information. If the MIME-TYPE is image/jpeg,
    image/png, or image/gif, you can usually leave
    this empty and they can be detected from the
    file. Otherwise, you must specify the width in
    pixels, height in pixels, and color depth in
    bits-per-pixel. If the image has indexed colors
    you should also specify the number of colors
    used. If possible, these are checked against the
    file for accuracy.

    FILENAME is the path to the picture file to be
    imported, or the URL if the MIME-TYPE is -->.
    --padding n Extra bytes to reserve for metadata (default: 512)
    --discard-comments Don't keep metadata when transcoding
    --discard-pictures Don't keep pictures when transcoding

    Input options:
    --raw Raw 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 n 1 for bigendian, 0 for little (defaults to 0)
    --ignorelength Always ignore the datalength in Wave headers





    share|improve this answer























    • Thanks, but I was hoping for something a bit more detailed. Are there variable bit rate options? What other flags can I pass to optimize the audio stream?
      – MrDrMcCoy
      Dec 9 '12 at 21:56








    • 1




      @nakedhitman The --vbr option is default. See the man page for opusenc. You can also encode with ffmpeg but it needs to be compiled with --enable-libopus after installing libopus.
      – LordNeckbeard
      Dec 9 '12 at 23:10










    • For getting an idea (not for batch conversion), an online version like this might be helpful. In case one's plan is to convert an entire collection, opusinfo (also part of opus-tools) might tell, whether the chosen encoding tool performed well.
      – Rainer Rillke
      Sep 16 '17 at 23:11















    up vote
    13
    down vote














    1. Download Opus-tools


    2. Encode:
      opusenc --bitrate 64 What_A_Feeling.wav What_A_Feeling_64.opus


    3. Decode: (to play in any media player, useful if your media player does not support opus yet):
      opusdec What_A_Feeling_64.opus What_A_Feeling_opus64.wav



    (What_A_Feeling is a song name)



    Detailed options displayed when running opusenc by itself:



    Usage: opusenc [options] input_file output_file.opus

    Encodes input_file using Opus.
    It can read the WAV, AIFF, FLAC, Ogg/FLAC, or raw files.

    General options:
    -h, --help This help
    -V, --version Version information
    --quiet Quiet mode

    input_file can be:
    filename.wav file
    - stdin

    output_file can be:
    filename.opus compressed file
    - stdout

    Encoding options:
    --bitrate n.nnn Target bitrate in kbit/sec (6-256/channel)
    --vbr Use variable bitrate encoding (default)
    --cvbr Use constrained variable bitrate encoding
    --hard-cbr Use hard constant bitrate encoding
    --comp n Encoding complexity (0-10, default: 10 (slowest))
    --framesize n Maximum frame size in milliseconds
    (2.5, 5, 10, 20, 40, 60, default: 20)
    --expect-loss Percentage packet loss to expect (default: 0)
    --downmix-mono Downmix to mono
    --downmix-stereo Downmix to stereo (if >2 channels)
    --max-delay n Maximum container delay in milliseconds
    (0-1000, default: 1000)

    Diagnostic options:
    --serial n Forces a specific stream serial number
    --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

    Metadata options:
    --comment Add the given string as an extra comment
    This may be used multiple times
    --artist Author of this track
    --title Title for this track
    --album Album or collection this track belongs to
    --date Date for this track
    --genre Genre for this track
    --picture Album art for this track
    More than one --picture option can be specified.
    Either a FILENAME for the picture file or a more
    complete SPECIFICATION form can be used. The
    SPECIFICATION is a string whose parts are
    separated by | (pipe) characters. Some parts may
    be left empty to invoke default values. A
    FILENAME is just shorthand for "||||FILENAME".
    The format of SPECIFICATION is

    [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHT
    xDEPTH[/COLORS]]|FILENAME

    TYPE is an optional number from one of:
    0: Other
    1: 32x32 pixel 'file icon' (PNG only)
    2: Other file icon
    3: Cover (front)
    4: Cover (back)
    5: Leaflet page
    6: Media (e.g., label side of a CD)
    7: Lead artist/lead performer/soloist
    8: Artist/performer
    9: Conductor
    10: Band/Orchestra
    11: Composer
    12: Lyricist/text writer
    13: Recording location
    14: During recording
    15: During performance
    16: Movie/video screen capture
    17: A bright colored fish
    18: Illustration
    19: Band/artist logotype
    20: Publisher/studio logotype

    The default is 3 (front cover). There may only be
    one picture each of type 1 and 2 in a file.

    MIME-TYPE is optional. If left blank, it will be
    detected from the file. For best compatibility
    with players, use pictures with a MIME-TYPE of
    image/jpeg or image/png. The MIME-TYPE can also
    be --> to mean that FILENAME is actually a URL to
    an image, though this use is discouraged. The
    file at the URL will not be fetched. The URL
    itself is stored in the metadata.

    DESCRIPTION is optional. The default is an empty
    string.

    The next part specifies the resolution and color
    information. If the MIME-TYPE is image/jpeg,
    image/png, or image/gif, you can usually leave
    this empty and they can be detected from the
    file. Otherwise, you must specify the width in
    pixels, height in pixels, and color depth in
    bits-per-pixel. If the image has indexed colors
    you should also specify the number of colors
    used. If possible, these are checked against the
    file for accuracy.

    FILENAME is the path to the picture file to be
    imported, or the URL if the MIME-TYPE is -->.
    --padding n Extra bytes to reserve for metadata (default: 512)
    --discard-comments Don't keep metadata when transcoding
    --discard-pictures Don't keep pictures when transcoding

    Input options:
    --raw Raw 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 n 1 for bigendian, 0 for little (defaults to 0)
    --ignorelength Always ignore the datalength in Wave headers





    share|improve this answer























    • Thanks, but I was hoping for something a bit more detailed. Are there variable bit rate options? What other flags can I pass to optimize the audio stream?
      – MrDrMcCoy
      Dec 9 '12 at 21:56








    • 1




      @nakedhitman The --vbr option is default. See the man page for opusenc. You can also encode with ffmpeg but it needs to be compiled with --enable-libopus after installing libopus.
      – LordNeckbeard
      Dec 9 '12 at 23:10










    • For getting an idea (not for batch conversion), an online version like this might be helpful. In case one's plan is to convert an entire collection, opusinfo (also part of opus-tools) might tell, whether the chosen encoding tool performed well.
      – Rainer Rillke
      Sep 16 '17 at 23:11













    up vote
    13
    down vote










    up vote
    13
    down vote










    1. Download Opus-tools


    2. Encode:
      opusenc --bitrate 64 What_A_Feeling.wav What_A_Feeling_64.opus


    3. Decode: (to play in any media player, useful if your media player does not support opus yet):
      opusdec What_A_Feeling_64.opus What_A_Feeling_opus64.wav



    (What_A_Feeling is a song name)



    Detailed options displayed when running opusenc by itself:



    Usage: opusenc [options] input_file output_file.opus

    Encodes input_file using Opus.
    It can read the WAV, AIFF, FLAC, Ogg/FLAC, or raw files.

    General options:
    -h, --help This help
    -V, --version Version information
    --quiet Quiet mode

    input_file can be:
    filename.wav file
    - stdin

    output_file can be:
    filename.opus compressed file
    - stdout

    Encoding options:
    --bitrate n.nnn Target bitrate in kbit/sec (6-256/channel)
    --vbr Use variable bitrate encoding (default)
    --cvbr Use constrained variable bitrate encoding
    --hard-cbr Use hard constant bitrate encoding
    --comp n Encoding complexity (0-10, default: 10 (slowest))
    --framesize n Maximum frame size in milliseconds
    (2.5, 5, 10, 20, 40, 60, default: 20)
    --expect-loss Percentage packet loss to expect (default: 0)
    --downmix-mono Downmix to mono
    --downmix-stereo Downmix to stereo (if >2 channels)
    --max-delay n Maximum container delay in milliseconds
    (0-1000, default: 1000)

    Diagnostic options:
    --serial n Forces a specific stream serial number
    --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

    Metadata options:
    --comment Add the given string as an extra comment
    This may be used multiple times
    --artist Author of this track
    --title Title for this track
    --album Album or collection this track belongs to
    --date Date for this track
    --genre Genre for this track
    --picture Album art for this track
    More than one --picture option can be specified.
    Either a FILENAME for the picture file or a more
    complete SPECIFICATION form can be used. The
    SPECIFICATION is a string whose parts are
    separated by | (pipe) characters. Some parts may
    be left empty to invoke default values. A
    FILENAME is just shorthand for "||||FILENAME".
    The format of SPECIFICATION is

    [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHT
    xDEPTH[/COLORS]]|FILENAME

    TYPE is an optional number from one of:
    0: Other
    1: 32x32 pixel 'file icon' (PNG only)
    2: Other file icon
    3: Cover (front)
    4: Cover (back)
    5: Leaflet page
    6: Media (e.g., label side of a CD)
    7: Lead artist/lead performer/soloist
    8: Artist/performer
    9: Conductor
    10: Band/Orchestra
    11: Composer
    12: Lyricist/text writer
    13: Recording location
    14: During recording
    15: During performance
    16: Movie/video screen capture
    17: A bright colored fish
    18: Illustration
    19: Band/artist logotype
    20: Publisher/studio logotype

    The default is 3 (front cover). There may only be
    one picture each of type 1 and 2 in a file.

    MIME-TYPE is optional. If left blank, it will be
    detected from the file. For best compatibility
    with players, use pictures with a MIME-TYPE of
    image/jpeg or image/png. The MIME-TYPE can also
    be --> to mean that FILENAME is actually a URL to
    an image, though this use is discouraged. The
    file at the URL will not be fetched. The URL
    itself is stored in the metadata.

    DESCRIPTION is optional. The default is an empty
    string.

    The next part specifies the resolution and color
    information. If the MIME-TYPE is image/jpeg,
    image/png, or image/gif, you can usually leave
    this empty and they can be detected from the
    file. Otherwise, you must specify the width in
    pixels, height in pixels, and color depth in
    bits-per-pixel. If the image has indexed colors
    you should also specify the number of colors
    used. If possible, these are checked against the
    file for accuracy.

    FILENAME is the path to the picture file to be
    imported, or the URL if the MIME-TYPE is -->.
    --padding n Extra bytes to reserve for metadata (default: 512)
    --discard-comments Don't keep metadata when transcoding
    --discard-pictures Don't keep pictures when transcoding

    Input options:
    --raw Raw 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 n 1 for bigendian, 0 for little (defaults to 0)
    --ignorelength Always ignore the datalength in Wave headers





    share|improve this answer















    1. Download Opus-tools


    2. Encode:
      opusenc --bitrate 64 What_A_Feeling.wav What_A_Feeling_64.opus


    3. Decode: (to play in any media player, useful if your media player does not support opus yet):
      opusdec What_A_Feeling_64.opus What_A_Feeling_opus64.wav



    (What_A_Feeling is a song name)



    Detailed options displayed when running opusenc by itself:



    Usage: opusenc [options] input_file output_file.opus

    Encodes input_file using Opus.
    It can read the WAV, AIFF, FLAC, Ogg/FLAC, or raw files.

    General options:
    -h, --help This help
    -V, --version Version information
    --quiet Quiet mode

    input_file can be:
    filename.wav file
    - stdin

    output_file can be:
    filename.opus compressed file
    - stdout

    Encoding options:
    --bitrate n.nnn Target bitrate in kbit/sec (6-256/channel)
    --vbr Use variable bitrate encoding (default)
    --cvbr Use constrained variable bitrate encoding
    --hard-cbr Use hard constant bitrate encoding
    --comp n Encoding complexity (0-10, default: 10 (slowest))
    --framesize n Maximum frame size in milliseconds
    (2.5, 5, 10, 20, 40, 60, default: 20)
    --expect-loss Percentage packet loss to expect (default: 0)
    --downmix-mono Downmix to mono
    --downmix-stereo Downmix to stereo (if >2 channels)
    --max-delay n Maximum container delay in milliseconds
    (0-1000, default: 1000)

    Diagnostic options:
    --serial n Forces a specific stream serial number
    --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

    Metadata options:
    --comment Add the given string as an extra comment
    This may be used multiple times
    --artist Author of this track
    --title Title for this track
    --album Album or collection this track belongs to
    --date Date for this track
    --genre Genre for this track
    --picture Album art for this track
    More than one --picture option can be specified.
    Either a FILENAME for the picture file or a more
    complete SPECIFICATION form can be used. The
    SPECIFICATION is a string whose parts are
    separated by | (pipe) characters. Some parts may
    be left empty to invoke default values. A
    FILENAME is just shorthand for "||||FILENAME".
    The format of SPECIFICATION is

    [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHT
    xDEPTH[/COLORS]]|FILENAME

    TYPE is an optional number from one of:
    0: Other
    1: 32x32 pixel 'file icon' (PNG only)
    2: Other file icon
    3: Cover (front)
    4: Cover (back)
    5: Leaflet page
    6: Media (e.g., label side of a CD)
    7: Lead artist/lead performer/soloist
    8: Artist/performer
    9: Conductor
    10: Band/Orchestra
    11: Composer
    12: Lyricist/text writer
    13: Recording location
    14: During recording
    15: During performance
    16: Movie/video screen capture
    17: A bright colored fish
    18: Illustration
    19: Band/artist logotype
    20: Publisher/studio logotype

    The default is 3 (front cover). There may only be
    one picture each of type 1 and 2 in a file.

    MIME-TYPE is optional. If left blank, it will be
    detected from the file. For best compatibility
    with players, use pictures with a MIME-TYPE of
    image/jpeg or image/png. The MIME-TYPE can also
    be --> to mean that FILENAME is actually a URL to
    an image, though this use is discouraged. The
    file at the URL will not be fetched. The URL
    itself is stored in the metadata.

    DESCRIPTION is optional. The default is an empty
    string.

    The next part specifies the resolution and color
    information. If the MIME-TYPE is image/jpeg,
    image/png, or image/gif, you can usually leave
    this empty and they can be detected from the
    file. Otherwise, you must specify the width in
    pixels, height in pixels, and color depth in
    bits-per-pixel. If the image has indexed colors
    you should also specify the number of colors
    used. If possible, these are checked against the
    file for accuracy.

    FILENAME is the path to the picture file to be
    imported, or the URL if the MIME-TYPE is -->.
    --padding n Extra bytes to reserve for metadata (default: 512)
    --discard-comments Don't keep metadata when transcoding
    --discard-pictures Don't keep pictures when transcoding

    Input options:
    --raw Raw 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 n 1 for bigendian, 0 for little (defaults to 0)
    --ignorelength Always ignore the datalength in Wave headers






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 20 '14 at 12:59









    Cees Timmerman

    9651933




    9651933










    answered Dec 9 '12 at 1:05









    Alexey Eromenko

    1312




    1312












    • Thanks, but I was hoping for something a bit more detailed. Are there variable bit rate options? What other flags can I pass to optimize the audio stream?
      – MrDrMcCoy
      Dec 9 '12 at 21:56








    • 1




      @nakedhitman The --vbr option is default. See the man page for opusenc. You can also encode with ffmpeg but it needs to be compiled with --enable-libopus after installing libopus.
      – LordNeckbeard
      Dec 9 '12 at 23:10










    • For getting an idea (not for batch conversion), an online version like this might be helpful. In case one's plan is to convert an entire collection, opusinfo (also part of opus-tools) might tell, whether the chosen encoding tool performed well.
      – Rainer Rillke
      Sep 16 '17 at 23:11


















    • Thanks, but I was hoping for something a bit more detailed. Are there variable bit rate options? What other flags can I pass to optimize the audio stream?
      – MrDrMcCoy
      Dec 9 '12 at 21:56








    • 1




      @nakedhitman The --vbr option is default. See the man page for opusenc. You can also encode with ffmpeg but it needs to be compiled with --enable-libopus after installing libopus.
      – LordNeckbeard
      Dec 9 '12 at 23:10










    • For getting an idea (not for batch conversion), an online version like this might be helpful. In case one's plan is to convert an entire collection, opusinfo (also part of opus-tools) might tell, whether the chosen encoding tool performed well.
      – Rainer Rillke
      Sep 16 '17 at 23:11
















    Thanks, but I was hoping for something a bit more detailed. Are there variable bit rate options? What other flags can I pass to optimize the audio stream?
    – MrDrMcCoy
    Dec 9 '12 at 21:56






    Thanks, but I was hoping for something a bit more detailed. Are there variable bit rate options? What other flags can I pass to optimize the audio stream?
    – MrDrMcCoy
    Dec 9 '12 at 21:56






    1




    1




    @nakedhitman The --vbr option is default. See the man page for opusenc. You can also encode with ffmpeg but it needs to be compiled with --enable-libopus after installing libopus.
    – LordNeckbeard
    Dec 9 '12 at 23:10




    @nakedhitman The --vbr option is default. See the man page for opusenc. You can also encode with ffmpeg but it needs to be compiled with --enable-libopus after installing libopus.
    – LordNeckbeard
    Dec 9 '12 at 23:10












    For getting an idea (not for batch conversion), an online version like this might be helpful. In case one's plan is to convert an entire collection, opusinfo (also part of opus-tools) might tell, whether the chosen encoding tool performed well.
    – Rainer Rillke
    Sep 16 '17 at 23:11




    For getting an idea (not for batch conversion), an online version like this might be helpful. In case one's plan is to convert an entire collection, opusinfo (also part of opus-tools) might tell, whether the chosen encoding tool performed well.
    – Rainer Rillke
    Sep 16 '17 at 23:11










    up vote
    1
    down vote













    The best Opus Codec commands in DOS/Windows Command would be:



    For lib 1.3, smallest filesize (tape quality):



    Opusenc a.wav a.opus --bitrate 24 --framesize 40 --discard-comments --discard-pictures


    You will:



    a- at 24kbits still have a 16kHz (32kHz stereo) sonic output, on a super small size. Any smaller, and Sonic output will drop to 11kHz



    b- Increase framesize (save a few bits of data (about 6%), without perceivable loss in quality)



    c- Discard unnecessary TAG info, and cover pictures that will only enlarge file size.



    For lib 1.3, streaming (near CD quality) use '--bitrate 52' instead of '24'.



    The default in 1.2 is 48kbits, but using 52 in 1.3, with 'framesize' set to 40, your file size is equal, but there are much less artifacts audible.



    52 kbits with framesize 40, is arguably equal in quality to 160kbits MP3, at less than 1/3rd the size; while 48kbits on 1.2 equals 128kbits MP3, or only 2.5x smaller in size.



    For near identical quality, you'll need between 80 to 96kbits. I hardly ever use this, as I want my audio as small as possible.



    Over 96kbits, is only good for editing, and one can't audibly hear the difference between the original and the Opus encoded file.



    That being said, I don't yet know how it all works in Linux.






    share|improve this answer

























      up vote
      1
      down vote













      The best Opus Codec commands in DOS/Windows Command would be:



      For lib 1.3, smallest filesize (tape quality):



      Opusenc a.wav a.opus --bitrate 24 --framesize 40 --discard-comments --discard-pictures


      You will:



      a- at 24kbits still have a 16kHz (32kHz stereo) sonic output, on a super small size. Any smaller, and Sonic output will drop to 11kHz



      b- Increase framesize (save a few bits of data (about 6%), without perceivable loss in quality)



      c- Discard unnecessary TAG info, and cover pictures that will only enlarge file size.



      For lib 1.3, streaming (near CD quality) use '--bitrate 52' instead of '24'.



      The default in 1.2 is 48kbits, but using 52 in 1.3, with 'framesize' set to 40, your file size is equal, but there are much less artifacts audible.



      52 kbits with framesize 40, is arguably equal in quality to 160kbits MP3, at less than 1/3rd the size; while 48kbits on 1.2 equals 128kbits MP3, or only 2.5x smaller in size.



      For near identical quality, you'll need between 80 to 96kbits. I hardly ever use this, as I want my audio as small as possible.



      Over 96kbits, is only good for editing, and one can't audibly hear the difference between the original and the Opus encoded file.



      That being said, I don't yet know how it all works in Linux.






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        The best Opus Codec commands in DOS/Windows Command would be:



        For lib 1.3, smallest filesize (tape quality):



        Opusenc a.wav a.opus --bitrate 24 --framesize 40 --discard-comments --discard-pictures


        You will:



        a- at 24kbits still have a 16kHz (32kHz stereo) sonic output, on a super small size. Any smaller, and Sonic output will drop to 11kHz



        b- Increase framesize (save a few bits of data (about 6%), without perceivable loss in quality)



        c- Discard unnecessary TAG info, and cover pictures that will only enlarge file size.



        For lib 1.3, streaming (near CD quality) use '--bitrate 52' instead of '24'.



        The default in 1.2 is 48kbits, but using 52 in 1.3, with 'framesize' set to 40, your file size is equal, but there are much less artifacts audible.



        52 kbits with framesize 40, is arguably equal in quality to 160kbits MP3, at less than 1/3rd the size; while 48kbits on 1.2 equals 128kbits MP3, or only 2.5x smaller in size.



        For near identical quality, you'll need between 80 to 96kbits. I hardly ever use this, as I want my audio as small as possible.



        Over 96kbits, is only good for editing, and one can't audibly hear the difference between the original and the Opus encoded file.



        That being said, I don't yet know how it all works in Linux.






        share|improve this answer












        The best Opus Codec commands in DOS/Windows Command would be:



        For lib 1.3, smallest filesize (tape quality):



        Opusenc a.wav a.opus --bitrate 24 --framesize 40 --discard-comments --discard-pictures


        You will:



        a- at 24kbits still have a 16kHz (32kHz stereo) sonic output, on a super small size. Any smaller, and Sonic output will drop to 11kHz



        b- Increase framesize (save a few bits of data (about 6%), without perceivable loss in quality)



        c- Discard unnecessary TAG info, and cover pictures that will only enlarge file size.



        For lib 1.3, streaming (near CD quality) use '--bitrate 52' instead of '24'.



        The default in 1.2 is 48kbits, but using 52 in 1.3, with 'framesize' set to 40, your file size is equal, but there are much less artifacts audible.



        52 kbits with framesize 40, is arguably equal in quality to 160kbits MP3, at less than 1/3rd the size; while 48kbits on 1.2 equals 128kbits MP3, or only 2.5x smaller in size.



        For near identical quality, you'll need between 80 to 96kbits. I hardly ever use this, as I want my audio as small as possible.



        Over 96kbits, is only good for editing, and one can't audibly hear the difference between the original and the Opus encoded file.



        That being said, I don't yet know how it all works in Linux.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 at 7:48









        ProDigit

        111




        111






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f516806%2fhow-to-encode-audio-with-opus-codec%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Сан-Квентин

            8-я гвардейская общевойсковая армия

            Алькесар