**3. Proposed algorithm**

*Digital Forensic Science*

which is defined as:

distributed uniformly.

lowing way:

used for encryption.

in [0, 1]:

Another chaos map is Tent Map. It iterates a point *x*0 and gives a sequence *xi*

<sup>ì</sup> <sup>&</sup>lt; ïï = = <sup>í</sup>

m

where μ is a positive real constant. Varian of Tent Map is Skew Tent Map [8]

1

<sup>ï</sup> = = <sup>í</sup> - <sup>ï</sup> < £ ïî -

*i*

m

*x*

*i*

m

1

where *μ* is system parameter and *x*0 is initial condition of map. When a Skew Tent Map is iterated from *x*0 value, it produces a sequence in the interval [0, 1] and

> *x fx i i* <sup>+</sup><sup>1</sup> = m

*y gy i i* <sup>+</sup><sup>1</sup> = m

where *μ* is system parameter and is same for both maps. The CCCBG generated a sequence of random bits by comparing the outputs of the maps in the fol-

( ) 1 1

Based on several tests performed by Narendra et al., the CCCBG successfully passes all the randomness tests [10], therefore the random binary sequences can be

<sup>ì</sup> <sup>&</sup>lt; <sup>=</sup> <sup>í</sup> <sup>³</sup> <sup>î</sup>

0 , , 1 ,

1 1

+ +

*i i*

+ +

*i i x y hx y x y* (6)

1 1

+ +

*i i*

Narendra et al. in [10] proposed a random bit generator based on two Skew Tent Maps. The generator is abbreviated as CCCBG (Cross-Coupled Chaotic random Bit Generator). In the CCCBG, random bit stream is generated by comparing outputs of the couple maps. If *fμ*(*xi*) and *gμ*(*yi*) are two Skew Tent Maps and are given as:

m

<sup>1</sup> , <sup>2</sup>

1 ,

*i i*

*x x*

*i i*

*x x*

,0

m

<sup>ì</sup> £ < <sup>ï</sup>

, 1

*x*

*i*

*x*

<sup>ï</sup> - ³ ïî

1

(2)

(3)

2

m

( ) (4)

( ) (5)

( ) ( ) <sup>1</sup>

+

+

*i i*

m

<sup>1</sup> ( )

m

*x fx <sup>x</sup>*

*i i*

*x fx*

**40**

**Figure 1.**

*A random image generated by using the CCCBG.*

This section will explain the proposed fragile video watermarking on spatial domain based on the chaotic map. The watermark is a binary image. To detect manipulation in the video frames until pixel level, the watermark must have the same size as the video frame size. Therefore, if watermark size is less than video frame size, the watermark need to be replicated by duplicating it a number of times in order to produce a new watermark that has the same size with the host video frame size. **Figure 2** shows example of replication. The original watermark "ASEAN logo" has a size of 200 × 194 pixels, whereas the video frames have a size of 480 × 854 pixels. This original watermark must be duplicated a number of times so that produce a replicated watermark that has size 480 × 854.

Next, to increase security, before embedding, the replicated watermark is encrypted by XOR-ing it with a random image. A random image is generated by iterating CCCBG a number of *mn* times where *m* and *n* are frame sizes (**Figure 1**). The replicated watermark is encrypted with the random image by using XOR operation to produce an encrypted watermark (**Figure 3**). Next, we embed the encrypted watermark into the host video.

We design a simple, but secure, fragile video watermarking based on chaos. The fragile video watermarking algorithm consists of two processes: embedding algorithm and extraction algorithm, each will be described below.

### **3.1 Watermark embedding algorithm**

There are two scenarios for embedding the watermark into a digital video. The first scenario is embedding each frame of the video with the same watermark. The second scenario is embedding each frame of the video with the different watermark. The second scenario is not practical because the video owner have to provide the watermark of as many frames. Actually, the watermarks can be generated from the video itself (i.e., internal watermarks), we generate the watermark for each video frame that

**Figure 2.** *Left: the original watermark; right: the replicated watermark.*

**Figure 3.** *Left: the replicated watermark. Right: the encrypted watermark.*

depend on the frame content itself. However, the resulting watermark is meaningless and cannot be perceived visually. We want the watermark to be meaningful and can be perceived visually. Therefore, we choose the watermark is a meaningful binary image and, for practical reason, the same watermark is embedded to each video frame.

Now, we can describe the watermark embedding algorithm into the digital video in more detail as follows:

**Input**: a host video file (*v*), a watermark file (*w*), and CCCBG's parameter and initial conditions (*μ*, *x*0, *y*0).

**Output**: a watermarked video (*v*').

Step 1: Read the frames of video *v*, the watermark *w*, and CCCBG's parameter and initial conditions (*μ*, *x*0, and *y*0). If the video has an audio, then separate the audio.

Step 2: If size(*w*) < size(video frame of *v*), copy the single watermark to produce a replicated watermark *w*' which has the same size with the host video frames.

Step 3: Iterate CCCBG *mn* times to produce a random image *r*.

Step 4: Encrypt *w*' by XOR-ing it with *r* as follows:

$$
\omega \nu \prime = \omega \prime \oplus r \tag{7}
$$

**43**

region in a frame.

**4. Experiment and results**

*Application of Chaos-Based Fragile Watermarking to Authenticate Digital Video*

Step 6: If the original video has audio, merge it to the watermarked frames to

**Figure 4** shows stages in the watermark embedding algorithm. The watermark is embedded into each frames of video. If the video has audio, the audio has not been changed. After embedding of the watermark, audio is merged back into the video.

Watermark extraction from the video is performed to prove video authentication. Only the video owner can do it, because the owner has the original watermark. The original watermark is required to compare it with the extracted watermark. If the extracted watermark is the same as the original watermark (can be observed visually), then we decide that the video is authentic, otherwise the video has been altered, tampered, or manipulated. The original watermark is also required to localize the tampered region in a frame. Watermark extraction can be performed on all

Now, we can describe the watermark extraction algorithm from the digital video

**Input**: a watermarked video file (*v*'), an original watermark file (*w*), and

Step 1: Read the frames of video *v*', watermark *w*, and CCCBG's parameter and

Step 2: If size(*w*) < size(video frame of *v*), copy the single watermark to produce

Step 4: For each frame, extract all of the least significant bit (LSB) of pixels. This

*w*"' = *w*" ⊕ *r.* (8)

Step 5: Compare *w*"' with *w*'. If *w*"' = *w*', we conclude that the integrity of video

Step 6: To localize tampered region, subtract *w*' to *w*"'. If a pixel is not changed,

Step 7: Identify pixels in the watermarked framed in position where the subtrac-

**Figure 5(a)** shows stages in the watermark extraction algorithm. The watermark is extracted from each frame of video and then compares the extracted watermark to the original watermark. The decision is binary (1 or 0), 0 means the watermarked

We have implemented the proposed algorithm to be a computer program. Next we test the algorithm on a sample video to determine authentication of the video. The

video has not changed (authentic), 1 means the watermarked video has been manipulated, altered, or tampered. **Figure 5(b)** shows how to localize tampered

**Output**: an extracted watermark, location of tampered frame (if any).

a replicated watermark *w*' which has the same size with the host video frames.

Step 3: Iterating CCCBG *mn* times to produce a random image *r*.

Step 4: Decrypt the watermark *w*" by XOR-ing it with *r* as:

tion above yields 1. Those are pixels that have been manipulated.

*DOI: http://dx.doi.org/10.5772/intechopen.93151*

**3.2 Watermark extraction algorithm**

video frames or only on certain frames.

CCCBG's parameter and initial conditions (*μ*, *x*0, and *y*0).

in more detail as follows:

initial conditions (*μ*, *x*0 and *y*0).

step yields an extracted watermark *w*".

is authenticated. If not, go to step 6 and 7.

the subtraction yields 0, else the subtraction yields 1.

produce a watermarked video.

Step 5: Embed the encrypted watermark, *w*", into each frame of the video by manipulating the least significant bit (LSB) of pixels. If the frame has R, G, and B component, then it performs embedding to each component.

**Figure 4.** *Watermark embedding algorithm.*

Step 6: If the original video has audio, merge it to the watermarked frames to produce a watermarked video.

**Figure 4** shows stages in the watermark embedding algorithm. The watermark is embedded into each frames of video. If the video has audio, the audio has not been changed. After embedding of the watermark, audio is merged back into the video.

### **3.2 Watermark extraction algorithm**

*Digital Forensic Science*

in more detail as follows:

initial conditions (*μ*, *x*0, *y*0).

the audio.

**Figure 3.**

**Output**: a watermarked video (*v*').

*Left: the replicated watermark. Right: the encrypted watermark.*

depend on the frame content itself. However, the resulting watermark is meaningless and cannot be perceived visually. We want the watermark to be meaningful and can be perceived visually. Therefore, we choose the watermark is a meaningful binary image and, for practical reason, the same watermark is embedded to each video frame.

Now, we can describe the watermark embedding algorithm into the digital video

**Input**: a host video file (*v*), a watermark file (*w*), and CCCBG's parameter and

Step 1: Read the frames of video *v*, the watermark *w*, and CCCBG's parameter

Step 2: If size(*w*) < size(video frame of *v*), copy the single watermark to produce

*wwr* " ' = Å (7)

and initial conditions (*μ*, *x*0, and *y*0). If the video has an audio, then separate

a replicated watermark *w*' which has the same size with the host video frames.

Step 5: Embed the encrypted watermark, *w*", into each frame of the video by manipulating the least significant bit (LSB) of pixels. If the frame has R, G, and B

Step 3: Iterate CCCBG *mn* times to produce a random image *r*.

Step 4: Encrypt *w*' by XOR-ing it with *r* as follows:

component, then it performs embedding to each component.

**42**

**Figure 4.**

*Watermark embedding algorithm.*

Watermark extraction from the video is performed to prove video authentication. Only the video owner can do it, because the owner has the original watermark. The original watermark is required to compare it with the extracted watermark. If the extracted watermark is the same as the original watermark (can be observed visually), then we decide that the video is authentic, otherwise the video has been altered, tampered, or manipulated. The original watermark is also required to localize the tampered region in a frame. Watermark extraction can be performed on all video frames or only on certain frames.

Now, we can describe the watermark extraction algorithm from the digital video in more detail as follows:

**Input**: a watermarked video file (*v*'), an original watermark file (*w*), and CCCBG's parameter and initial conditions (*μ*, *x*0, and *y*0).

**Output**: an extracted watermark, location of tampered frame (if any).

Step 1: Read the frames of video *v*', watermark *w*, and CCCBG's parameter and initial conditions (*μ*, *x*0 and *y*0).

Step 2: If size(*w*) < size(video frame of *v*), copy the single watermark to produce a replicated watermark *w*' which has the same size with the host video frames.

Step 3: Iterating CCCBG *mn* times to produce a random image *r*.

Step 4: For each frame, extract all of the least significant bit (LSB) of pixels. This step yields an extracted watermark *w*".

Step 4: Decrypt the watermark *w*" by XOR-ing it with *r* as:

$$
\mathfrak{w}^{\prime\prime\prime} = \mathfrak{w}^{\prime\prime} \oplus \mathfrak{r}.\tag{8}
$$

Step 5: Compare *w*"' with *w*'. If *w*"' = *w*', we conclude that the integrity of video is authenticated. If not, go to step 6 and 7.

Step 6: To localize tampered region, subtract *w*' to *w*"'. If a pixel is not changed, the subtraction yields 0, else the subtraction yields 1.

Step 7: Identify pixels in the watermarked framed in position where the subtraction above yields 1. Those are pixels that have been manipulated.

**Figure 5(a)** shows stages in the watermark extraction algorithm. The watermark is extracted from each frame of video and then compares the extracted watermark to the original watermark. The decision is binary (1 or 0), 0 means the watermarked video has not changed (authentic), 1 means the watermarked video has been manipulated, altered, or tampered. **Figure 5(b)** shows how to localize tampered region in a frame.

## **4. Experiment and results**

We have implemented the proposed algorithm to be a computer program. Next we test the algorithm on a sample video to determine authentication of the video. The

**Figure 5.**

*(a) Watermark extraction algorithm and (b) localize tampered region.*

sample video was a video clip which has 394 frames and long 16 seconds, each frame has a size 480 × 854 (**Figure 6a**). This video contains audio inside. **Figure 6b** and **c** show two frames of the video (frame 1 and frame 175).

The watermark to be embedded into the host video is "ASEAN logo" as shown in **Figure 3** (after replicated). In these experiments below, we used parameters of CCCBG as follows: *μ* = 0.48999, initial conditions *x*0 = 0.5006841, and *y*0 = 0.538167586. The two initial conditions serve as the secret keys. These keys were used in both watermark embedding algorithm and extraction algorithm.

This algorithm can only be used to test the authentication of digital videos that have been spatially manipulated. Spatial manipulation such as changing the contrast of the image, adding noise, changing the size of the frame, copy and paste an object into the frame, and others. The algorithm cannot temporarily detect video manipulation, for example, by removing one or more frames.

In the section below, we divide experiments into two cases: (i) no attack case and (ii) tamper detection test, each will be described below.

### **4.1 No-attack case**

If the watermarked video is not manipulated, we categorized it as no attack case. To prove the authentication of the video, we extracted all watermarks from each video frame. All watermarks should be the same as the original watermark. **Figure 7** shows the extracted watermarks but only from frame number 1 and frame number 283.

Visually, there are no damages in the extracted watermarks. When we compare the extracted watermark to the original watermark by subtracting them, we get

**45**

watermark.

**Figure 7.**

**Figure 6.**

*The watermarked frames and the extracted watermarks.*

*(a) A host video to be watermarked, (b) frame 1, and (c) frame 175.*

*Application of Chaos-Based Fragile Watermarking to Authenticate Digital Video*

the difference is a black image (all of pixels are 0). Therefore, we conclude no tampering performed to the watermarked video. In this algorithm, parameter and initial condition of CCCBG behave as secret keys. Embedding and extraction of the watermark could be done by the authorized party only. If the receiver did not have the same keys, then the extracted watermark is not the same as the original

*DOI: http://dx.doi.org/10.5772/intechopen.93151*

*Application of Chaos-Based Fragile Watermarking to Authenticate Digital Video DOI: http://dx.doi.org/10.5772/intechopen.93151*

**Figure 6.**

*Digital Forensic Science*

sample video was a video clip which has 394 frames and long 16 seconds, each frame has a size 480 × 854 (**Figure 6a**). This video contains audio inside. **Figure 6b** and **c**

The watermark to be embedded into the host video is "ASEAN logo" as shown

This algorithm can only be used to test the authentication of digital videos that have been spatially manipulated. Spatial manipulation such as changing the contrast of the image, adding noise, changing the size of the frame, copy and paste an object into the frame, and others. The algorithm cannot temporarily detect video

In the section below, we divide experiments into two cases: (i) no attack case and

If the watermarked video is not manipulated, we categorized it as no attack case. To prove the authentication of the video, we extracted all watermarks from each video frame. All watermarks should be the same as the original watermark. **Figure 7** shows the extracted watermarks but only from frame number 1 and frame number 283.

Visually, there are no damages in the extracted watermarks. When we compare the extracted watermark to the original watermark by subtracting them, we get

in **Figure 3** (after replicated). In these experiments below, we used parameters of CCCBG as follows: *μ* = 0.48999, initial conditions *x*0 = 0.5006841, and *y*0 = 0.538167586. The two initial conditions serve as the secret keys. These keys were used in both watermark embedding algorithm and extraction algorithm.

show two frames of the video (frame 1 and frame 175).

*(a) Watermark extraction algorithm and (b) localize tampered region.*

manipulation, for example, by removing one or more frames.

(ii) tamper detection test, each will be described below.

**44**

**4.1 No-attack case**

**Figure 5.**

*(a) A host video to be watermarked, (b) frame 1, and (c) frame 175.*

**Figure 7.** *The watermarked frames and the extracted watermarks.*

the difference is a black image (all of pixels are 0). Therefore, we conclude no tampering performed to the watermarked video. In this algorithm, parameter and initial condition of CCCBG behave as secret keys. Embedding and extraction of the watermark could be done by the authorized party only. If the receiver did not have the same keys, then the extracted watermark is not the same as the original watermark.

**Figure 8.** *The watermarked frames and the extracted (wrong) watermarks.*
