Self-adaptive robust video watermarking method based on H.264AVC video coding
By employing an adaptive robust video watermarking method, and utilizing data preprocessing and a regularized embedding group structure, the problem of insufficient watermark robustness in the H.264/AVC video coding environment is solved. This method enables robust transmission and reliable recovery of watermark information under compression and recoding conditions, thereby improving synchronization and visual quality.
Patent Information
- Application Number
- CN202511426964.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-01-09
AI Technical Summary
Existing video watermarking methods are not robust enough in H.264/AVC video coding environments, have poor synchronization, and suffer from reduced visual quality, especially with low extraction accuracy under compression and recoding conditions.
An adaptive robust video watermarking method is adopted. Through data preprocessing, watermark embedding and extraction steps, including image grayscale conversion, DCT transformation, quantization, zigzag scanning, error correction coding, intra-frame macroblock group mapping and majority statistical decision, a regularized embedding group structure is constructed and a redundancy check mechanism is introduced to ensure robust transmission and reliable recovery of watermark information under strong compression and recoding environment.
It significantly improves the overall performance of the watermarking system in terms of synchronization, robustness, and invisibility, ensuring the secure dissemination and copyright protection of video content in an open network environment.
Smart Images

Figure CN121309846A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of digital content security and multimedia information hiding technology, specifically relating to an adaptive robust video watermarking method based on H.264 AVC video coding. Background Technology
[0002] With the development of video technology and the continuous upgrading of network infrastructure, the number of digital videos has exploded globally, becoming a mainstream information dissemination medium. In recent years, short videos, with their advantages of low production barriers and low costs, have once again given new impetus to the creation and dissemination of digital videos. According to the "China Short Video Development Research Report (2024)" (Short Video Blue Book) released by the Development Research Center of the State Administration of Radio and Television in December 2024, the number of short video users and usage rates have maintained a long-term growth trend. From December 2018 to December 2023, the number of short video users increased from 648 million to 1.053 billion, and the usage rate also increased from 78.2% to 96.40%, both reaching peak levels. As of June 2024, the number of short video users in my country reached 1.05 billion. Against this backdrop, how to effectively mark and track the copyright ownership of video content has become a key issue in copyright management in today's era.
[0003] Digital watermarking technology is widely used in digital video copyright protection due to its advantages such as strong concealment and flexible information embedding. Watermarking methods using video keyframes, in particular, have promising practical application prospects because they balance embedding effectiveness and computational efficiency. Meanwhile, the widely used H.264 / AVC video coding standard remains dominant in a large number of low-to-medium bitrate videos due to its high compression ratio and broad hardware and software compatibility, especially in surveillance recording and low-bitrate communication scenarios, where it has irreplaceable practical value. Therefore, developing video watermarking algorithms with strong compatibility and low resource overhead, tailored to the characteristics of the H.264 architecture, still has clear engineering and application significance.
[0004] However, during transmission, video content is often affected by heavy compression and unavoidable noise. Even without structural damage, heavy compression of video can cause structural changes in intra-frame Intra 4×4 sub-macroblocks, such as macroblock loss, abrupt changes in non-zero quantization coefficients, or increases or decreases in the number of macroblocks. This can lead to intra-frame extraction pace shifts, resulting in extraction asynchrony and a significant decrease in watermark extraction accuracy. Summary of the Invention
[0005] This invention addresses the shortcomings of existing technologies by providing an adaptive robust video watermarking method based on H.264 / AVC video coding. This method establishes a robust embedding and reliable extraction method for video watermarking in an H.264 / AVC video coding environment, thereby solving the problems of insufficient robustness, poor synchronization, and decreased visual quality of existing video watermarking methods under compression and recoding conditions.
[0006] To achieve the above objectives, the present invention is implemented through the following technical solutions.
[0007] An adaptive robust video watermarking method based on H.264 AVC video coding mainly includes the following steps:
[0008] The first step is data preprocessing, which includes the following steps:
[0009] The image is converted to grayscale, and the grayscale values are subjected to integer DCT (Discrete Cosine Transform) transformation and quantization processing. Then, a zigzag coefficient scan is performed, followed by data formula transformation and 4-bit unsigned binary encoding conversion. Finally, an error correction coding stage is introduced to improve the watermark data recovery capability, so as to retain its semantic recognition capability while compressing the watermark image data size to the greatest extent.
[0010] The second step is watermark embedding. A deterministic mapping of "macroblock group → bit" is established within the keyframe, and the same information is embedded in a distributed manner at different time points to avoid strong dependence of the embedding result on the state of a certain frame, thereby improving the time redundancy and fault tolerance of the watermark information.
[0011] Before each sub-macroblock in the frame participates in embedding, it is necessary to calculate its group number based on the position of its macroblock. The embedding target value is then extracted from the corresponding watermark bit sequence based on the number. At the same time, an embedding counting mechanism is maintained within each group to control the embedding strength within that group, so as to avoid structural disturbances caused by excessive load on a single group.
[0012] The third step is watermark extraction. A decision method based on bit-level majority statistics is introduced to fuse the extraction results of the same watermark line in multiple keyframes. Based on the fixed mapping from macroblock number to group number, candidate bits are collected group by group. When a group switch occurs or the termination condition is met, the majority vote within the group is performed to obtain the final output bits of the group. The reconstructed watermark line is the output result of this redundant voting process.
[0013] As a further improvement to the above scheme, in the data preprocessing stage, the error correction coding step adopts (7,4) Hamming code error correction coding.
[0014] As a further improvement to the above scheme, the watermark embedding stage adopts an intra-frame mapping scheme based on fixed-interval macroblock division of CIF (Common Intermediate Format) standard video sequences (each frame contains 396 macroblocks of size 16×16) to standardize the allocation of watermark embedding position and intensity adjustment unit for each frame.
[0015] To meet the dual requirements of embedding capacity and error correction redundancy, every three consecutive 16*16 macroblocks are divided into a logical embedding mapping group, thereby constructing a total of 132 equally spaced macroblock groups in a frame of image; each group is regarded as a basic embedding unit, corresponding to 1 target bit; this is to simplify data address mapping, thereby improving the stability and consistency of index management during embedding and extraction.
[0016] A redundant mapping method is used for the macroblock group at the end of the frame, that is, the last two redundant watermark bits are mapped to the macroblock group at the end of the frame. This is to deal with the situation that it may be difficult to divide several macroblocks at the end of the video encoding evenly, thereby ensuring the integrity of the embedded structure and the accuracy of decoding alignment.
[0017] This invention, by constructing a regularized embedding group structure and combining it with a redundancy check mechanism, achieves robust transmission and reliable recovery of watermark information under conditions of strong compression and recoding without significantly affecting video visual quality and bitrate. This invention can significantly improve the overall performance of watermarking systems in terms of synchronization, robustness, and invisibility, providing technical support for the secure dissemination and copyright protection of video content in open network environments. Attached Figure Description
[0018] Figure 1 This is a flowchart of the watermark image data preprocessing process.
[0019] Figure 2 This is a schematic diagram of the Z-shaped scanning sequence.
[0020] Figure 3 This is a schematic diagram of macroblock group partitioning.
[0021] Figure 4 These are comparison images showing the effects of watermark preprocessing.
[0022] Figure 5 This is a comparison of keyframes before and after watermark embedding.
[0023] Figure 6 This is for extracting and reconstructing the watermark image after recompression. Detailed Implementation
[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0025] For the data preprocessing section, refer to... Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 5 and Figure 6 .
[0026] Considering the limited intra-frame embedding capacity in H.264 encoding and the constraint of macroblock structure on the embedding position, this paper designs a watermark preprocessing scheme to simplify and standardize the watermark content before embedding. This scheme mainly includes image grayscale conversion, integer DCT (Discrete Cosine Transform) transformation and quantization of grayscale values, zigzag coefficient scanning, data formula conversion, 4-bit unsigned binary encoding conversion, and the introduction of error correction (7-4 Hamming code) encoding. This maximizes the compression of the watermark image data size while preserving its semantic recognition capability. The specific process is as follows: Figure 1 As shown.
[0027] First, this paper performs grayscale conversion on the original color watermark image. The specific conversion formula is shown in formula (1):
[0028] Y=0.299R+0.587G+0.114B Formula (1)
[0029] Where R, G, and B represent the pixel values in the red, green, and blue channels of the image, respectively, and Y represents the converted grayscale value. This formula uses a weighted average based on the human eye's sensitivity to different colors, compressing the RGB three channels into a single channel to retain more brightness information, which is beneficial for subsequent frequency domain processing and unified design of embedding strategies. The image is then adjusted to a uniform 32*32 resolution to achieve size standardization and data volume control.
[0030] To achieve energy concentration and data compression in the frequency domain, this paper performs integer DCT block transformation on grayscale images. Unlike traditional floating-point DCT, integer DCT uses an approximately orthogonal integer transformation kernel instead of floating-point trigonometric function calculation, which can effectively reduce computational errors and resource consumption, and is especially suitable for implementation in resource-constrained embedded or video coding scenarios. This transformation method is consistent with the integer transformation structure specified in H.264 / AVC, which helps to ensure consistent deployment and hardware compatibility in subsequent compression domain watermarking. In the implementation process, the entire image is divided into multiple 4*4 blocks and integer DCT is applied to each block, and the corresponding formula is shown in formula (2) below:
[0031]
[0032] Where f(x,y) is the pixel value located at coordinates (x,y) in the grayscale block of the original image; F(u,v) is the coefficient located at (u,v) in the frequency domain after DCT transformation; C(u,x) and C(v,y) represent the transformation kernel matrix elements of integer DCT.
[0033] The transformation kernel matrix used in this paper is as follows:
[0034]
[0035] The output coefficients after integer DCT processing are concentrated in the low-frequency region, while the high-frequency part is mostly 0 or close to 0.
[0036] After the integer DCT transformation, the watermark image is mapped to the frequency domain. The energy distribution among the coefficients exhibits a clear concentration characteristic, meaning that the low-frequency coefficients have concentrated energy, while the high-frequency coefficients are typically smaller. To further compress redundant information and adapt to the embedding capacity, this paper introduces quantization and zigzag scanning operations.
[0037] Quantization is the process of mapping floating-point or large-range integer values to finite-range integer values, which can significantly compress data size and enhance robustness to high-frequency disturbances. The basic idea is to divide each DCT coefficient by a corresponding quantization factor and round it down. The quantization process can be represented by formula (3):
[0038]
[0039] Where F(i,j) is the coefficient located in the i-th row and j-th column after DCT transformation; Qm is the quantization matrix, Qm(i,j) is the quantization factor in the i-th row and j-th column of the quantization matrix; Q(i,j) is the quantized integer value; round() represents the rounding operation.
[0040] The selected quantization matrix is as follows:
[0041]
[0042] To facilitate subsequent processing such as compression coding or intra-frame mapping, this paper employs a zig-zag scan to linearly expand each quantized Intra_4×4 block into a one-dimensional array in a specific order. The Intra_4×4 block is the intra-frame 4×4 block. The zig-zag order prioritizes traversing low-frequency regions, which enhances the processing efficiency of sparse coefficient sequences while maintaining information validity. The zig-zag scan order is as follows: Figure 2 As shown.
[0043] Ultimately, each block is converted into a one-dimensional vector, providing ordered, compressed input data for subsequent format conversion and embedding processing.
[0044] To further compress watermark information and enhance its structural regularity and encoding adaptability, this paper introduces a two-stage data processing after zigzag scanning: formula transformation and 4-bit unsigned binary encoding conversion.
[0045] First, to address the potential differences in coefficient amplitudes across different watermark bit rows, this paper designs a normalization formula transformation mechanism. For each group of extracted non-zero quantization coefficients, denoted as n, let the minimum value among the non-zero quantization coefficients be wm_min and the maximum value be wm_max. Let the x-th coefficient in this group be n(x), then its normalized transformation value wm(x) can be calculated using formula (4):
[0046]
[0047] Here, `round()` represents the rounding operation. This transformation can compress any set of coefficients into the range [0, 15], maximizing the use of fixed bit width representation capabilities and facilitating subsequent encoding processing. To avoid division by zero errors, when all coefficients are equal or there is only one valid value in the group, the system will use a default padding value (such as 15) for processing, while recording the original maximum and minimum values for subsequent restoration.
[0048] Considering the low redundancy and structural requirements of subsequent watermark embedding, a 4-bit wide binary code is used to convert each normalized value.
[0049] Error-correcting coding is introduced: This module is based on the classic (7,4) linear block code—Hamming code—which maps every four original watermark bits to seven encoded bits. This mechanism can correct single-bit errors and detect double-bit errors, effectively improving the recoverability of watermark data when encountering minor interference or bit flips. Because this system adopts a fixed-length coding strategy, the entire bitstream maintains structural consistency, avoiding problems such as displacement misalignment and alignment deviations, which helps simplify the synchronous processing logic during embedding and extraction.
[0050] Specifically, in the encoding stage, the system first divides the watermark bitstream into groups of 4 bits each, and then converts them into corresponding 7-bit Hamming codewords by looking up a table, thereby generating a redundant data stream with error correction capabilities.
[0051] Embedded extraction design, refer to Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 5 and Figure 6 .
[0052] Intra-frame mapping strategy:
[0053] To achieve robust and orderly watermark embedding while maintaining video quality, a structured intra-frame partitioning and mapping mechanism is crucial. For the CIF (Common Intermediate Format) standard video sequence used in this paper (each frame contains 396 16×16 macroblocks), this study proposes an intra-frame mapping scheme based on fixed-interval macroblock partitioning to normalize the allocation of watermark embedding positions and intensity adjustment units for each frame.
[0054] Specifically, to accommodate both embedding capacity and error correction redundancy, this scheme divides every three consecutive 16*16 macroblocks into a logical embedding mapping group, thereby constructing a total of 132 equally spaced macroblock groups in one frame of image, such as... Figure 3 As shown.
[0055] Each group is considered a basic embedding unit, corresponding to 1 target bit. This equal-division strategy simplifies data address mapping and improves the stability and consistency of index management during embedding and extraction.
[0056] However, due to the varying texture complexity of macroblocks within a video frame, the acceptable level of embedding operations also exhibits an uneven distribution. Some macroblocks have relatively flat image structures, resulting in a limited number of high-energy coefficients retained after quantization, thus restricting the embedding space and potentially leading to insufficient watermark strength. Conversely, macroblocks with richer texture variations possess stronger embedding capacity. This uneven distribution of embedding capacity among macroblocks necessitates that the embedding mechanism possess a certain degree of local adaptability, especially in macroblocks with small quantization residuals, where errors are more likely to occur during the extraction stage. To address this, before participating in embedding, each sub-macroblock within a frame must first calculate its group number based on its macroblock position, and then extract the embedding target value from the corresponding watermark bit sequence based on this number. Simultaneously, the system maintains an embedding counting mechanism within each group to control the embedding strength within that group, preventing structural disturbances caused by overloading a single group.
[0057] In addition, considering that it may be difficult to divide several macroblocks at the end of the video encoding evenly, a redundant mapping method is adopted for the macroblock group at the end of the frame (such as macroblocks 378 to 395), that is, the last two redundant watermark bits are mapped to the macroblock group at the end to ensure the integrity of the embedded structure and the accuracy of decoding alignment.
[0058] Intra-frame embedding rule design: Reference Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 5 and Figure 6 .
[0059] (1) Candidate macroblock selection
[0060] To improve the stability and compression resistance of embedded data, this system only performs embedding in macroblocks that meet specific conditions. The selected object is a luma sub-macroblock in Intra_4×4 mode, which must satisfy the following two constraints:
[0061] Frequency domain carrying capacity determination: If the number of non-zero coefficients retained after transformation and quantization of a macroblock is not less than 6, it is determined that it has sufficient frequency domain complexity to carry additional information; otherwise, it is skipped to avoid introducing obvious distortion in flat macroblocks.
[0062] Embedding cap control: To prevent quality degradation due to excessive modification of a single group, a capacity threshold is set for each fixed embedding group. In this experiment, count ≥ 15, where count represents the number of embedded bits in a single group. If the number of bits written to a group reaches the cap, no further embedding will be performed, even if the candidate macroblock meets the complexity condition.
[0063] (2) Odd-even mapping embedding mechanism
[0064] In the selected macroblocks, bit writing is achieved using parity-based coefficient fine-tuning:
[0065] Let the bit to be embedded be wm_bit, which can take the value 0 or 1;
[0066] Calculate the algebraic sum of all non-zero coefficients in the macroblock and determine its parity;
[0067] If wm_bit = 1 and the current sum is even, then perform an amplitude + 1 correction on the last non-zero coefficient;
[0068] If wm_bit = 0 and the current sum is odd, the non-zero coefficients at the end are also incremented by 1 for correction.
[0069] If the parity matches the target bit, no adjustment is needed;
[0070] The count is automatically incremented by 1 each time an embedding is completed.
[0071] This method only requires a very small modification to the last frequency domain coefficient to complete bit injection. While maintaining the visual quality and spectral feature stability of the image, it ensures that the extraction end can directly achieve blind detection based on the parity of the decoded coefficients.
[0072] (3) Tail compensation mechanism
[0073] Considering that the number of macroblocks at the end of the video frame may be insufficient to support complete segmentation, this system adds redundant bits (constant 1 and 0 in this experiment) within the range of intra-frame macroblock indices 378–395. These bits do not directly carry effective watermark information, but provide structural verification support during extraction and error correction, avoiding synchronization offsets or extraction failures due to insufficient frame end data.
[0074] Intra-frame extraction rule design: Refer to Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 5 and Figure 6 .
[0075] To ensure consistency between the embedding and extraction processes, this paper designs an extraction mechanism based on mapping partitioning and majority voting during the keyframe decoding process. This mechanism combines macroblock frequency domain features with a fixed mapping structure to achieve robust watermark recovery without altering the original decoding process.
[0076] (1) Initialization and keyframe recognition
[0077] When decoding to a keyframe, the necessary initialization operations are first performed:
[0078] Set the group's bit counter bit_cnt to zero to track the number of bits extracted in the current group;
[0079] The group index difference flag delta is initialized to -1 to provide a basis for subsequent judgment of group switching and bit ownership.
[0080] (2) Candidate macroblock filtering
[0081] In the Intra_4×4 mode sub-macroblock of the luminance component, if the total number of non-zero quantization coefficients (NNZ) is greater than or equal to 6, the macroblock is considered a potential watermark carrier; otherwise, it is skipped to avoid misjudgment caused by flat macroblocks in the image.
[0082] (3) Macroblock group location and switching judgment
[0083] For each candidate macroblock, its group number group_id is calculated based on its macroblock index mb_index, as shown in formula (5):
[0084]
[0085] Then, the difference between group_id and the group number prev_group to which the previous macroblock belongs is calculated, as shown in formula (6):
[0086] △=group_id-preu_group formula (6)
[0087] Make a judgment based on the result of Δ.
[0088] Δ = 1: Indicates moving to the next adjacent group. If it is not the first group of a frame, a majority vote must be performed on the bits already collected in the previous group, and the voting result is written into the buffer as the final bits of that group.
[0089] Δ>1: This indicates that a group jump has occurred. In this case, in addition to completing the majority vote, random bits need to be filled into the uncovered groups in the middle to avoid bit order disorder.
[0090] Δ = 0: This means that the data is still in the same group, no vote is needed, and extraction can continue.
[0091] Each time a new group is entered, bit_cnt is reset to 0, indicating that no bits have been recorded in that group.
[0092] (4) Bit extraction rules
[0093] If no macroblock group switch occurs and bit_cnt < 15, perform bit extraction on the current sub-macroblock:
[0094] If the sum of the non-zero coefficients is odd, then extract the bit value "1";
[0095] If the sum is even, extract the bit value "0".
[0096] This bit will be added to the candidate set of the current group, and bit_cnt will increment to count the number of bits in the group.
[0097] (5) Macroblock group index update
[0098] At the end of macroblock processing, the current group_id is stored in prev_group for the next macroblock to determine group changes.
[0099] (6) Tail processing
[0100] After all macroblocks in the keyframe have been decoded, it is necessary to specifically check whether the last extracted group is located at the end of the frame:
[0101] If the group number is 131, then a majority vote is performed directly on that group;
[0102] If insufficient, random bits are added to the uncovered groups based on the vote to ensure the integrity of the bit sequence.
[0103] (7) Voting and Error Correction of Macroblocks
[0104] Ultimately, 132 bits can be extracted from each frame:
[0105] The first 126 bits form the Hamming code string, which enters the decoding and error correction process and outputs 72 bits of valid watermark information.
[0106] The last 6 groups are decided by majority vote (3 groups → 1 bit) to obtain 2 positioning bits, which are the last positioning bits.
[0107] Design of cross-frame redundancy embedding and majority voting extraction mechanism:
[0108] The system employs a strategy of embedding multi-frame redundancy line by line:
[0109] (1) Embedding strategy: Each line of watermark data to be embedded is not embedded all at once in one frame, but is embedded once in each of the five key frames, with the same line content as the unit.
[0110] This design distributes the same information at different points in time, avoiding strong dependence of the embedding result on the state of a certain frame, and significantly improving the temporal redundancy and fault tolerance of the watermark information.
[0111] (2) Extraction strategy: In the watermark extraction stage, in order to fuse the extraction results of the same watermark line in multiple keyframes, the system introduces a decision method based on bit-level majority statistics.
[0112] Specifically, the extraction end compares the five sets of identical watermark bit sequences extracted from five consecutive frames bit by bit. By counting the occurrences of "0" and "1" in each bit, the bit with the highest frequency is selected as the final output bit. The reconstructed watermark line is the output result of this redundant voting process.
[0113] This method can effectively offset local extraction errors from a few frames, thereby improving the overall accuracy and stability of watermark extraction.
[0114] Experimental setup: Refer to Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 5 and Figure 6 .
[0115] This system is based on the H.264 / AVC standard video compression architecture and constructs a complete watermark embedding and extraction process around intra-frame mapping strategies and frequency domain embedding rules. The system experimental platform is the Microsoft Visual Studio 2022 (VS2022) integrated development environment under the Windows 11 operating system, and the core encoder version uses the reference implementation JM19.0 released by the international standards organization. The embedding and extraction modules are implemented on the encoder and decoder sides respectively, and the cross-module transfer of watermark information and the extension of embedding control logic are achieved by modifying several key functions and data structures in JM19.0.
[0116] The video data is in CIF format with a resolution of 352×288. The input is a raw YUV format sequence with a frame rate of 30fps and a total of 500 frames. Video sequences with insufficient frames are edited and spliced using YUV video editing tools. In the system configuration, the default quantization step size is 23, the Group of Pictures (GOP) length is set to 3, and the frame type sequence is I, I, B, B, I, B, B,…, where the first frame is an Instantaneous Decoding Refresh (IDR) frame. System inputs and outputs include:
[0117] Input video file: Supports .yuv format, chroma sampling format of 4:2:0, and resolution of CIF (352×288);
[0118] Watermark data file: The preprocessed watermark data to be embedded is stored in .txt text format. Each line is a 74-bit watermark bit string (72 watermark bits + 2 line end positioning bits 10). The system will repeatedly embed the watermark line by line in multiple frames during the encoding process.
[0119] Output video file: The encoded output format is an H.264 byte stream file (.264);
[0120] Watermark extraction results: The extracted bit results are output and saved as a .txt text file for subsequent calculation of performance indicators such as Bit Error Rate (BER).
[0121] The system experiments evaluated the watermarking algorithm's performance from the following three dimensions and compared it with the method proposed by Fan:
[0122] Invisibility: The changes in image quality before and after embedding are analyzed by comparing the peak signal-to-noise ratio (PSNR).
[0123] Robustness: Evaluate the watermark extraction accuracy under different compression conditions, noise perturbations, and inter-frame interference;
[0124] Bit rate increase: Measuring the impact of watermark embedding on the overall coding rate.
[0125] Meanwhile, before verifying the performance of the watermarking algorithm, the performance of the watermarking preprocessing algorithm was also verified.
[0126] Experiment 1: Watermark preprocessing effect.
[0127] To evaluate the impact of watermark preprocessing strategies on the visual effect of watermarked images and their ability to optimize the amount of embedded data, we selected a set of grayscale watermarked images with a size of M=32 for experimental verification. First, from the perspective of data volume, after preprocessing compression and filtering, the number of bits required for the final embedded video watermark was reduced by approximately 87% compared to the number of bits of grayscale value data in the original grayscale watermarked image. The results show that after processing the watermarked image data, even in video resources with limited frame rates or low resolution, the system can still retain ample embedding space, which is beneficial for maintaining good robustness and flexibility. Secondly, regarding visual quality, we compared and demonstrated the original watermarked image with its preprocessed and reconstructed version, such as... Figure 4 As shown, from a subjective visual perspective, the reconstructed image and the original image show almost no significant difference in structural details and edge contours. This indicates that the preprocessing process has minimal impact on the perceptual quality of the watermarked image, which aligns with the design goals of image preprocessing.
[0128] In summary, this preprocessing scheme effectively compresses the watermark data size without significantly reducing the visual readability of the watermark image. It saves embedding resources while enhancing the system's adaptability and practicality, fully demonstrating the application value of this strategy in actual video watermarking systems.
[0129] Experiment 2: Invisibility assessment.
[0130] To verify the impact of the designed watermark embedding algorithm on video visual quality, this section evaluates the invisibility of the system from two dimensions: subjective visual perception and objective indicators.
[0131] (1) Subjective assessment
[0132] First, let's analyze it from a subjective perspective. This experiment selected a typical test sequence and decoded and played the bitstreams with and without watermarks under the same encoding parameters. The playback results are as follows: Figure 5 As shown, it can be intuitively observed from the playback screen that there are basically no significant differences between the two types of videos in key visual areas such as inter-frame motion, texture details and edge structure. The overall picture is smooth and natural, without obvious noise, blur or artifacts, indicating that the watermark embedding has minimal impact on the visual quality of the original video and has good subjective invisibility.
[0133] (2) Objective assessment
[0134] To further quantify invisibility, this system uses PSNR as an evaluation metric. In this experiment, the PSNR of the watermarked video sequence was calculated using the multimedia video processing tool ffmpeg, and the comparison object was the video sequence after decoding the watermark-free bitstream.
[0135] To verify the effectiveness of the proposed method, this paper selects the FAN method from the prior art section above as a comparison object. This method also implements watermark embedding based on the H.264 compression domain, focusing on the watermark's resistance to recompression. Objective indicators such as PSNR, bit error rate under recompression attacks, and bit growth rate are presented in the experiments, making it comparable. Experimental results show that on multiple standard test sequences, the average PSNR value of this method remains stable at around 37.4–38.8 dB, meaning that the human eye can hardly perceive the difference between the compressed and original images. This indicates that watermark embedding has minimal impact on visual quality, and the video still maintains good invisibility. Furthermore, as shown in Table 1, the proposed method can maintain a higher PSNR in the watermarked video, indicating that the proposed preprocessing and intra-frame mapping embedding strategy effectively improves robustness while still maintaining video quality.
[0136] Table 1 PSNR values
[0137]
[0138] In summary, this system achieved high PSNR values on various test videos, meeting the basic requirement of invisibility for video watermarking and ensuring that the video quality remains close to the original video level after watermark embedding. This demonstrates that the preprocessing and embedding strategy proposed in this paper can achieve robust watermark embedding while maintaining the subjective quality of the video.
[0139] Experiment 3: Robustness assessment.
[0140] (1) Subjective assessment
[0141] After recompressing the video with a quantization parameter (QP) of 23, the extracted watermark image is as follows: Figure 6 As shown.
[0142] As shown in the figure, the watermark image can still be restored well after the video has undergone a recompression attack, which fully demonstrates that the watermark embedding method has good robustness against recompression attacks.
[0143] (2) Objective assessment
[0144] To further evaluate the robustness of watermarks under recompression attacks, this paper calculates the bitrate (BER) of video sequences after they have undergone recompression under the same conditions. Specifically, the watermark information of each keyframe is extracted, concatenated sequentially to form a complete bitstream, and then compared bit-by-bit with the original watermark bitstream to calculate the proportion of erroneous bits.
[0145] To verify the robustness of our proposed method against recompression attacks, we use Fan's method as a reference. Our method first filters candidate sub-macroblocks by frequency domain complexity within the I-frame to avoid distortion introduced by flat macroblocks. Simultaneously, we introduce a logical mapping partition within the frame, uniquely mapping each watermark bit to a fixed spatial group. Combined with 7-4 Hamming codes, we achieve error correction and redundancy checking, effectively mitigating synchronization misalignment caused by macroblock loss or sudden changes in non-zero coefficients.
[0146] Table 2 presents the BER performance of our proposed method and Fan's method under QP=23 recompression conditions. It can be seen that the BER of our proposed method is significantly lower on standard test sequences such as Bus, Stefan, and Foreman. This indicates that the partitioning and redundancy coding strategies of our proposed intra-frame mapping strategy significantly improve robustness, enabling stable and reliable watermark extraction under H.264 recompression attacks.
[0147] Table 2 BER values when QP=23
[0148]
[0149] Furthermore, this experiment tested a more intense recompression attack, specifically by repeatedly encoding the watermarked video under a QP of 28. The experimental results are shown in Table 3. As the compression intensity increases, the overall BER value rises. This result is expected, as under high QP conditions, more high-frequency coefficients are quantized to zero, causing some embedding blocks to fail. However, it is noteworthy that even under this more stringent condition, some sequences still maintain extremely low BER, while the overall watermark extraction accuracy remains good. This indicates that the proposed intra-frame mapping strategy and redundancy check mechanism can effectively maintain high extraction accuracy in most video scenarios. Therefore, the proposed method demonstrates strong robustness under recompression attacks of varying intensities.
[0150] Table 3. BER values when QP=28
[0151]
[0152] Experimental results show that the BER performance of different sequences varies significantly under heavy compression attacks. The "mobile" sequence has the lowest BER value at only 0.001, indicating that the watermark is almost unaffected and the extraction accuracy is near perfect. The "bus" and "stefan" sequences have BER values of 0.031 and 0.074 respectively, remaining at a low level, indicating that the watermark can still be recovered well in moderate motion or textured scenes. The "news" sequence, however, has a BER value of 0.165, higher than the other test sequences, showing that watermark extraction is more susceptible to interference from quantization and compression errors in videos with many flat macroblocks or simple textures.
[0153] Overall, the proposed method maintains good robustness with a BER < 0.1 in most sequences, only exhibiting higher extraction errors under specific video content. This demonstrates that the keyframe intra-frame mapping strategy and redundant coding strategy designed in this paper can effectively improve the synchronization and extraction accuracy of watermarks in recompression attack scenarios.
[0154] Experiment 4: Bit growth rate.
[0155] To evaluate the impact of the proposed watermarking algorithm on video bitstream overhead, this study compared the average bitrate of the bitstream before and after watermarking. Three typical test video sequences—mobile, tempete, and flower—were selected for the experiment. Bitstreams with and without watermarking were generated under the same coding parameters for comparison, and the bitrate increase rate (BIR) was calculated. The results are shown in Table 4.
[0156] Table 4 BIR values
[0157]
[0158] Experimental results show that the bit rate growth rate for different sequences remains at a low level of approximately 0.007-0.014, indicating that the proposed method has minimal impact on compression efficiency while maintaining robustness. The bit rate growth rate of the proposed method on typical test sequences is only about 1%, which is lower than the bit rate increase rate of the corresponding test sequences of the Fan algorithm, demonstrating that the proposed method performs better in bit rate control while maintaining video quality and robustness. Compared with traditional watermarking methods, this study employs a sub-macroblock frequency domain screening and intra-frame group embedding density control strategy, effectively avoiding bit rate spikes caused by excessive modification of flat macroblocks. Furthermore, due to the use of a fixed intra-frame mapping strategy and redundant coding mechanism, the structured features of the watermark embedding do not significantly burden the bitstream growth.
[0159] In this experiment, our method has certain advantages over previous work:
[0160] (1) By dividing the key frame into fixed intraframe macroblock groups and establishing a unique mapping relationship, the problem of extraction misalignment caused by macroblock loss or coefficient mutation is effectively avoided, and the synchronization of watermark embedding and extraction is guaranteed.
[0161] (2) Preprocessing steps such as DCT, quantization and formula transformation are introduced before watermark embedding, which simplifies the watermark data scale and improves the overall embedding efficiency.
[0162] (3) Combining error correction coding with cross-keyframe repeated embedding mechanism enhances the robustness and stability of watermark under recompression attack.
[0163] (4) Fully consider the differences in image complexity to achieve a balance between embedding strength and the impact on video visual effects when embedding watermarks in flat and complex groups;
[0164] (5) It achieves a good balance between synchronization, robustness and embedding efficiency, and has better overall performance than previous works that only focused on one aspect.
[0165] This invention effectively ensures the stability and transparency of the watermark by dividing the keyframe into multiple fixed spatial groups, assigning a unique embedding position to each watermark bit, and controlling the embedding density within each group through non-zero coefficient filtering. Furthermore, by combining cross-frame redundant embedding and majority voting mechanisms, the robustness of the watermark under complex attacks such as high compression and recoding is further improved.
[0166] This invention employs an intra-frame mapping strategy and adaptive embedding, which effectively avoids the problem of watermark embedding failure in texture-flat macroblock groups in traditional methods. It introduces redundant coding and Hamming code error correction mechanisms, enabling the extraction end to stably extract watermark information even under multi-frame perturbation and partial loss. Through cross-frame repetition and majority voting strategies, it further enhances the anti-interference ability of the watermark under different video compression scenarios. While ensuring the robustness of the watermark, it controls the bit rate growth rate at a low level to ensure that the video quality does not significantly degrade.
[0167] Compared to existing technologies, traditional methods typically rely on global watermark embedding locations and lack effective division of intra-frame mapping strategies. This invention, however, significantly improves synchronization and watermark recovery accuracy through intra-frame mapping and multiple redundancy design, multi-frame redundancy, and Hamming code error correction mechanisms. Existing technologies fail to fully integrate these redundancy and error correction strategies.
[0168] The examples described above clearly illustrate instances of the present invention and are intended to better explain the technical concept of the present invention. For those skilled in the art, various changes and modifications can be made based on this specification, and such obvious and reasonable extensions of changes and modifications still fall within the protection scope of the present invention.
Claims
1. An adaptive robust video watermarking method based on H.264 AVC video coding, characterized in that, The main steps include: The first step is data preprocessing, which includes the following steps: The image is converted to grayscale, and the grayscale values are subjected to integer discrete cosine transform and quantization. Then, a zigzag coefficient scan is performed, followed by data formula transformation and 4-bit unsigned binary encoding conversion. Finally, an error correction coding stage is introduced to improve the watermark data recovery capability, so as to retain its semantic recognition capability while compressing the watermark image data size to the greatest extent. The second step is watermark embedding. A deterministic mapping of "macroblock group → bit" is established within the keyframe, and the same information is embedded in a distributed manner at different time points to avoid strong dependence of the embedding result on the state of a certain frame, thereby improving the time redundancy and fault tolerance of the watermark information. Before each sub-macroblock in the frame participates in embedding, it is necessary to calculate its group number based on the position of its macroblock. The embedding target value is then extracted from the corresponding watermark bit sequence based on the number. At the same time, an embedding counting mechanism is maintained within each group to control the embedding strength within that group, so as to avoid structural disturbances caused by excessive load on a single group. The third step is watermark extraction. A decision method based on bit-level majority statistics is introduced to fuse the extraction results of the same watermark line in multiple keyframes. Candidate bits are collected group by group according to the fixed mapping from macroblock number to group number. When a group switch occurs or a termination condition is met, the majority vote within the group is performed to obtain the final output bits of the group. The reconstructed watermark line is the output result of this redundant voting process.
2. The adaptive robust video watermarking method based on H.264 AVC video coding according to claim 1, characterized in that, In the data preprocessing stage, the error correction coding step uses (7,4) Hamming code error correction coding.
3. The adaptive robust video watermarking method based on H.264 AVC video coding according to claim 1, characterized in that, The watermark embedding stage uses an intra-frame mapping scheme based on fixed-interval macroblock division of CIF standard video sequences to standardize the allocation of watermark embedding position and intensity adjustment unit for each frame. To meet the dual requirements of embedding capacity and error correction redundancy, every three consecutive 16*16 macroblocks are divided into a logical embedding mapping group, thereby constructing a total of 132 equally spaced macroblock groups in a frame of image; each group is regarded as a basic embedding unit, corresponding to 1 target bit; this is to simplify data address mapping, thereby improving the stability and consistency of index management during embedding and extraction. A redundant mapping method is used for the macroblock group at the end of the frame, that is, the last two redundant watermark bits are mapped to the macroblock group at the end of the frame. This is to deal with the situation that it may be difficult to divide several macroblocks at the end of the video encoding evenly, thereby ensuring the integrity of the embedded structure and the accuracy of decoding alignment.