shithub: opus-tools

Download patch

ref: 3138cb7c9a8b108a9609d53ad56ae6391130af79
parent: f82199b1047e896abadc5527a4837ede2a995ba9
author: Gregory Maxwell <[email protected]>
date: Thu Jul 11 12:36:57 EDT 2013

Doc improvements for --bitrate, and a --quality alias for it.

--- a/man/opusenc.1
+++ b/man/opusenc.1
@@ -100,15 +100,38 @@
 .IP "-V, --version"
 Show the version number
 .IP "--bitrate N.nnn"
-Encoding bitrate in kbit/sec (6-256 per channel)
+Target bitrate in kbit/sec (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.
+
+.IP "--quality N.nnn"
+Target audio quality (6-256 per channel).
+
+In VBR mode this is the same as bitrate: It specifies quality in terms of the
+average rate for a large collection of audio.
 .br
 Default for >=44.1kHz input is 64kbps per mono stream, 96kbps per coupled pair.
 .IP "--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.
+
 .IP "--cvbr"
-Use constrained variable bitrate encoding
+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. This delivers less consistent
+quality than VBR mode but consistent bitrate.
 .IP "--hard-cbr"
-Use hard constant bitrate encoding
+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.
 .IP "--comp N"
 Encoding computational complexity (0-10, default: 10). Zero gives the
 fastest encodes but lower quality, while 10 gives the highest quality
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -129,7 +129,8 @@
   printf("  filename.opus     compressed file\n");
   printf("  -                 stdout\n");
   printf("\nEncoding options:\n");
-  printf(" --bitrate n.nnn    Encoding bitrate in kbit/sec (6-256 per channel)\n");
+  printf(" --bitrate n.nnn    Target bitrate in kbit/sec (6-256/channel)\n");
+  printf(" --quality n.nnn    Target quality (6-256/channel; same as bitrate in VBR)\n");
   printf(" --vbr              Use variable bitrate encoding (default)\n");
   printf(" --cvbr             Use constrained variable bitrate encoding\n");
   printf(" --hard-cbr         Use hard constant bitrate encoding\n");
@@ -252,6 +253,7 @@
   {
     {"quiet", no_argument, NULL, 0},
     {"bitrate", required_argument, NULL, 0},
+    {"quality", required_argument, NULL, 0},
     {"hard-cbr",no_argument,NULL, 0},
     {"vbr",no_argument,NULL, 0},
     {"cvbr",no_argument,NULL, 0},
@@ -403,7 +405,8 @@
       case 0:
         if(strcmp(long_options[option_index].name,"quiet")==0){
           quiet=1;
-        }else if(strcmp(long_options[option_index].name,"bitrate")==0){
+        }else if(strcmp(long_options[option_index].name,"bitrate")==0||
+                 strcmp(long_options[option_index].name,"quality")==0){
           bitrate=atof(optarg)*1000.;
         }else if(strcmp(long_options[option_index].name,"hard-cbr")==0){
           with_hard_cbr=1;