README.adoc 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. = audiowmark - Audio Watermarking
  2. == Description
  3. `audiowmark` is an Open Source solution for audio watermarking. A sound file
  4. (typically wav) 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. == Adding a Watermark
  20. To add a watermark to the soundfile in.wav with a 128-bit message (which is
  21. specified as hex-string):
  22. [subs=+quotes]
  23. ....
  24. *$ audiowmark add in.wav out.wav 0123456789abcdef0011223344556677*
  25. Input: in.wav
  26. Output: out.wav
  27. Message: 0123456789abcdef0011223344556677
  28. Strength: 10
  29. Time: 3:59
  30. Sample Rate: 48000
  31. Channels: 2
  32. Data Blocks: 4
  33. Volume Norm: 0.987 (-0.12 dB)
  34. ....
  35. The most important options for adding a watermark are:
  36. --key <filename>::
  37. Use watermarking key from file <filename> (see <<key>>).
  38. --strength <s>::
  39. Set the watermarking strength (see <<strength>>).
  40. == Retrieving a Watermark
  41. To get the 128-bit message from the watermarked file, use:
  42. [subs=+quotes]
  43. ....
  44. *$ audiowmark get out.wav*
  45. pattern 0:05 0123456789abcdef0011223344556677 1.324 0.059 A
  46. pattern 0:57 0123456789abcdef0011223344556677 1.413 0.112 B
  47. pattern 0:57 0123456789abcdef0011223344556677 1.368 0.086 AB
  48. pattern 1:49 0123456789abcdef0011223344556677 1.302 0.098 A
  49. pattern 2:40 0123456789abcdef0011223344556677 1.361 0.093 B
  50. pattern 2:40 0123456789abcdef0011223344556677 1.331 0.096 AB
  51. pattern all 0123456789abcdef0011223344556677 1.350 0.054
  52. ....
  53. The output of `audiowmark get` is designed to be machine readable. Each line
  54. that starts with `pattern` contains one decoded message. The fields are
  55. seperated by one or more space characters. The first field is a *timestamp*
  56. indicating the position of the data block. The second field is the *decoded
  57. message*. For most purposes this is all you need to know.
  58. The software was designed under the assumption that you - the user - will be
  59. able to decide whether a message is correct or not. To do this, on watermarking
  60. song files, you could list each message you embedded in a database. During
  61. retrieval, you should look up each pattern `audiowmark get` outputs in the
  62. database. If the message is not found, then you should assume that a decoding
  63. error occurred. In our example each pattern was decoded correctly, because
  64. the watermark was not damaged at all, but if you for instance use lossy
  65. compression (with a low bitrate), it may happen that only some of the decoded
  66. patterns are correct. Or none, if the watermark was damaged too much.
  67. The third field is the *sync score* (higher is better). The synchronization
  68. algorithm tries to find valid data blocks in the audio file, that become
  69. candidates for decoding.
  70. The fourth field is the *decoding error* (lower is better). During message
  71. decoding, we use convolutional codes for error correction, to make the
  72. watermarking more robust.
  73. The fifth field is the *block type*. There are two types of data blocks,
  74. A blocks and B blocks. A single data block can be decoded alone, as it
  75. contains a complete message. However, if during watermark detection an
  76. A block followed by a B block was found, these two can be decoded
  77. together (then this field will be AB), resulting in even higher error
  78. correction capacity than one block alone would have.
  79. To improve the error correction capacity even further, the `all` pattern
  80. combines all data blocks that are available. The combined decoded
  81. message will often be the most reliable result (meaning that even if all
  82. other patterns were incorrect, this could still be right).
  83. The most important options for getting a watermark are:
  84. --key <filename>::
  85. Use watermarking key from file <filename> (see <<key>>).
  86. --strength <s>::
  87. Set the watermarking strength (see <<strength>>).
  88. [[key]]
  89. == Watermark Key
  90. Since the software is Open Source, a watermarking key should be used to ensure
  91. that the message bits cannot be retrieved by somebody else (which would also
  92. allow removing the watermark without loss of quality). The watermark key
  93. controls all pseudo-random parameters of the algorithm. This means that
  94. it determines which frequency bands are increased or decreased to store a
  95. 0 bit or a 1 bit. Without the key, it is impossible to decode the message
  96. bits from the audio file alone.
  97. Our watermarking key is a 128-bit AES key. A key can be generated using
  98. audiowmark gen-key test.key
  99. and can be used for the add/get commands as follows:
  100. audiowmark add --key test.key in.wav out.wav 0123456789abcdef0011223344556677
  101. audiowmark get --key test.key out.wav
  102. [[strength]]
  103. == Watermark Strength
  104. The watermark strength parameter affects how much the watermarking algorithm
  105. modifies the input signal. A stronger watermark is more audible, but also more
  106. robust against modifications. The default strength is 10. A watermark with that
  107. strength is recoverable after mp3/ogg encoding with 128kbit/s or higher. In our
  108. informal listening tests, this setting also has a very good subjective quality.
  109. A higher strength (for instance 15) would be helpful for instance if robustness
  110. against multiple conversions or conversions to low bit rates (i.e. 64kbit/s) is
  111. desired.
  112. A lower strength (for instance 6) makes the watermark less audible, but also
  113. less robust. Strengths below 5 are not recommended. To set the strength, the
  114. same value has to be passed during both, generation and retrieving the
  115. watermark. Fractional strengths (like 7.5) are possible.
  116. audiowmark add --strength 15 in.wav out.wav 0123456789abcdef0011223344556677
  117. audiowmark get --strength 15 out.wav
  118. == Dependencies
  119. If you compile from source, audiowmark needs the following libraries:
  120. * libfftw3
  121. * libsndfile
  122. * libgcrypt
  123. * libzita-resampler
  124. * libmpg123
  125. == Building fftw
  126. audiowmark needs the single prevision variant of fftw3.
  127. If you are building fftw3 from source, use the `--enable-float`
  128. configure parameter to build it, e.g.::
  129. cd ${FFTW3_SOURCE}
  130. ./configure --enable-float --enable-sse && \
  131. make && \
  132. sudo make install
  133. or, when building from git
  134. cd ${FFTW3_GIT}
  135. ./bootstrap.sh --enable-shared --enable-sse --enable-float && \
  136. make && \
  137. sudo make install
  138. == Docker Build
  139. You should be able to execute audiowmark via Docker.
  140. Example that outputs the usage message:
  141. docker build -t audiowmark .
  142. docker run -v <local-data-directory>:/data -it audiowmark -h