This chapter does not appear in the book.
Watermarking aims to embed information, such as copyright details, in a video so it's too difficult to remove without adversely affecting the video's quality. It's a complicated task because there's always a tradeoff between a mark's robustness (its resistance to removal) and the modified video's fidelity (its visual quality). Adding a large copyright banner diagonally across every movie frame is certainly robust, but somewhat impacts the viewing experience.
A successful watermark has to survive many forms of attack, such as image rotation, cropping, resampling, time editing, compression, re-recording, noise addition, and color/contrast changes. One reason for making a watermark invisible (or nearly so) is to force an attacker to carry out drastic, hopefully costly, video-wide editing; when the watermark can't be located, it's hard to carry out a more focused attack . Inserting multiple copies of a watermark makes complete deletion harder as well, but repeating a mark too often may make it easier to detect.
Spatial watermarking modifies the pixels of a video frame, while frequency-domain marks affect the coefficients of a frame's frequency equations (e.g. as obtained with Discrete Fourier Transforms).
In this chapter, I add a hard-to-see (but not invisible) spatial watermark to video, repeated at intervals through the clip. The mark is disguised as a flickering line along the top of the movie frame, imitating the noise/interference that appears on poor video recordings. The mark is implemented as a series of very thin barcodes using the popular Code 128 format . I chose barcodes since they offer the chance of a video mark being read optically as well as digitally.
Another aim of this chapter is to complain (a little) about the inadequacies of Sun's JMF (the Java Media Framework). Instead I employ the Xuggler API to edit and analyze video.
I develop two applications here: AddVideoMsg.java which adds barcodes representing a 'secret' message to a video, and GetVideoMsg.java which retrieves the message. The figure at the top of this page illustrates how AddVideoMsg works, with an enlarged view of a modified frame with a barcode.
The input video is "today.avi", and is modified to become "todayOut.avi". The video is manipulated using Xuggler, and the barcodes generated with the Barcode4J API. The details of how the message is translated into barcodes and added to the video are explained below.
When the message is extracted from the video, Xuggler and the ZXing API is employed.