1
0

README 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. == Opus audio codec ==
  2. Opus is a codec for interactive speech and audio transmission over the Internet.
  3. Opus can handle a wide range of interactive audio applications, including
  4. Voice over IP, videoconferencing, in-game chat, and even remote live music
  5. performances. It can scale from low bit-rate narrowband speech to very high
  6. quality stereo music.
  7. Opus, when coupled with an appropriate container format, is also suitable
  8. for non-realtime stored-file applications such as music distribution, game
  9. soundtracks, portable music players, jukeboxes, and other applications that
  10. have historically used high latency formats such as MP3, AAC, or Vorbis.
  11. Opus is specified by IETF RFC 6716:
  12. https://tools.ietf.org/html/rfc6716
  13. The Opus format and this implementation of it are subject to the royalty-
  14. free patent and copyright licenses specified in the file COPYING.
  15. This package implements a shared library for encoding and decoding raw Opus
  16. bitstreams. Raw Opus bitstreams should be used over RTP according to
  17. https://tools.ietf.org/html/rfc7587
  18. The package also includes a number of test tools used for testing the
  19. correct operation of the library. The bitstreams read/written by these
  20. tools should not be used for Opus file distribution: They include
  21. additional debugging data and cannot support seeking.
  22. Opus stored in files should use the Ogg encapsulation for Opus which is
  23. described at:
  24. https://tools.ietf.org/html/rfc7845
  25. An opus-tools package is available which provides encoding and decoding of
  26. Ogg encapsulated Opus files and includes a number of useful features.
  27. Opus-tools can be found at:
  28. https://git.xiph.org/?p=opus-tools.git
  29. or on the main Opus website:
  30. https://opus-codec.org/
  31. == Compiling libopus ==
  32. To build from a distribution tarball, you only need to do the following:
  33. % ./configure
  34. % make
  35. To build from the git repository, the following steps are necessary:
  36. 0) Set up a development environment:
  37. On an Ubuntu or Debian family Linux distribution:
  38. % sudo apt-get install git autoconf automake libtool gcc make
  39. On a Fedora/Redhat based Linux:
  40. % sudo dnf install git autoconf automake libtool gcc make
  41. Or for older Redhat/Centos Linux releases:
  42. % sudo yum install git autoconf automake libtool gcc make
  43. On Apple macOS, install Xcode and brew.sh, then in the Terminal enter:
  44. % brew install autoconf automake libtool
  45. 1) Clone the repository:
  46. % git clone https://git.xiph.org/opus.git
  47. % cd opus
  48. 2) Compiling the source
  49. % ./autogen.sh
  50. % ./configure
  51. % make
  52. 3) Install the codec libraries (optional)
  53. % sudo make install
  54. Once you have compiled the codec, there will be a opus_demo executable
  55. in the top directory.
  56. Usage: opus_demo [-e] <application> <sampling rate (Hz)> <channels (1/2)>
  57. <bits per second> [options] <input> <output>
  58. opus_demo -d <sampling rate (Hz)> <channels (1/2)> [options]
  59. <input> <output>
  60. mode: voip | audio | restricted-lowdelay
  61. options:
  62. -e : only runs the encoder (output the bit-stream)
  63. -d : only runs the decoder (reads the bit-stream as input)
  64. -cbr : enable constant bitrate; default: variable bitrate
  65. -cvbr : enable constrained variable bitrate; default:
  66. unconstrained
  67. -bandwidth <NB|MB|WB|SWB|FB>
  68. : audio bandwidth (from narrowband to fullband);
  69. default: sampling rate
  70. -framesize <2.5|5|10|20|40|60>
  71. : frame size in ms; default: 20
  72. -max_payload <bytes>
  73. : maximum payload size in bytes, default: 1024
  74. -complexity <comp>
  75. : complexity, 0 (lowest) ... 10 (highest); default: 10
  76. -inbandfec : enable SILK inband FEC
  77. -forcemono : force mono encoding, even for stereo input
  78. -dtx : enable SILK DTX
  79. -loss <perc> : simulate packet loss, in percent (0-100); default: 0
  80. input and output are little-endian signed 16-bit PCM files or opus
  81. bitstreams with simple opus_demo proprietary framing.
  82. == Testing ==
  83. This package includes a collection of automated unit and system tests
  84. which SHOULD be run after compiling the package especially the first
  85. time it is run on a new platform.
  86. To run the integrated tests:
  87. % make check
  88. There is also collection of standard test vectors which are not
  89. included in this package for size reasons but can be obtained from:
  90. https://opus-codec.org/docs/opus_testvectors-rfc8251.tar.gz
  91. To run compare the code to these test vectors:
  92. % curl -OL https://opus-codec.org/docs/opus_testvectors-rfc8251.tar.gz
  93. % tar -zxf opus_testvectors-rfc8251.tar.gz
  94. % ./tests/run_vectors.sh ./ opus_newvectors 48000
  95. == Portability notes ==
  96. This implementation uses floating-point by default but can be compiled to
  97. use only fixed-point arithmetic by setting --enable-fixed-point (if using
  98. autoconf) or by defining the FIXED_POINT macro (if building manually).
  99. The fixed point implementation has somewhat lower audio quality and is
  100. slower on platforms with fast FPUs, it is normally only used in embedded
  101. environments.
  102. The implementation can be compiled with either a C89 or a C99 compiler.
  103. While it does not rely on any _undefined behavior_ as defined by C89 or
  104. C99, it relies on common _implementation-defined behavior_ for two's
  105. complement architectures:
  106. o Right shifts of negative values are consistent with two's
  107. complement arithmetic, so that a>>b is equivalent to
  108. floor(a/(2^b)),
  109. o For conversion to a signed integer of N bits, the value is reduced
  110. modulo 2^N to be within range of the type,
  111. o The result of integer division of a negative value is truncated
  112. towards zero, and
  113. o The compiler provides a 64-bit integer type (a C99 requirement
  114. which is supported by most C89 compilers).