blob: 3d4d94b33de6890da0ef1009d97796f4636678b7 [file] [log] [blame]
Gregory Maxwell42815772012-04-25 13:30:21 -04001Opus is a codec for interactive speech and audio transmission over the Internet.
2
3 Opus can handle a wide range of interactive audio applications, including
4Voice over IP, videoconferencing, in-game chat, and even remote live music
5performances. It can scale from low bit-rate narrowband speech to very high
6quality stereo music.
7
8The IETF draft covering Opus can be found at:
9 http://tools.ietf.org/id/draft-ietf-codec-opus
10
11Opus is subject to the royalty-free patent and copyright licenses specified
12in the file COPYING.
13
14This package implements a shared library for encoding and decoding raw Opus
15bitstreams. Raw Opus bitstreams should be used over RTP according to
16 http://tools.ietf.org/html/draft-spittka-payload-rtp-opus
17
18The package also includes a number of test tools used for testing the
19correct operation of the library. The bitstreams read/written by these
20tools should not be used for Opus file distribution: They include
21additional debugging data and cannot support seeking.
22
23Opus stored in files should use the Ogg encapsulation for Opus which is
24described at:
25 http://wiki.xiph.org/OggOpus
26
27An opus-tools package is available which provides encoding and decoding of
28Ogg encapsulated Opus files and includes a number of useful features.
29Opus-tools can be found at:
30 http://git.xiph.org/?p=users/greg/opus-tools.git
31
32== Compiling libopus ==
Jean-Marc Valin4468c752010-07-08 13:40:07 -040033To build from a distribution tarball, you only need to do the following:
Jean-Marc Valin8ba2a772010-07-05 14:55:02 -040034
Jean-Marc Valinfe741252011-04-30 14:21:35 -040035% ./configure
Jean-Marc Valin8ba2a772010-07-05 14:55:02 -040036% make
37
Kat Walsh3269dce2011-08-15 22:43:51 -040038To build from the git repository, the following steps are necessary:
Jean-Marc Valin4468c752010-07-08 13:40:07 -040039
Jean-Marc Valinfe741252011-04-30 14:21:35 -0400401) Clone the repository:
Jean-Marc Valin4468c752010-07-08 13:40:07 -040041
Jean-Marc Valinfe741252011-04-30 14:21:35 -040042% git clone git://git.opus-codec.org/opus.git
43% cd opus
Jean-Marc Valin4468c752010-07-08 13:40:07 -040044
Jean-Marc Valinfe741252011-04-30 14:21:35 -0400451) Compiling
Jean-Marc Valin4468c752010-07-08 13:40:07 -040046
47% ./autogen.sh
Jean-Marc Valinfe741252011-04-30 14:21:35 -040048% ./configure
Jean-Marc Valin4468c752010-07-08 13:40:07 -040049% make
50
Gregory Maxwella5ff49e2011-10-26 19:56:00 -040051Once you have compiled the codec, there will be a opus_demo executable in
Gregory Maxwell3bcf3672011-09-09 17:11:43 -040052the top directory.
Jean-Marc Valin4468c752010-07-08 13:40:07 -040053
Gregory Maxwella5ff49e2011-10-26 19:56:00 -040054Usage: opus_demo [-e] <application> <sampling rate (Hz)> <channels (1/2)>
Gregory Maxwell3bcf3672011-09-09 17:11:43 -040055 <bits per second> [options] <input> <output>
Gregory Maxwella5ff49e2011-10-26 19:56:00 -040056 opus_demo -d <sampling rate (Hz)> <channels (1/2)> [options]
Gregory Maxwell3bcf3672011-09-09 17:11:43 -040057 <input> <output>
Jean-Marc Valin4468c752010-07-08 13:40:07 -040058
Gregory Maxwell3bcf3672011-09-09 17:11:43 -040059mode: voip | audio | restricted-lowdelay
Jean-Marc Valin08062002011-03-09 13:24:24 -050060options:
Kat Walsh3269dce2011-08-15 22:43:51 -040061-e : only runs the encoder (output the bit-stream)
62-d : only runs the decoder (reads the bit-stream as input)
63-cbr : enable constant bitrate; default: variable bitrate
Gregory Maxwella5ff49e2011-10-26 19:56:00 -040064-cvbr : enable constrained variable bitrate; default: unconstrained
Kat Walsh3269dce2011-08-15 22:43:51 -040065-bandwidth <NB|MB|WB|SWB|FB> : audio bandwidth (from narrowband to fullband);
66 default: sampling rate
67-framesize <2.5|5|10|20|40|60> : frame size in ms; default: 20
Jean-Marc Valin08062002011-03-09 13:24:24 -050068-max_payload <bytes> : maximum payload size in bytes, default: 1024
69-complexity <comp> : complexity, 0 (lowest) ... 10 (highest); default: 10
70-inbandfec : enable SILK inband FEC
Kat Walsh3269dce2011-08-15 22:43:51 -040071-forcemono : force mono encoding, even for stereo input
Jean-Marc Valin08062002011-03-09 13:24:24 -050072-dtx : enable SILK DTX
73-loss <perc> : simulate packet loss, in percent (0-100); default: 0
Jean-Marc Valin78a4b582010-07-08 15:51:49 -040074
Kat Walsh56de7802012-05-15 17:50:40 -040075input and output are little-endian signed 16-bit PCM files or opus bitstreams
Gregory Maxwell42815772012-04-25 13:30:21 -040076with simple opus_demo proprietary framing.
77
78== Testing ==
79
80This package includes a collection of automated unit and system tests
81which should be run after compiling the package especially the first
82time it is run on a new platform.
83
84To run the integrated tests:
85% make check
86
87There is also collection of standard test vectors which are not
88included in this package for size reasons but can be obtained from:
89http://opus-codec.org/testvectors/opus_testvectors-draft11.tar.gz
90
91To run compare the code to these test vectors:
92% tar -zxf opus_testvectors-draft11.tar.gz
93% ./tests/run_vectors.sh ./ opus_testvectors 48000
94
95== Portability notes ==
96
97This implementation uses floating-point by default but can be compiled to
98use only fixed-point arithmetic by setting --enable-fixed-point (if using
99autoconf) or by defining the FIXED_POINT macro (if building manually).
100The fixed point implementation has somewhat lower audio quality and is
101slower on platforms with fast FPUs, it is normally only used in embedded
102environments.
103
104The implementation can be compiled with either a C89 or a C99 compiler.
105While it does not rely on any _undefined behavior_ as defined by C89 or
106C99, it relies on common _implementation-defined behavior_ for two's
107complement architectures:
108
109o Right shifts of negative values are consistent with two's
110 complement arithmetic, so that a>>b is equivalent to
111 floor(a/(2^b)),
112
113o For conversion to a signed integer of N bits, the value is reduced
114 modulo 2^N to be within range of the type,
115
116o The result of integer division of a negative value is truncated
117 towards zero, and
118
119o The compiler provides a 64-bit integer type (a C99 requirement
120 which is supported by most C89 compilers).