[FFmpeg-devel] AVFilter for watermarking DCTELEM MPEG2 blocks

Roger Pau Monné royger
Wed Nov 17 15:20:49 CET 2010


Hello,

Here is the modification, it is done against FFmpeg 0.6.1. The code is
not released yet, but it is under a Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 Unported license for now (but
we can discuss about this if there's interest in adding this code to
the FFmpeg source). I'm not the original creator of this code, I've
adapted and corrected this modification from a previous work. You
should be able to compile it without much problem, but don't use
threads, if so the program will not work. Once compiled the usage is
fairly simple:

To add a watermark:

ffmpeg -i your_mpeg.mpeg -watermark "-x 10000000 -q 10 -a 30 -m
{0,2;0,3;1,1;1,2;2,0;2,1;3,0} -t 0" -b 40000000 -vcodec mpeg2video
out_marked_file.mpeg

List of options:

-x Indicates the mark to apply to the file
-q Indicates number of I frames to skip between marks
-a Indicates the power of the mark
-m Indicates the position of the mark inside the DCT matrix (the ones
supplied are the most common positions)
-t Watermarking algorithm to use (only 0 possible now)

Once you run it, you will see that a new file will be generated,
called Wat_enc_<datetime>.log, this file is needed for the extraction
of the mark, so don't remove it.

To retrieve a mark:

ffmpeg -i original_video.mpeg  -check_watermark "-f
Wat_enc_<datetime>.log -q 10 -t 0 -m {0,2;0,3;1,1;1,2;2,0;2,1;3,0} -x
8" -i marked_video.mpeg -b 4000000 -vcodec mpeg2video dummy1.mpeg
-vcodec mpeg2video dummy2.mpeg

List of option:

-f The file that was created during the marking process (contains the
number of the marked frames)
-q Indicates number of I frames to skip between marks (not really needed)
-t Watermarking algorithm to use (only 0 possible now)
-m Position of the mark
-x Length of the mark

After executing check_wartermark you should see the same sequence of 1
and 0 that you passed to the watermark -x parameter in the previous
step.

The only algorithm that you can try right now is 0, which is a "Cox
Algorithm", it simply adds or subtract a value from the given
positions in the DCT matrices of luminance of I frames. I would like
to convert this to some kind of plugin/filter, so I can use it with
different versions of FFmpeg, instead of modifying the source every
time I want to update to a new version of FFmpeg.

Sorry for the code, it is not really well done as it is more or less
as it got to my hands, but I'm trying to improve it, and I think that
converting it to some kind of external part of FFmpeg would be good.

Sorry again for my bad english, I hope everything is clear enougth.

Thanks, Roger.

License: http://creativecommons.org/licenses/by-nc-sa/3.0/

2010/11/17 Roger Pau Monn? <royger at gmail.com>:
> I'm preparing the code, I will try to send it later today, sorry for the
> delay.
>
> El 16/11/2010 17:01, "Luca Barbato" <lu_zero at gentoo.org> escribi?:
>
> On 11/16/2010 04:40 PM, Vladimir Pantelic wrote:
>> Carl Eugen Hoyos wrote:
>>> Roger Pau Monn?<royger...
>
> Good Watermarking as a subset of steganography should work even if you
> know the algorithm. Since it should be nearly seamless, depending on
> some external key to be meaningful and robust to a number of conversion
> procedures (think about fair use, low qual encoding or small sampling
> deletes the watermark, doing high quality reencoding preserves it)
>
> lu
>
> --
>
> Luca Barbato
> Gentoo/linux
> http://dev.gentoo.org/~lu_zero
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: watermark.patch
Type: application/octet-stream
Size: 27106 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101117/97aaa245/attachment.obj>



More information about the ffmpeg-devel mailing list