README.adoc 7.0 KB

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