Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add watermark twice #28

Closed
junlicn opened this issue Jan 15, 2023 · 3 comments
Closed

add watermark twice #28

junlicn opened this issue Jan 15, 2023 · 3 comments

Comments

@junlicn
Copy link

junlicn commented Jan 15, 2023

is it possible to support adding watermark twice, that means I could get two different watermarking from the same wav?
for example, I add watermarking for user copyright information first, then after transfered the audio file to client, add watermarking of user who download or play it.

@swesterfeld
Copy link
Owner

Yes, as long as you use two different keys, it should be possible to add two different watermarks. However of course if you can avoid it, it is better to use just one watermark which is better for the quality.

@junlicn
Copy link
Author

junlicn commented Jan 16, 2023

what's the theory and process of two different watermark by only two keys?
and another question, only consider technical engineer factors, is it possible to implement two watermakr by adding first watermark at first 50 second block, and adding second watermark at second 50 seconds block, and repeat this operation in the remaining blocks ?

@swesterfeld
Copy link
Owner

First of all, if you haven't read the README section on recommendations for the payload, you can do so here:

https://github.com/swesterfeld/audiowmark#recommendations-for-the-watermarking-payload

We kind-of assume that 128-bit messages ought to be enough for everyone.

what's the theory and process of two different watermark by only two keys?

As a user create two keys using audiowmark gen-key and use audiowmark add --key to twice to add the watermark. Use audiowmark get --key to get the message.

To see why using two different keys works you could look at the decoder code for single raw bits from the watermark.

The simplest possible decoder is here:

linear_decode (vector<vector<complex<float>>>& fft_out, int n_channels)

This computes umag and dmag as sum of pseudo randomly selected amplitude bins from the FFT spectrum of each frame. Simplified if (umag > dmag) we decode an 1 bit, otherwise 0. Which amplitude bins are used is depends on the key. So if you use different keys for watermarking you can embed / decode different message bits in the same spectrum.

Btw I didn't do excessive testing for using two keys, it appears to work but it may be a little less robust than using just one key.

and another question, only consider technical engineer factors, is it possible to implement two watermakr by adding first watermark at first 50 second block, and adding second watermark at second 50 seconds block, and repeat this operation in the remaining blocks ?

Yes you could do that. However there are cases in audiowmark where we currently assume that the A and B blocks carry the same data bits (but use different error correction coding). The most important feature is probably clip decoding. If you just have any randomly choosen small clip, we'll try to decode the message bits from the clip. It doesn't need to contain a full block.

Lets assume that we have a "short" N seconds clip. At any possible location, audiowmark will try to decode the message bits from the clip, including if there is only a partial A and B block.

See also this comment:

So it wouldn't be totally easy to change the code to no longer make the assumption that A and B blocks can be decoded together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants