• 沒有找到結果。

Embedding and Extracting Data in H.264 Videos

Chapter 3 Searches of Video Contents for Scene Surveillance by Novel Uses of

3.3 Embedding and Extracting Data in H.264 Videos

DCT-based data hiding methods are commonly used for videos and images. In video standards before H.264 is introduced, the DCT-based methods are the basis of many applications related to videos. However, while re-encoding, the DCT-based methods face a problem that different intra prediction modes cause different sets of frequency coefficients. Therefore, we introduce an improved DCT-based data hiding method suitable for H.264 videos. In Section 3.3.1, the proposed technique of embedding data is introduced. In Section 3.3.2, the proposed technique of extracting data is described.

3.3.1 Process of Embedding Data

In this section, we introduce the method of embedding data. The proposed idea is described in Section 3.3.1.1. In Section 3.3.1.2, the detailed algorithm is stated.

3.3.1.1 Proposed Idea

While an H.264 encoded stego-video is re-encoded, the resulting intra prediction modes may be distinct from the original ones. Hence, the data hidden in the frequency domain in this video may be lost because the resulting frequency coefficients could be different. As a result, we introduce a secret-key-based data hiding method. A secret key designated by a user is used to generate intra prediction modes used in data hiding in order to prevent the hidden data from being lost. The modes generated in the data hiding process will not affect the normal encoding procedure.

3.3.1.2 Detailed Algorithm

The proposed data hiding method deals with frames composed of I slices only.

Each 4×4 sub-macroblock of an I frame is used to hide one bit of data. The data hiding process is performed before the encoding process. A secret key is utilized as the seed of a random number generation. The result of the random number generation is used to decide an intra prediction mode P of each 4×4 sub-macroblock. A residual block generated based on P is transformed and quantized. The resulting frequency coefficients are modified to hide one bit of data and inverse transformed to produce a reconstructed block which substitutes the original 4×4 sub-macroblock. The encoder continues to encode this stego 4×4 sub-macroblock. In more details, P will not affect the normal encoding process and the prediction mode decided by the encoder is still the best prediction mode yielding the lowest coding cost.

Algorithm 3.2. The process of hiding a 16×16 macroblock in an H.264 video frame composed of I slices only.

Input: a secret key R, binary data D to be hidden, a 16×16 macroblock M16, and a random number generator f.

Output: a stego macroblock M16′.

Steps:

1. Use the input secret key R as a seed for f to generate a sequence of random numbers.

2. Perform the following steps before M16 is encoded.

2.1 For a 4×4 sub-macroblock M4 in M16, select one of the available intra prediction modes Mode of M4 according to the result of the random number generation.

2.2 Use Mode to produce a prediction block Mp and subtract it from M4 to generate a residual block Mr.

2.3 Transform Mr into the frequency domain to get the corresponding frequency coefficients of M4 in the form of a 4×4 block, Coeff.

2.4 Modify Coeff in order to hide an un-hidden bit B of D according to the following rules.

2.4.1 Select the coefficient pair C1(0, 3) and C2(3, 0) in Coeff.

2.4.2 Modify C1 and C2 according to the following equations:

(1). if B = 0:

2.5 Inverse transform Coeff and add the result to Mp to produce a reconstructed 4×4 sub-macroblock Mc, which is then taken to replace the original 4×4 sub-macroblock.

3. Repeat Step 2 until all 4×4 sub-macroblock in M16 are processed or until the data in D to be hidden are all processed.

4. Take the modified macroblock M16′ as input to the normal encoding process.

3.3.2 Process of Extracting Data

In this section, we introduce the proposed data extraction technique. The proposed ideas are described in Section 3.3.2.1. In Section 3.3.2.2, the detailed algorithm for it is presented.

3.3.2.1 Proposed Idea

The proposed method extracts data in a decoder. While the decoder performs a decoding process, we can use a secret key to select an intra prediction mode for each 4×4 sub-macroblock of a reconstructed macroblock. These intra prediction modes can produce sets of frequency coefficients. The hidden data can be extracted from these frequency coefficients.

3.3.2.2 Detailed Algorithm

When the video decoder decodes a macroblock to produce a reconstructed macroblock, a prediction sub-macroblock is formed for each 4×4 sub-macroblock of the reconstructed macroblock based on a prediction mode selected by a secret key.

The prediction sub-macroblock is subtracted from the reconstructed 4×4 sub-macroblock to produce a residual block which is then DCT-based transformed to a set of frequency coefficients. The hidden data can be extracted from these sets of frequency coefficients. The details are described in the following algorithm.

Algorithm 3.3. The process of data extraction from a 16×16 macroblock in an H.264 video frame composed of I slices only.

Input: a 16×16 macroblock M16, a secret key R, and a random number generator f.

Output: 16 bits of data hidden in M16. Steps:

1. Use the input secret key R as a seed for f to generate a sequence of random numbers.

2. Perform the following steps after M16 is decoded.

2.1 For each 4×4 sub-macroblock M4i of M16, select an intra prediction mode P

according to the result of the random number generation.

2.2 Use P to produce a prediction block P′.

2.3 Subtract P′ from M4i to produce a residual block R.

2.4 Transform R into a set of frequency coefficients Coeff.

2.5 Extract the hidden data bit(i) of M4i from Coeff according to the following equation:

3. Repeat Step 2 until all 4×4 sub-macroblock of M16 are processed.

4. Combine all bit(i) of M4i to form the 16 bits of the extracted data as output.

3.4 Embedding of Motion Region