opusenc.1 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. .\" Process this file with
  2. .\" groff -man -Tascii opusenc.1
  3. .\"
  4. .TH opusenc 1 2019-09-07 "Xiph.Org Foundation" "opus-tools"
  5. .SH NAME
  6. opusenc \(en encode audio into the Opus format
  7. .SH SYNOPSIS
  8. .B opusenc
  9. [
  10. .I options
  11. ]
  12. .I input_file
  13. .I output.opus
  14. .SH DESCRIPTION
  15. .B opusenc
  16. reads audio data in Wave, AIFF, FLAC, Ogg/FLAC,
  17. or raw PCM format and encodes it into an Ogg Opus stream.
  18. If the input file is "\fB\-\fR" audio data is read from stdin.
  19. Likewise, if the output file is "\fB\-\fR" the Ogg Opus stream
  20. is written to stdout.
  21. .PP
  22. Unless quieted
  23. .B opusenc
  24. displays statistics about the encoding progress.
  25. .SH OPTIONS
  26. .SS "General options"
  27. .TP
  28. .BR -h ", " --help
  29. Show command help.
  30. .TP
  31. .BR -V ", " --version
  32. Show version information.
  33. .TP
  34. .B --help-picture
  35. Show help on attaching album art.
  36. .TP
  37. .B --quiet
  38. Enable quiet mode.
  39. No messages are displayed.
  40. .SS "Encoding options"
  41. .TP
  42. .BI --bitrate " N"
  43. Set target bitrate in kbit/s (6\(en256 per channel).
  44. .IP
  45. In VBR mode this specifies the average rate for a large and diverse
  46. collection of audio.
  47. In CVBR and Hard-CBR mode it specifies the specific output bitrate.
  48. .IP
  49. The default for input with a sample rate of 44.1 kHz or higher is
  50. 64 kbit/s per mono stream and 96 kbit/s per coupled pair.
  51. .TP
  52. .B --vbr
  53. Use variable bitrate encoding (default).
  54. In VBR mode the bitrate may go up and down freely depending on the content
  55. to achieve more consistent quality.
  56. .TP
  57. .B --cvbr
  58. Use constrained variable bitrate encoding.
  59. Outputs a specific bitrate.
  60. This mode is analogous to CBR in AAC and MP3 encoders and managed mode in
  61. Vorbis coders.
  62. This delivers less consistent quality than VBR mode but consistent bitrate.
  63. .TP
  64. .B --hard-cbr
  65. Use hard constant bitrate encoding.
  66. With hard-cbr every frame will be exactly the same size, similar to how
  67. speech codecs work.
  68. This delivers lower overall quality but is useful where bitrate changes
  69. might leak data in encrypted channels or on synchronous transports.
  70. .TP
  71. .B --music
  72. Override automatic detection and tune low bitrate encoding for music.
  73. By default, music is detected automatically and the classification
  74. may vary over time.
  75. .IP
  76. Tuning impacts lower bitrates that involve tradeoffs between speech
  77. clarity and musical accuracy, and has no impact at bitrates typically
  78. used for high quality music encoding.
  79. .TP
  80. .B --speech
  81. Override automatic detection and tune low bitrate encoding for speech.
  82. By default, speech is detected automatically and the classification
  83. may vary over time.
  84. .IP
  85. Tuning impacts lower bitrates that involve tradeoffs between speech
  86. clarity and musical accuracy, and has no impact at bitrates typically
  87. used for high quality music encoding.
  88. .TP
  89. .BI --comp " N"
  90. Set encoding computational complexity (0\(en10, default: 10).
  91. Zero gives the fastest encodes but lower quality, while 10 gives the
  92. highest quality but slower encoding.
  93. .TP
  94. .BI --framesize " N"
  95. Set maximum frame size in milliseconds (2.5, 5, 10, 20, 40, 60, default: 20).
  96. Smaller framesizes achieve lower latency but less quality at a given bitrate.
  97. Sizes greater than 20\ ms are only interesting at fairly low bitrates.
  98. .TP
  99. .BI --expect-loss " N"
  100. Set expected packet loss in percent (default: 0).
  101. .TP
  102. .B --downmix-mono
  103. Downmix to mono.
  104. .TP
  105. .B --downmix-stereo
  106. Downmix multichannel speaker configurations to stereo.
  107. .TP
  108. .B --no-phase-inv
  109. Disable use of phase inversion for intensity stereo.
  110. This trades some stereo quality for a higher quality mono downmix,
  111. and is useful when encoding stereo audio that is likely to be downmixed
  112. to mono after decoding.
  113. .TP
  114. .BI --max-delay " N"
  115. Set maximum container delay in milliseconds (0\(en1000, default: 1000).
  116. .SS "Metadata options"
  117. .TP
  118. .BI --title " TITLE"
  119. Set the track title comment field to
  120. .IR TITLE .
  121. .TP
  122. .BI --artist " ARTIST"
  123. Set the artist comment field to
  124. .IR ARTIST .
  125. This may be used multiple times to list contributing artists individually.
  126. Note that some playback software does not display multiple artists gracefully.
  127. .TP
  128. .BI --album " ALBUM"
  129. Set the album or collection title field to
  130. .IR ALBUM .
  131. .TP
  132. .BI --genre " GENRE"
  133. Set the genre comment field to
  134. .IR GENRE .
  135. This option may be used multiple times to tag a track with
  136. multiple overlapping genres.
  137. .TP
  138. .BI --date " YYYY-MM-DD"
  139. Set the date comment field to
  140. .IR YYYY-MM-DD .
  141. This may be shortened to
  142. .I YYYY-MM
  143. or
  144. .IR YYYY .
  145. .TP
  146. .BI --tracknumber " N"
  147. Set the track number comment field to
  148. .IR N .
  149. .TP
  150. .BI --comment " TAG" = VALUE
  151. Add an extra comment.
  152. This may be used multiple times.
  153. The argument should be in the form
  154. .IR TAG = VALUE .
  155. See the vorbis-comment specification
  156. <https://\:www.\:xiph.\:org/\:vorbis/\:doc/v-\:comment.\:html>
  157. for well known tag names.
  158. .TP
  159. \fB--picture\fR \fIFILENAME\fR | \fISPECIFICATION\fR
  160. Attach album art for the track.
  161. JPEG and PNG image formats are accepted.
  162. Either a
  163. .I FILENAME
  164. for the artwork or a more complete
  165. .I SPECIFICATION
  166. form can be used.
  167. The picture is added to a
  168. .B METADATA_BLOCK_PICTURE
  169. comment field similar to what is used in FLAC.
  170. .IP
  171. The
  172. .I SPECIFICATION
  173. is a string whose parts are separated by
  174. .B |
  175. (pipe) characters.
  176. Except for the filename all parts are optional.
  177. A plain
  178. .I FILENAME
  179. is equivalent to a
  180. .BI |||| FILENAME
  181. specification.
  182. .IP
  183. The format of
  184. .I SPECIFICATION
  185. is:
  186. \%[\,\fITYPE\/\fR]\|\fB|\fR\|[\,\fIMEDIATYPE\/\fR]\|\fB|\fR\|[\,\fIDESCRIPTION\/\fR]\|\fB|\fR\|[\,\fIDIMENSIONS\/\fR]\|\fB|\|\fIFILENAME\fR
  187. .IP
  188. .PD 0
  189. .I TYPE
  190. is a number denoting the nature of the picture (default 3):
  191. .RS
  192. .RS 4
  193. .TP
  194. .B 0
  195. Other
  196. .TP
  197. .B 1
  198. 32x32 pixel 'file icon' (PNG only)
  199. .TP
  200. .B 2
  201. Other file icon
  202. .TP
  203. .B 3
  204. Cover (front)
  205. .TP
  206. .B 4
  207. Cover (back)
  208. .TP
  209. .B 5
  210. Leaflet page
  211. .TP
  212. .B 6
  213. Media (e.g., label side of a CD)
  214. .TP
  215. .B 7
  216. Lead artist/lead performer/soloist
  217. .TP
  218. .B 8
  219. Artist/performer
  220. .TP
  221. .B 9
  222. Conductor
  223. .TP
  224. .B 10
  225. Band/Orchestra
  226. .TP
  227. .B 11
  228. Composer
  229. .TP
  230. .B 12
  231. Lyricist/text writer
  232. .TP
  233. .B 13
  234. Recording location
  235. .TP
  236. .B 14
  237. During recording
  238. .TP
  239. .B 15
  240. During performance
  241. .TP
  242. .B 16
  243. Movie/video screen capture
  244. .TP
  245. .B 17
  246. A bright colored fish
  247. .TP
  248. .B 18
  249. Illustration
  250. .TP
  251. .B 19
  252. Band/artist logotype
  253. .TP
  254. .B 20
  255. Publisher/studio logotype
  256. .RE
  257. .RE
  258. .IP
  259. There may only be one picture each of type 1 and 2 in a file.
  260. .PD
  261. .IP
  262. The default
  263. .I DESCRIPTION
  264. is an empty string.
  265. .I FILENAME
  266. is the path to the picture file to be imported.
  267. .I MEDIATYPE
  268. and
  269. .I DIMENSIONS
  270. are obtained from the file and any specified values are ignored.
  271. .IP
  272. More than one
  273. .B --picture
  274. option can be specified to attach multiple pictures.
  275. .TP
  276. .BI --padding " N"
  277. Reserve
  278. .I N
  279. extra bytes for metadata tags.
  280. This can make later tag editing more efficient.
  281. Defaults to 512.
  282. .TP
  283. .B --discard-comments
  284. Don't propagate metadata tags from the input file.
  285. .TP
  286. .B --discard-pictures
  287. Don't propagate pictures or art from the input file.
  288. .SS "Input options"
  289. .TP
  290. .B --raw
  291. Interpret input as raw PCM data without headers.
  292. .TP
  293. .BI --raw-bits " N"
  294. Set bits/sample for raw input (default: 16).
  295. .TP
  296. .BI --raw-rate " N"
  297. Set sampling rate for raw input (default: 48000).
  298. .TP
  299. .BI --raw-chan " N"
  300. Set number of channels for raw input (default: 2).
  301. .TP
  302. .BR --raw-endianness " " 0 | 1
  303. Set the endianness for raw input: 1 for big endian, 0 for little (default: 0).
  304. .TP
  305. .B --ignorelength
  306. Ignore the data length in Wave headers.
  307. The length will always be ignored when it is implausible (very small or very
  308. large), but some stdin usage may still need this option to avoid truncation.
  309. .SS "Diagnostic options"
  310. .TP
  311. .BI --serial " N"
  312. Force use of a specific stream serial number, rather than one that is
  313. randomly generated.
  314. This is used to make the encoder deterministic for testing and is not
  315. generally recommended.
  316. .TP
  317. .BI --save-range " FILENAME"
  318. Save check values for every frame to a file.
  319. .TP
  320. \fB--set-ctl-int\fR [\,\fIS\/\fB:\fR]\,\fIX\/\fR=\,\fIY\fR
  321. Pass the encoder control
  322. .I X
  323. with value
  324. .I Y
  325. (advanced).
  326. Preface with
  327. .IR S :
  328. to direct the ctl to multistream stream number
  329. .IR S .
  330. This may be used multiple times.
  331. .SH EXAMPLES
  332. Simplest usage.
  333. Take input as input.wav and produce output as output.opus:
  334. .RS 5
  335. opusenc input.wav output.opus
  336. .RE
  337. .PP
  338. Produce a very high quality encode with a target rate of 160 kbit/s:
  339. .RS 5
  340. opusenc --bitrate 160 input.wav output.opus
  341. .RE
  342. .PP
  343. Record and send a live stream to an Icecast HTTP streaming server using oggfwd:
  344. .RS 5
  345. arecord -c 2 -r 48000 -twav - | opusenc --bitrate 96 - - | oggfwd icecast.somewhere.org 8000 password /stream.opus
  346. .RE
  347. .SH NOTES
  348. While it is possible to use opusenc for low latency streaming (e.g. with
  349. .B "--max-delay 0"
  350. and netcat instead of Icecast) it's not really designed for this, and the
  351. Ogg container and TCP transport aren't the best tools for that application.
  352. Shell pipelines themselves will often have high buffering.
  353. The ability to set framesizes as low as 2.5\ ms in opusenc mostly exists
  354. to try out the quality of the format with low latency settings, but not
  355. really for actual low latency usage.
  356. Interactive usage should use UDP/RTP directly.
  357. .SH AUTHORS
  358. Gregory Maxwell <greg@xiph.org>
  359. .SH SEE ALSO
  360. .BR opusdec (1),
  361. .BR opusinfo (1),
  362. .BR oggfwd (1)