README.adoc 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. = audiowmark - Audio Watermarking
  2. == Description
  3. `audiowmark` is an Open Source (GPL) solution for audio watermarking.
  4. A sound file is read by the software, and a 128-bit message is stored in a
  5. watermark in the output sound file. For human listeners, the files typically
  6. sound the same.
  7. However, the 128-bit message can be retrieved from the output sound file. Our
  8. tests show, that even if the file is converted to mp3 or ogg (with bitrate 128
  9. kbit/s or higher), the watermark usually can be retrieved without problems. The
  10. process of retrieving the message does not need the original audio file (blind
  11. decoding).
  12. Internally, audiowmark is using the patchwork algorithm to hide the data in the
  13. spectrum of the audio file. The signal is split into 1024 sample frames. For
  14. each frame, some pseoudo-randomly selected amplitudes of the frequency bands of
  15. a 1024-value FFTs are increased or decreased slightly, which can be detected
  16. later. The algorithm used here is inspired by
  17. Martin Steinebach: Digitale Wasserzeichen für Audiodaten.
  18. Darmstadt University of Technology 2004, ISBN 3-8322-2507-2
  19. == Open Source License
  20. `audiowmark` is *open source* software available under the *GPLv3
  21. or later* license.
  22. Copyright (C) 2018-2020 Stefan Westerfeld
  23. This program is free software: you can redistribute it and/or modify
  24. it under the terms of the GNU General Public License as published by
  25. the Free Software Foundation, either version 3 of the License, or
  26. (at your option) any later version.
  27. This program is distributed in the hope that it will be useful,
  28. but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  30. GNU General Public License for more details.
  31. You should have received a copy of the GNU General Public License
  32. along with this program. If not, see <http://www.gnu.org/licenses/>.
  33. == Adding a Watermark
  34. To add a watermark to the soundfile in.wav with a 128-bit message (which is
  35. specified as hex-string):
  36. [subs=+quotes]
  37. ....
  38. *$ audiowmark add in.wav out.wav 0123456789abcdef0011223344556677*
  39. Input: in.wav
  40. Output: out.wav
  41. Message: 0123456789abcdef0011223344556677
  42. Strength: 10
  43. Time: 3:59
  44. Sample Rate: 48000
  45. Channels: 2
  46. Data Blocks: 4
  47. ....
  48. If you want to use `audiowmark` in any serious application, please read the
  49. section <<rec-payload>> on how to generate the 128-bit message. Typically these
  50. bits should be a *hash* or *HMAC* of some sort.
  51. The most important options for adding a watermark are:
  52. --key <filename>::
  53. Use watermarking key from file <filename> (see <<key>>).
  54. --strength <s>::
  55. Set the watermarking strength (see <<strength>>).
  56. == Retrieving a Watermark
  57. To get the 128-bit message from the watermarked file, use:
  58. [subs=+quotes]
  59. ....
  60. *$ audiowmark get out.wav*
  61. pattern 0:05 0123456789abcdef0011223344556677 1.324 0.059 A
  62. pattern 0:57 0123456789abcdef0011223344556677 1.413 0.112 B
  63. pattern 0:57 0123456789abcdef0011223344556677 1.368 0.086 AB
  64. pattern 1:49 0123456789abcdef0011223344556677 1.302 0.098 A
  65. pattern 2:40 0123456789abcdef0011223344556677 1.361 0.093 B
  66. pattern 2:40 0123456789abcdef0011223344556677 1.331 0.096 AB
  67. pattern all 0123456789abcdef0011223344556677 1.350 0.054
  68. ....
  69. The output of `audiowmark get` is designed to be machine readable. Each line
  70. that starts with `pattern` contains one decoded message. The fields are
  71. seperated by one or more space characters. The first field is a *timestamp*
  72. indicating the position of the data block. The second field is the *decoded
  73. message*. For most purposes this is all you need to know.
  74. The software was designed under the assumption that the message is a *hash* or
  75. *HMAC* of some sort. Before you start using `audiowmark` in any serious
  76. application, please read the section <<rec-payload>>. You - the user - should
  77. be able to decide whether a message is correct or not. To do this, on
  78. watermarking song files, you could *create a database entry* for each message
  79. you embedded in a watermark. During retrieval, you should perform a *database
  80. lookup* for each pattern `audiowmark get` outputs. If the message is not found,
  81. then you should assume that a decoding error occurred. In our example each
  82. pattern was decoded correctly, because the watermark was not damaged at all,
  83. but if you for instance use lossy compression (with a low bitrate), it may
  84. happen that only some of the decoded patterns are correct. Or none, if the
  85. watermark was damaged too much.
  86. The third field is the *sync score* (higher is better). The synchronization
  87. algorithm tries to find valid data blocks in the audio file, that become
  88. candidates for decoding.
  89. The fourth field is the *decoding error* (lower is better). During message
  90. decoding, we use convolutional codes for error correction, to make the
  91. watermarking more robust.
  92. The fifth field is the *block type*. There are two types of data blocks,
  93. A blocks and B blocks. A single data block can be decoded alone, as it
  94. contains a complete message. However, if during watermark detection an
  95. A block followed by a B block was found, these two can be decoded
  96. together (then this field will be AB), resulting in even higher error
  97. correction capacity than one block alone would have.
  98. To improve the error correction capacity even further, the `all` pattern
  99. combines all data blocks that are available. The combined decoded
  100. message will often be the most reliable result (meaning that even if all
  101. other patterns were incorrect, this could still be right).
  102. The most important options for getting a watermark are:
  103. --key <filename>::
  104. Use watermarking key from file <filename> (see <<key>>).
  105. --strength <s>::
  106. Set the watermarking strength (see <<strength>>).
  107. --detect-speed::
  108. --detect-speed-patient::
  109. Detect and correct replay speed difference (see <<speed>>).
  110. --json <file>::
  111. Write results to <file> in machine readable JSON format.
  112. [[key]]
  113. == Watermark Key
  114. Since the software is Open Source, a watermarking key should be used to ensure
  115. that the message bits cannot be retrieved by somebody else (which would also
  116. allow removing the watermark without loss of quality). The watermark key
  117. controls all pseudo-random parameters of the algorithm. This means that
  118. it determines which frequency bands are increased or decreased to store a
  119. 0 bit or a 1 bit. Without the key, it is impossible to decode the message
  120. bits from the audio file alone.
  121. Our watermarking key is a 128-bit AES key. A key can be generated using
  122. audiowmark gen-key test.key
  123. and can be used for the add/get commands as follows:
  124. audiowmark add --key test.key in.wav out.wav 0123456789abcdef0011223344556677
  125. audiowmark get --key test.key out.wav
  126. [[strength]]
  127. == Watermark Strength
  128. The watermark strength parameter affects how much the watermarking algorithm
  129. modifies the input signal. A stronger watermark is more audible, but also more
  130. robust against modifications. The default strength is 10. A watermark with that
  131. strength is recoverable after mp3/ogg encoding with 128kbit/s or higher. In our
  132. informal listening tests, this setting also has a very good subjective quality.
  133. A higher strength (for instance 15) would be helpful for instance if robustness
  134. against multiple conversions or conversions to low bit rates (i.e. 64kbit/s) is
  135. desired.
  136. A lower strength (for instance 6) makes the watermark less audible, but also
  137. less robust. Strengths below 5 are not recommended. To set the strength, the
  138. same value has to be passed during both, generation and retrieving the
  139. watermark. Fractional strengths (like 7.5) are possible.
  140. audiowmark add --strength 15 in.wav out.wav 0123456789abcdef0011223344556677
  141. audiowmark get --strength 15 out.wav
  142. [[rec-payload]]
  143. == Recommendations for the Watermarking Payload
  144. Although `audiowmark` does not specify what the 128-bit message stored in the
  145. watermark should be, it was designed under the assumption that the message
  146. should be a *hash* or *HMAC* of some sort.
  147. Lets look at a typical use case. We have a song called *Dreams* by an artist
  148. called *Alice*. A user called *John Smith* downloads a watermarked copy.
  149. Later, we find this file somewhere on the internet. Typically we want to answer
  150. the questions:
  151. * is this one of the files we previously watermarked?
  152. * what song/artist is this?
  153. * which user shared it?
  154. _When the user downloads a watermarked copy_, we construct a string that
  155. contains all information we need to answer our questions, for example
  156. like this:
  157. Artist:Alice|Title:Dreams|User:John Smith
  158. To obtain the 128-bit message, we can hash this string, for instance by
  159. using the first 128 bits of a SHA-256 hash like this:
  160. $ STRING='Artist:Alice|Title:Dreams|User:John Smith'
  161. $ MSG=`echo -n "$STRING" | sha256sum | head -c 32`
  162. $ echo $MSG
  163. ecd057f0d1fbb25d6430b338b5d72eb2
  164. This 128-bit message can be used as watermark:
  165. $ audiowmark add --key my.key song.wav song.wm.wav $MSG
  166. At this point, we should also *create a database entry* consisting of the
  167. hash value `$MSG` and the corresponding string `$STRING`.
  168. The shell commands for creating the hash are listed here to provide a
  169. simplified example. Fields (like the song title) can contain the characters `'`
  170. and `|`, so these cases need to be dealt with.
  171. _If we find a watermarked copy of the song on the net_, the first step is to
  172. detect the watermark message using
  173. $ audiowmark get --key my.key song.wm.wav
  174. pattern 0:05 ecd057f0d1fbb25d6430b338b5d72eb2 1.377 0.068 A
  175. pattern 0:57 ecd057f0d1fbb25d6430b338b5d72eb2 1.392 0.109 B
  176. [...]
  177. The second step is to perform a *database lookup* for each result returned by
  178. `audiowmark`. If we find a matching entry in our database, this is one of the
  179. files we previously watermarked.
  180. As a last step, we can use the string stored in the database, which contains
  181. the song/artist and the user that shared it.
  182. _The advantages of using a hash as message are:_
  183. 1. Although `audiowmark` sometimes produces *false positives*, this doesn't
  184. matter, because it is extremely unlikely that a false positive will match an
  185. existing database entry.
  186. 2. Even if a few *bit errors* occur, it is extremely unlikely that a song
  187. watermarked for user A will be attributed to user B, simply because all hash
  188. bits depend on the user. So this is a much better payload than storing a user
  189. ID, artist ID and song ID in the message bits directly.
  190. 3. It is *easy to extend*, because we can add any fields we need to the hash
  191. string. For instance, if we want to store the name of the album, we can simply
  192. add it to the string.
  193. 4. If the hash matches exactly, it is really *hard to deny* that it was this
  194. user who shared the song. How else could all 128 bits of the hash match the
  195. message bits decoded by `audiowmark`?
  196. [[speed]]
  197. == Speed Detection
  198. If a watermarked audio signal is played back a little faster or slower than the
  199. original speed, watermark detection will fail. This could happen by accident if
  200. the digital watermark was converted to an analog signal and back and the
  201. original speed was not (exactly) preserved. It could also be done intentionally
  202. as an attack to avoid the watermark from being detected.
  203. In order to be able to find the watermark in these cases, `audiowmark` can try
  204. to figure out the speed difference to the original audio signal and correct the
  205. replay speed before detecting the watermark. The search range for the replay
  206. speed is approximately *[0.8..1.25]*.
  207. Example: add a watermark to `in.wav` and increase the replay speed by 5% using
  208. `sox`.
  209. [subs=+quotes]
  210. ....
  211. *$ audiowmark add in.wav out.wav 0123456789abcdef0011223344556677*
  212. [...]
  213. *$ sox out.wav out1.wav speed 1.05*
  214. ....
  215. Without speed detection, we get no results. With speed detection the speed
  216. difference is detected and corrected so we get results.
  217. [subs=+quotes]
  218. ....
  219. *$ audiowmark get out1.wav*
  220. *$ audiowmark get out1.wav --detect-speed*
  221. speed 1.049966
  222. pattern 0:05 0123456789abcdef0011223344556677 1.209 0.147 A-SPEED
  223. pattern 0:57 0123456789abcdef0011223344556677 1.301 0.143 B-SPEED
  224. pattern 0:57 0123456789abcdef0011223344556677 1.255 0.145 AB-SPEED
  225. pattern 1:49 0123456789abcdef0011223344556677 1.380 0.173 A-SPEED
  226. pattern all 0123456789abcdef0011223344556677 1.297 0.130 SPEED
  227. ....
  228. The speed detection algorithm is not enabled by default because it is
  229. relatively slow (total cpu time required) and needs a lot of memory. However
  230. the search is automatically run in parallel using many threads on systems with
  231. many cpu cores. So on good hardware it makes sense to always enable this option
  232. to be robust to replay speed attacks.
  233. There are two versions of the speed detection algorithm, `--detect-speed` and
  234. `--detect-speed-patient`. The difference is that the patient version takes
  235. more cpu time to detect the speed, but produces more accurate results.
  236. == Short Payload (experimental)
  237. By default, the watermark will store a 128-bit message. In this mode, we
  238. recommend using a 128bit hash (or HMAC) as payload. No error checking is
  239. performed, the user needs to test patterns that the watermarker decodes to
  240. ensure that they really are one of the expected patterns, not a decoding
  241. error.
  242. As an alternative, an experimental short payload option is available, for very
  243. short payloads (12, 16 or 20 bits). It is enabled using the `--short <bits>`
  244. command line option, for instance for 16 bits:
  245. audiowmark add --short 16 in.wav out.wav abcd
  246. audiowmark get --short 16 out.wav
  247. Internally, a larger set of bits is sent to ensure that decoded short patterns
  248. are really valid, so in this mode, error checking is performed after decoding,
  249. and only valid patterns are reported.
  250. Besides error checking, the advantage of a short payload is that fewer bits
  251. need to be sent, so decoding will more likely to be successful on shorter
  252. clips.
  253. == Video Files
  254. For video files, `videowmark` can be used to add a watermark to the audio track
  255. of video files. To add a watermark, use
  256. [subs=+quotes]
  257. ....
  258. *$ videowmark add in.avi out.avi 0123456789abcdef0011223344556677*
  259. Audio Codec: -c:a mp3 -ab 128000
  260. Input: in.avi
  261. Output: out.avi
  262. Message: 0123456789abcdef0011223344556677
  263. Strength: 10
  264. Time: 3:53
  265. Sample Rate: 44100
  266. Channels: 2
  267. Data Blocks: 4
  268. ....
  269. To detect a watermark, use
  270. [subs=+quotes]
  271. ....
  272. *$ videowmark get out.avi*
  273. pattern 0:05 0123456789abcdef0011223344556677 1.294 0.142 A
  274. pattern 0:57 0123456789abcdef0011223344556677 1.191 0.144 B
  275. pattern 0:57 0123456789abcdef0011223344556677 1.242 0.145 AB
  276. pattern 1:49 0123456789abcdef0011223344556677 1.215 0.120 A
  277. pattern 2:40 0123456789abcdef0011223344556677 1.079 0.128 B
  278. pattern 2:40 0123456789abcdef0011223344556677 1.147 0.126 AB
  279. pattern all 0123456789abcdef0011223344556677 1.195 0.104
  280. ....
  281. The key and strength can be set using the command line options
  282. --key <filename>::
  283. Use watermarking key from file <filename> (see <<key>>).
  284. --strength <s>::
  285. Set the watermarking strength (see <<strength>>).
  286. Videos can be watermarked on-the-fly using <<hls>>.
  287. == Output as Stream
  288. Usually, an input file is read, watermarked and an output file is written.
  289. This means that it takes some time before the watermarked file can be used.
  290. An alternative is to output the watermarked file as stream to stdout. One use
  291. case is sending the watermarked file to a user via network while the
  292. watermarker is still working on the rest of the file. Here is an example how to
  293. watermark a wav file to stdout:
  294. audiowmark add in.wav - 0123456789abcdef0011223344556677 | play -
  295. In this case the file in.wav is read, watermarked, and the output is sent
  296. to stdout. The "play -" can start playing the watermarked stream while the
  297. rest of the file is being watermarked.
  298. If - is used as output, the output is a valid .wav file, so the programs
  299. running after `audiowmark` will be able to determine sample rate, number of
  300. channels, bit depth, encoding and so on from the wav header.
  301. Note that all input formats supported by audiowmark can be used in this way,
  302. for instance flac/mp3:
  303. audiowmark add in.flac - 0123456789abcdef0011223344556677 | play -
  304. audiowmark add in.mp3 - 0123456789abcdef0011223344556677 | play -
  305. == Input from Stream
  306. Similar to the output, the `audiowmark` input can be a stream. In this case,
  307. the input must be a valid .wav file. The watermarker will be able to
  308. start watermarking the input stream before all data is available. An
  309. example would be:
  310. cat in.wav | audiowmark add - out.wav 0123456789abcdef0011223344556677
  311. It is possible to do both, input from stream and output as stream.
  312. cat in.wav | audiowmark add - - 0123456789abcdef0011223344556677 | play -
  313. Streaming input is also supported for watermark detection.
  314. cat in.wav | audiowmark get -
  315. == Raw Streams
  316. So far, all streams described here are essentially wav streams, which means
  317. that the wav header allows `audiowmark` to determine sample rate, number of
  318. channels, bit depth, encoding and so forth from the stream itself, and the a
  319. wav header is written for the program after `audiowmark`, so that this can
  320. figure out the parameters of the stream.
  321. There are two cases where this is problematic. The first case is if the full
  322. length of the stream is not known at the time processing starts. Then a wav
  323. header cannot be used, as the wav file contains the length of the stream. The
  324. second case is that the program before or after `audiowmark` doesn't support wav
  325. headers.
  326. For these two cases, raw streams are available. The idea is to set all
  327. information that is needed like sample rate, number of channels,... manually.
  328. Then, headerless data can be processed from stdin and/or sent to stdout.
  329. --input-format raw::
  330. --output-format raw::
  331. --format raw::
  332. These can be used to set the input format or output format to raw. The
  333. last version sets both, input and output format to raw.
  334. --raw-rate <rate>::
  335. This should be used to set the sample rate. The input sample rate and
  336. the output sample rate will always be the same (no resampling is
  337. done by the watermarker). There is no default for the sampling rate,
  338. so this parameter must always be specified for raw streams.
  339. --raw-input-bits <bits>::
  340. --raw-output-bits <bits>::
  341. --raw-bits <bits>::
  342. The options can be used to set the input number of bits, the output number
  343. of bits or both. The number of bits can either be `16` or `24`. The default
  344. number of bits is `16`.
  345. --raw-input-endian <endian>::
  346. --raw-output-endian <endian>::
  347. --raw-endian <endian>::
  348. These options can be used to set the input/output endianness or both.
  349. The <endian> parameter can either be `little` or `big`. The default
  350. endianness is `little`.
  351. --raw-input-encoding <encoding>::
  352. --raw-output-encoding <encoding>::
  353. --raw-encoding <encoding>::
  354. These options can be used to set the input/output encoding or both.
  355. The <encoding> parameter can either be `signed` or `unsigned`. The
  356. default encoding is `signed`.
  357. --raw-channels <channels>::
  358. This can be used to set the number of channels. Note that the number
  359. of input channels and the number of output channels must always be the
  360. same. The watermarker has been designed and tested for stereo files,
  361. so the number of channels should really be `2`. This is also the
  362. default.
  363. [[hls]]
  364. == HTTP Live Streaming
  365. === Introduction for HLS
  366. HTTP Live Streaming (HLS) is a protocol to deliver audio or video streams via
  367. HTTP. One example for using HLS in practice would be: a user watches a video
  368. in a web browser with a player like `hls.js`. The user is free to
  369. play/pause/seek the video as he wants. `audiowmark` can watermark the audio
  370. content while it is being transmitted to the user.
  371. HLS splits the contents of each stream into small segments. For the watermarker
  372. this means that if the user seeks to a position far ahead in the stream, the
  373. server needs to start sending segments from where the new play position is, but
  374. everything in between can be ignored.
  375. Another important property of HLS is that it allows separate segments for the
  376. video and audio stream of a video. Since we watermark only the audio track of a
  377. video, the video segments can be sent as they are (and different users can get
  378. the same video segments). What is watermarked are the audio segments only, so
  379. here instead of sending the original audio segments to the user, the audio
  380. segments are watermarked individually for each user, and then transmitted.
  381. Everything necessary to watermark HLS audio segments is available within
  382. `audiowmark`. The server side support which is necessary to send the right
  383. watermarked segment to the right user is not included.
  384. [[hls-requirements]]
  385. === HLS Requirements
  386. HLS support requires some headers/libraries from ffmpeg:
  387. * libavcodec
  388. * libavformat
  389. * libavutil
  390. * libswresample
  391. To enable these as dependencies and build `audiowmark` with HLS support, use the
  392. `--with-ffmpeg` configure option:
  393. [subs=+quotes]
  394. ....
  395. *$ ./configure --with-ffmpeg*
  396. ....
  397. In addition to the libraries, `audiowmark` also uses the two command line
  398. programs from ffmpeg, so they need to be installed:
  399. * ffmpeg
  400. * ffprobe
  401. === Preparing HLS segments
  402. The first step for preparing content for streaming with HLS would be splitting
  403. a video into segments. For this documentation, we use a very simple example
  404. using ffmpeg. No matter what the original codec was, at this point we force
  405. transcoding to AAC with our target bit rate, because during delivery the stream
  406. will be in AAC format.
  407. [subs=+quotes]
  408. ....
  409. *$ ffmpeg -i video.mp4 -f hls -master_pl_name replay.m3u8 -c:a aac -ab 192k \
  410. -var_stream_map "a:0,agroup:aud v:0,agroup:aud" \
  411. -hls_playlist_type vod -hls_list_size 0 -hls_time 10 vs%v/out.m3u8*
  412. ....
  413. This splits the `video.mp4` file into an audio stream of segments in the `vs0`
  414. directory and a video stream of segments in the `vs1` directory. Each segment
  415. is approximately 10 seconds long, and a master playlist is written to
  416. `replay.m3u8`.
  417. Now we can add the relevant audio context to each audio ts segment. This is
  418. necessary so that when the segment is watermarked in order to be transmitted to
  419. the user, `audiowmark` will have enough context available before and after the
  420. segment to create a watermark which sounds correct over segment boundaries.
  421. [subs=+quotes]
  422. ....
  423. *$ audiowmark hls-prepare vs0 vs0prep out.m3u8 video.mp4*
  424. AAC Bitrate: 195641 (detected)
  425. Segments: 18
  426. Time: 2:53
  427. ....
  428. This steps reads the audio playlist `vs0/out.m3u8` and writes all segments
  429. contained in this audio playlist to a new directory `vs0prep` which
  430. contains the audio segments prepared for watermarking.
  431. The last argument in this command line is `video.mp4` again. All audio
  432. that is watermarked is taken from this audio master. It could also be
  433. supplied in `wav` format. This makes a difference if you use lossy
  434. compression as target format (for instance AAC), but your original
  435. video has an audio stream with higher quality (i.e. lossless).
  436. === Watermarking HLS segments
  437. So with all preparations made, what would the server have to do to send a
  438. watermarked version of the 6th audio segment `vs0prep/out5.ts`?
  439. [subs=+quotes]
  440. ....
  441. *$ audiowmark hls-add vs0prep/out5.ts send5.ts 0123456789abcdef0011223344556677*
  442. Message: 0123456789abcdef0011223344556677
  443. Strength: 10
  444. Time: 0:15
  445. Sample Rate: 44100
  446. Channels: 2
  447. Data Blocks: 0
  448. AAC Bitrate: 195641
  449. ....
  450. So instead of sending out5.ts (which has no watermark) to the user, we would
  451. send send5.ts, which is watermarked.
  452. In a real-world use case, it is likely that the server would supply the input
  453. segment on stdin and send the output segment as written to stdout, like this
  454. [subs=+quotes]
  455. ....
  456. *$ [...] | audiowmark hls-add - - 0123456789abcdef0011223344556677 | [...]*
  457. [...]
  458. ....
  459. The usual parameters are supported in `audiowmark hls-add`, like
  460. --key <filename>::
  461. Use watermarking key from file <filename> (see <<key>>).
  462. --strength <s>::
  463. Set the watermarking strength (see <<strength>>).
  464. The AAC bitrate for the output segment can be set using:
  465. --bit-rate <bit_rate>::
  466. Set the AAC bit-rate for the generated watermarked segment.
  467. The rules for the AAC bit-rate of the newly encoded watermarked segment are:
  468. * if the --bit-rate option is used during `hls-add`, this bit-rate will be used
  469. * otherwise, if the `--bit-rate` option is used during `hls-prepare`, this bit-rate will be used
  470. * otherwise, the bit-rate of the input material is detected during `hls-prepare`
  471. == Compiling from Source
  472. Stable releases are available from http://uplex.de/audiowmark
  473. The steps to compile the source code are:
  474. ./configure
  475. make
  476. make install
  477. If you build from git (which doesn't include `configure`), the first
  478. step is `./autogen.sh`. In this case, you need to ensure that (besides
  479. the dependencies listed below) the `autoconf-archive` package is
  480. installed.
  481. == Dependencies
  482. If you compile from source, `audiowmark` needs the following libraries:
  483. * libfftw3
  484. * libsndfile
  485. * libgcrypt
  486. * libzita-resampler
  487. * libmpg123
  488. If you want to build with HTTP Live Streaming support, see also
  489. <<hls-requirements>>.
  490. == Building fftw
  491. `audiowmark` needs the single prevision variant of fftw3.
  492. If you are building fftw3 from source, use the `--enable-float`
  493. configure parameter to build it, e.g.::
  494. cd ${FFTW3_SOURCE}
  495. ./configure --enable-float --enable-sse && \
  496. make && \
  497. sudo make install
  498. or, when building from git
  499. cd ${FFTW3_GIT}
  500. ./bootstrap.sh --enable-shared --enable-sse --enable-float && \
  501. make && \
  502. sudo make install
  503. == Docker Build
  504. You should be able to execute `audiowmark` via Docker.
  505. Example that outputs the usage message:
  506. docker build -t audiowmark .
  507. docker run -v <local-data-directory>:/data --rm -i audiowmark -h