[xiph-cvs] cvs commit: vorbis-tools/oggenc/man oggenc.1

Michael Smith msmith at xiph.org
Sat Aug 4 22:41:30 PDT 2001



msmith      01/08/04 22:41:29

  Modified:    oggenc   Tag: tools-pre-rc2 encode.c encode.h oggenc.c
               oggenc/man Tag: tools-pre-rc2 oggenc.1
  Log:
  Pre rc2 commit of oggenc. Updates for new vorbisenc api, and documentation
  updates/fixes.

Revision  Changes    Path
No                   revision

No                   revision

1.7.6.1   +6 -2      vorbis-tools/oggenc/encode.c

Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/encode.c,v
retrieving revision 1.7
retrieving revision 1.7.6.1
diff -u -r1.7 -r1.7.6.1
--- encode.c	2000/11/05 04:52:21	1.7
+++ encode.c	2001/08/05 05:41:25	1.7.6.1
@@ -48,8 +48,12 @@
 
         /* Have vorbisenc choose a mode for us */
         vorbis_info_init(&vi);
-	vorbis_encode_init(&vi, opt->channels, opt->rate, -1, 
-			opt->bitrate*1000, -1);
+
+	if(opt->bitrate >= 0 || opt->min_bitrate >= 0 || opt->max_bitrate >=0)
+		vorbis_encode_init(&vi, opt->channels, opt->rate, opt->min_bitrate*1000,
+				opt->bitrate*1000, opt->max_bitrate*1000);
+	else
+		vorbis_encode_init_vbr(&vi, opt->channels, opt->rate, opt->quality);
 
 
         /* Now, set up the analysis engine, stream encoder, and other

1.8.2.1   +9 -1      vorbis-tools/oggenc/encode.h

Index: encode.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/encode.h,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- encode.h	2001/07/02 09:39:10	1.8
+++ encode.h	2001/08/05 05:41:25	1.8.2.1
@@ -53,7 +53,12 @@
 
         char *namefmt;
         char *outfile;
-	int kbps;
+	/* All 3 in kbps */
+	int min_bitrate;
+	int nominal_bitrate;
+	int max_bitrate;
+	/* Float from 0 to 1 (low->high) */
+	float quality;
         unsigned int serial;
 } oe_options;
 
@@ -74,6 +79,9 @@
         long rate;
         int samplesize;
         int bitrate;
+	int min_bitrate;
+	int max_bitrate;
+	float quality;
 
         FILE *out;
         char *filename;

1.17.2.1  +42 -11    vorbis-tools/oggenc/oggenc.c

Index: oggenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/oggenc.c,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -u -r1.17 -r1.17.2.1
--- oggenc.c	2001/07/24 12:00:15	1.17
+++ oggenc.c	2001/08/05 05:41:25	1.17.2.1
@@ -21,12 +21,12 @@
 #include "audio.h"
 #include "utf8.h"
 
-#define VERSION_STRING "OggEnc v0.7 (libvorbis rc1)\n"
+#define VERSION_STRING "OggEnc v0.8 (libvorbis rc2)\n"
 #define COPYRIGHT "(c) 2000 Michael Smith <msmith at labyrinth.net.au)\n"
 #define CHUNK 4096 /* We do reads, etc. in multiples of this */
 
 struct option long_options[] = {
-	{"quiet",0,0,'q'},
+	{"quiet",0,0,'Q'},
         {"help",0,0,'h'},
         {"comment",1,0,'c'},
         {"artist",1,0,'a'},
@@ -40,6 +40,9 @@
         {"raw-chan",1,0,'C'},
         {"raw-rate",1,0,'R'},
         {"bitrate",1,0,'b'},
+	{"min-bitrate",1,0,'m'},
+	{"max-bitrate",1,0,'M'},
+	{"quality",1,0,'q'},
         {"date",1,0,'d'},
         {"tracknum",1,0,'N'},
         {"serial",1,0,'s'},
@@ -56,7 +59,7 @@
 int main(int argc, char **argv)
 {
         oe_options opt = {"ISO-8859-1", NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 
-		0, NULL, 0, 0, 0,16,44100,2, NULL,NULL,128,0}; /* Default values */
+		0, NULL, 0, 0, 0,16,44100,2, NULL,NULL,-1,-1,-1, 0.5f,0}; /* Default values */
         int i;
 
         char **infiles;
@@ -233,7 +236,9 @@
                 enc_opts.out = out;
                 enc_opts.comments = &vc;
                 enc_opts.filename = out_fn;
-		enc_opts.bitrate = opt.kbps; /* defaulted at the start, so this is ok */
+		enc_opts.bitrate = opt.nominal_bitrate; 
+		enc_opts.min_bitrate = opt.min_bitrate;
+		enc_opts.max_bitrate = opt.max_bitrate;
 
                 if(!enc_opts.total_samples_per_channel)
                         enc_opts.progress_update = update_statistics_notime;
@@ -271,15 +276,22 @@
                 "\n"
                 "OPTIONS:\n"
                 " General:\n"
-		" -q, --quiet          Produce no output to stderr\n"
+		" -Q, --quiet          Produce no output to stderr\n"
                 " -h, --help           Print this help text\n"
                 " -r, --raw            Raw mode. Input files are read directly as PCM data\n"
                 " -B, --raw-bits=n     Set bits/sample for raw input. Default is 16\n"
                 " -C, --raw-chan=n     Set number of channels for raw input. Default is 2\n"
                 " -R, --raw-rate=n     Set samples/sec for raw input. Default is 44100\n"
-		" -b, --bitrate        Choose a bitrate to encode at. Internally,\n"
-		"                      a mode approximating this value is chosen.\n"
-		"                      Takes an argument in kbps. Default is 128kbps\n"
+		" -b, --bitrate        Choose a nominal bitrate to encode at. Attempt\n"
+		"                      to encode at a bitrate averaging this. Takes an\n"
+		"                      argument in kbps.\n"
+		" -m, --min-bitrate    Specify a minimum bitrate (in kbps). Useful for\n"
+		"                      encoding for a fixed-size channel.\n"
+		" -M, --max-bitrate    Specify a maximum bitrate in kbps. Usedful for\n"
+		"                      streaming purposes.\n"
+		" -q, --quality        Specify quality between 0 (low) and 10 (high),\n"
+		"                      instead of specifying a particular bitrate.\n"
+		"                      This is the normal mode of operation.\n"
                 " -s, --serial         Specify a serial number for the stream. If encoding\n"
                 "                      multiple files, this will be incremented for each\n"
                 "                      stream after the first.\n"
@@ -391,7 +403,7 @@
         int ret;
         int option_index = 1;
 
-	while((ret = getopt_long(argc, argv, "a:b:B:c:C:d:e:hl:n:N:o:qrR:s:t:v", 
+	while((ret = getopt_long(argc, argv, "a:b:B:c:C:d:e:hl:m:M:n:N:o:qQ:rR:s:t:v", 
                                         long_options, &option_index)) != -1)
         {
                 switch(ret)
@@ -430,8 +442,27 @@
                                 opt->title[opt->title_count - 1] = strdup(optarg);
                                 break;
                         case 'b':
-				opt->kbps = atoi(optarg);
+				opt->nominal_bitrate = atoi(optarg);
                                 break;
+			case 'm':
+				opt->min_bitrate = atoi(optarg);
+				break;
+			case 'M':
+				opt->max_bitrate = atoi(optarg);
+				break;
+			case 'q':
+				opt->quality = (float)(atof(optarg) * 0.1);
+				if(opt->quality > 1.0f)
+				{
+					opt->quality = 1.0f;
+					fprintf(stderr, "WARNING: quality setting too high, setting to maximum quality.\n");
+				}
+				else if(opt->quality < 0.f)
+				{
+					opt->quality = 0.f;
+					fprintf(stderr, "WARNING: negative quality specified, setting to minimum.\n");
+				}
+				break;
                         case 'n':
                                 if(opt->namefmt)
                                 {
@@ -452,7 +483,7 @@
                                 usage();
                                 exit(0);
                                 break;
-			case 'q':
+			case 'Q':
                                 opt->quiet = 1;
                                 break;
                         case 'r':

No                   revision

No                   revision

1.5.4.1   +41 -11    vorbis-tools/oggenc/man/oggenc.1

Index: oggenc.1
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/man/oggenc.1,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -u -r1.5 -r1.5.4.1
--- oggenc.1	2001/05/27 20:35:53	1.5
+++ oggenc.1	2001/08/05 05:41:27	1.5.4.1
@@ -1,7 +1,7 @@
 .\" Process this file with
 .\" groff -man -Tascii oggenc.1
 .\"
-.TH oggenc 1 "May 27, 2001" "" "Vorbis Tools beta 4"
+.TH oggenc 1 "May 27, 2001" "" "Vorbis Tools release candidate 2"
 
 .SH NAME
 oggenc \- encode audio into the Ogg Vorbis format
@@ -9,13 +9,25 @@
 .SH SYNOPSIS
 .B oggenc
 [
-.B -hrq
+.B -hrQ
 ]
 [
 .B -b
-.I bitrate 
+.I nominal bitrate
 ]
 [
+.B -m
+.I minimum bitrate
+]
+[
+.B -M
+.I maximum bitrate
+]
+[
+.B -q
+.I quality
+]
+[
 .B -o
 .I output_file
 ]
@@ -49,7 +61,7 @@
 .I stdin
 and the Vorbis stream is written to
 .I stdout
-unless the 
+unless the
 .B -o
 option is used to redirect the output.  By default, disk files are
 output to Ogg Vorbis files of the same name, with the extension
@@ -72,10 +84,16 @@
 Sets raw input number of channels. Default is 2
 .IP "-R n, --raw-rate=n"
 Sets raw input samplerate. Default is 44100
-.IP "-q, --quiet"
+.IP "-Q, --quiet"
 Quiet mode.  No messages are displayed.
 .IP "-b n, --bitrate=n"
-Sets encoding to the bitrate closest to n (in kb/s). Defaults to 128 kb/s for stereo.
+Sets encoding to the bitrate closest to n (in kb/s).
+.IP "-m n, --min-bitrate=n"
+Sets minimum bitrate to n (in kb/s).
+.IP "-M n, --max-bitrate=n"
+Sets maximum bitrate to n (in kb/s).
+.IP "-q n, --quality=n"
+Sets encoding quality to n, between 0 (low) and 10 (high). This is the default mode of operation.
 .IP "-s, --serial"
 Forces a specific serial number in the output stream. This is primarily useful for testing.
 .IP "-o output_file, --output=output_file"
@@ -88,9 +106,9 @@
 gives a literal %.
 
 .IP "-c comment, --comment comment"
-Add the string 
+Add the string
 .I comment
-as an extra comment.  This may be used multiple times, and all 
+as an extra comment.  This may be used multiple times, and all
 instances will be added to each of the input files specified.
 
 .IP "-a artist, --artist artist"
@@ -134,16 +152,28 @@
 .RE
 .PP
 
-Specifying a high-quality mode (approx 256 kbps):
+Specifying a high-quality encoding averaging 256 kbps.
 .RS
 oggenc infile.wav -b 256 out.ogg
 .RE
 .PP
 
+Specifying a maximum and average bitrate.
+.RS
+oggenc infile.wav -b 128 -M 160 out.ogg
+.RE
+.PP
+
+Specifying quality rather than bitrate (to a very high quality mode)
+.RS
+oggenc infile.wav -q 9 out.ogg
+.RE
+.PP
+
 Adding some info about the track:
 .RS
 oggenc somefile.wav -t "The track title" -a "artist who performed this" -l
-"name of album" -c 
+"name of album" -c
 "OTHERFIELD=contents of some other field not explictly supported"
 .RE
 .PP
@@ -151,7 +181,7 @@
 This encodes the three files, each with the
 same artist/album tag, but with different title tags on each one. The
 string given as an argument to -n is used to generate filenames, as shown
-in the section above. This example gives filenames 
+in the section above. This example gives filenames
 like "The Tea Party - Touch.ogg":
 .RS
 oggenc -b 192 -a "The Tea Party" -l "Triptych" -t "Touch" track01.wav -t

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list