Video tamper-proof embedded watermark method
By adopting an adaptive watermark embedding method based on residual energy and temporal transformation coefficients, the problem of video watermarks being easily destroyed during compression is solved, and the stability and anti-tampering ability of the watermark after video compression are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-23
- Publication Date
- 2026-04-14
AI Technical Summary
Existing video watermarking technologies are easily damaged after multiple compressions, transcodings, and adaptive bitrate adjustments. In particular, watermark information is lost at low bitrates or in situations with drastic scene changes. The lack of an adaptive analysis mechanism leads to insufficient stability.
By using a watermark stability evaluation mechanism based on residual energy frequency region division, time-series transformation coefficient-driven adaptive adjustment of embedding weights, and simulated compression detection feedback, adaptive embedding and stability evaluation of watermarks are achieved in the video compression process.
It improves the stability and anti-tampering capability of watermarks after video compression, ensuring the watermark's integrity and reliability in different encoding processes.
Smart Images

Figure CN121864989A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of video watermarking technology, and more specifically, to a method for embedding watermarks to prevent video tampering. Background Technology
[0002] With the widespread adoption of video content in social media platforms, online education, security monitoring, remote conferencing, and other scenarios, the credibility of video data has gradually become an important concern in the field of content security. As modern video compression coding widely adopts technologies such as block matching, discrete cosine transform, temporal prediction, and loop filtering, the structure of the original video changes significantly before and after compression. Traditional video watermarking technology usually embeds the watermark into spatial pixels or frequency coefficients. However, after multiple compressions, transcodings, adaptive bitrate adjustments, and cross-platform repackaging, the watermark is easily damaged, especially at low bitrates or in cases of drastic scene changes, where the watermark information may even be completely lost.
[0003] The existing technology has the following shortcomings: Currently, existing technologies typically employ watermarking strategies with fixed embedding positions or fixed frequency bands, lacking an adaptive analysis mechanism based on the characteristics of video residual energy and temporal variations. They cannot dynamically adjust according to the sensitivity of different frequency regions to compression, transcoding, and bitrate fluctuations during the actual encoding process, resulting in watermarks being prone to attenuation in regions with high residuals or high temporal fluctuations and insufficient stability under low bitrate encoding. Therefore, a video anti-tampering embedded watermarking method is proposed.
[0004] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] To overcome the aforementioned deficiencies of the prior art, embodiments of the present invention provide a video anti-tampering embedded watermarking method, which solves the problems mentioned in the background art by employing frequency region division based on residual energy, adaptive adjustment of embedding weight driven by time-series transformation coefficients, and a watermark stability evaluation mechanism based on simulated compression detection feedback.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a video anti-tampering embedded watermarking method, comprising the following steps: Step S1: Before the video to be processed is compressed and encoded, the video to be processed is framed to generate video frames, the video frames are divided into different frequency regions, and the residual energy of each frequency region is extracted by the encoder. Step S2: Calculate the temporal transform coefficients of adjacent video frames based on the residual energy, set the embedding weights based on the temporal transform coefficients and enter the pre-analysis mechanism, filter the marked frequency regions according to the embedding weights, and perform simulated watermark embedding on the marked frequency regions. Step S3: After the simulated watermark embedding is completed, simulated compression detection is performed on the video to be processed, watermark information of the marked frequency region is extracted, bitrate data of the marked frequency region is obtained, and the compression rate change ratio is evaluated using the bitrate data. Step S4: Analyze the coding stability based on the watermark information, calculate the compression quality score by fusing the coding stability with the compression ratio change ratio, and determine whether to re-enter the pre-analysis mechanism after adjusting the embedding weights according to the compression quality score.
[0007] In a preferred embodiment, in step S1, the video to be processed is framed to generate each video frame, the sampling time interval is determined according to the preset frame rate, and the video frame corresponding to each sampling moment is extracted from the video to be processed according to the sampling time interval as each video frame of the video to be processed. The frequency domain coefficient matrix of each video frame is obtained by performing a discrete cosine transform on each video frame. The frequency modulus is obtained by sequentially calculating the frequency modulus of each frequency coefficient in the frequency domain coefficient matrix using the frequency modulus method.
[0008] In a preferred embodiment, in step S1, the preset first threshold of the modulus is greater than the preset second threshold of the modulus. If the frequency modulus of the frequency domain coefficient is less than the preset second threshold of the modulus, then the frequency domain coefficient is determined to belong to the low frequency region. If the frequency magnitude of the frequency domain coefficient is greater than or equal to the preset second threshold and less than the preset first threshold, then the frequency domain coefficient is determined to belong to the mid-frequency region. Otherwise, the frequency domain coefficients are determined to belong to the high-frequency region; The prediction frequency domain coefficient matrix of each video frame is obtained by compressing and predicting each video frame through the encoder. The prediction frequency domain coefficient matrix includes each prediction frequency domain coefficient. The residual of the frequency domain coefficients is calculated based on the frequency domain coefficients and the predicted frequency domain coefficients; The residual energy of each frequency region is calculated based on the residual of the frequency domain coefficients corresponding to each frequency region.
[0009] In a preferred embodiment, in step S2, the video frames of the video to be processed are sorted according to the sampling time; The residual energy of the frequency region corresponding to the current video frame is subtracted from the residual energy of the frequency region corresponding to the next adjacent video frame, and the absolute value is used as the temporal transformation coefficient of the frequency region corresponding to the next adjacent video frame. The embedding weights for each frequency region are obtained by standardizing the timing transformation coefficients of each frequency region. If the embedding weight of a frequency region is greater than or equal to a preset weight threshold, the frequency region is determined to be a marked frequency region, and simulated watermark embedding is performed. Conversely, if the frequency region is not the marked frequency region, then it is determined that the frequency region is not the marked frequency region.
[0010] In a preferred embodiment, in step S3, the video to be processed after the simulated watermark embedding is input into the compression encoder for simulated compression detection to obtain the compressed and encoded video to be processed. The compression encoder performs intra-frame compression and inter-frame compression operations according to the preset compression standard, and performs simulated compression processing on the spatial redundancy and temporal redundancy of the video to be processed. The compressed video frame sequence is obtained by decoding and restoring the compressed encoded video. The frequency domain coefficient matrix of each compressed video frame is obtained by sequentially performing discrete cosine transform on the compressed video frame sequence.
[0011] In a preferred embodiment, in step S3, the frequency domain coefficient matrix of each compressed video frame is filtered according to the marked frequency region to obtain the compressed frequency domain coefficients of each marked frequency region. The frequency domain difference sequence of the marked frequency region is obtained by subtracting the frequency domain coefficients of each compressed marked frequency region from the corresponding frequency domain coefficients of the marked frequency region and taking the absolute value. The rate of change of the watermark coefficient in the marked frequency region is calculated by comparing the frequency domain difference value sequence with the corresponding frequency domain coefficients.
[0012] In a preferred embodiment, in step S3, the phase values of the frequency domain coefficients of the marked frequency region and the compressed frequency domain coefficients are calculated to obtain the phase values of the frequency domain coefficients of the marked frequency region and the compressed frequency domain coefficients. The phase offset value of the watermark in the marked frequency region is calculated based on the phase value. The bitrate data before and after compression of each marked frequency region is obtained through a compression encoder. The compression ratio change ratio of each marked frequency region is calculated based on the bitrate data before compression and the bitrate data after compression for each marked frequency region.
[0013] In a preferred embodiment, in step S4, the watermark coefficient change rate and watermark phase offset value of each marked frequency region are standardized to obtain the coefficient change factor and phase offset factor. The coding stability state of each marker frequency region is obtained by calculating the comprehensive coefficient variation factor and the phase offset factor. Compression quality scores for each marked frequency region are calculated by combining the stable state of the encoding with the ratio of compression rate changes. If the compression quality score is greater than or equal to the preset compression quality score threshold, it is determined that the embedding weight will not be adjusted and the pre-analysis mechanism will not be entered. Conversely, if the embedding weights are not adjusted, then the embedding weights will be adjusted.
[0014] In a preferred embodiment, in step S4, for the labeled frequency region of the adjusted embedding weight, the compression quality score is subtracted from the preset compression quality score threshold, and the result of the subtraction is multiplied by the preset adjustment coefficient to obtain the adjustment factor. The adjusted embedding weights are obtained by adding the adjustment factor to the embedding weights. If the adjusted embedding weight is greater than or equal to the preset weight threshold, the marked frequency region is determined to re-enter the pre-analysis mechanism; Conversely, if the marked frequency region is not selected, it will be determined that the region will not be included in the pre-analysis mechanism.
[0015] The technical effects and advantages of this invention are as follows: This invention generates video frames by framing the video before compression encoding and dividing the video frames into different frequency regions. The encoder extracts the residual energy of each frequency region, calculates the temporal transform coefficients of adjacent video frames based on the residual energy, and sets embedding weights based on the temporal transform coefficients. The video then enters a pre-analysis mechanism, where simulated watermark embedding is performed on the marked frequency regions selected by the embedding weights. After simulated watermark embedding, simulated compression detection is performed on the video, extracting watermark information from the marked frequency regions, obtaining bitrate data, and evaluating the compression ratio change ratio using the bitrate data. The encoding stability is analyzed based on the watermark information, and the compression quality score is calculated by fusing the encoding stability and compression ratio change ratio. The embedding weights are then adjusted based on the score, and it is determined whether to re-enter the pre-analysis mechanism. Through framing, frequency region division, and residual energy analysis, the watermark embedding position is adaptively selected. Combined with compression ratio change evaluation, this improves the stability and anti-tampering capability of the watermark after video compression. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating the implementation of a video anti-tampering embedded watermarking method according to the present invention.
[0017] Figure 2 This is a schematic diagram illustrating the steps of a video anti-tampering embedded watermarking method according to the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] This invention generates video frames by framing the video before compression encoding and dividing the video frames into different frequency regions. The encoder extracts the residual energy of each frequency region, calculates the temporal transform coefficients of adjacent video frames based on the residual energy, and sets embedding weights based on the temporal transform coefficients. The video then enters a pre-analysis mechanism, where simulated watermark embedding is performed on the marked frequency regions selected by the embedding weights. After simulated watermark embedding, simulated compression detection is performed on the video to be processed, extracting watermark information from the marked frequency regions, obtaining bitrate data, and evaluating the compression ratio change ratio using the bitrate data. The encoding stability is analyzed based on the watermark information, and the compression quality score is calculated by fusing the encoding stability and compression ratio change ratio. The embedding weights are then adjusted based on the score, and a decision is made whether to re-enter the pre-analysis mechanism. Through framing, frequency region division, and residual energy analysis, the watermark embedding position is adaptively selected.
[0020] Example 1: A video anti-tampering embedded watermarking method, such as... Figures 1 to 2 As shown, it includes the following steps: Step S1: Before the video to be processed is compressed and encoded, the video to be processed is framed to generate video frames, the video frames are divided into different frequency regions, and the residual energy of each frequency region is extracted by the encoder. Step S2: Calculate the temporal transform coefficients of adjacent video frames based on the residual energy, set the embedding weights based on the temporal transform coefficients and enter the pre-analysis mechanism, filter the marked frequency regions according to the embedding weights, and perform simulated watermark embedding on the marked frequency regions. Step S3: After the simulated watermark embedding is completed, simulated compression detection is performed on the video to be processed, watermark information of the marked frequency region is extracted, bitrate data of the marked frequency region is obtained, and the compression rate change ratio is evaluated using the bitrate data. Step S4: Analyze the coding stability based on the watermark information, calculate the compression quality score by fusing the coding stability with the compression ratio change ratio, and determine whether to re-enter the pre-analysis mechanism after adjusting the embedding weights according to the compression quality score.
[0021] The specific implementation is as follows: In step S1, in modern video compression coding systems, there is a high degree of spatial and temporal correlation between video frames. Directly encoding the original pixels not only occupies a lot of storage resources, but also easily leads to inaccurate selection of watermark embedding position, affecting the anti-tampering effect. Therefore, this step aims to extract the residual energy of video frames through frame processing and frequency region division, so as to provide a stable frequency reference for subsequent watermark embedding. The video to be processed is framed to generate individual video frames. The specific framing process is as follows: The sampling time interval is determined based on the preset frame rate, and the sampling time interval is the reciprocal of the preset frame rate; According to the sampling time interval, the video frame corresponding to each sampling moment is extracted from the video to be processed as the video frame of the video to be processed. The frequency domain coefficient matrix of each video frame is obtained by performing a discrete cosine transform on each video frame of the video to be processed. It should be noted that the preset frame rate refers to the standard time interval parameter corresponding to one frame of video that the system pre-sets before performing residual signal extraction, temporal transformation coefficient calculation, and watermark embedding strength adjustment. This parameter is used to unify the temporal reference scale between different video sources and is set according to the frame rate of the video to be processed. If the video to be processed is a high dynamic range video, then the preset frame rate is set to the frame rate of the video to be processed. arrive If the video to be processed is a low dynamic range video, then set the preset frame rate to the frame rate of the video to be processed. arrive The Discrete Cosine Transform (DCT) is a mathematical transformation closely related to the Fourier Transform. It transforms a function with space or time as its independent variable into a function with frequency as its independent variable. Its core feature is that it uses real cosine functions as basis functions to represent the data points of a finite sequence as a weighted sum of cosine oscillations with different frequencies and amplitudes, which is used to obtain the frequency domain coefficient matrix of each video frame.
[0022] The frequency domain coefficient matrix of a video frame in the video to be processed is regarded as a two-dimensional frequency plane. The horizontal index of the frequency domain coefficient matrix of the video frame corresponds to the horizontal frequency component, and the vertical index corresponds to the vertical frequency component. The following operations are performed sequentially on each frequency coefficient in the frequency coefficient matrix of the video frame using the frequency modulus calculation method: Obtain the horizontal and vertical indices of the frequency domain coefficient in the frequency domain coefficient matrix of the video frame; The frequency domain coefficient is summed by squares of its horizontal and vertical indices in the frequency domain coefficient matrix of the video frame, and the result is used to calculate the root to obtain the frequency modulus of the frequency domain coefficient. Repeat the above steps to obtain the frequency modulus of each frequency coefficient in the frequency domain coefficient matrix of each video frame; The frequency magnitude of each frequency domain coefficient is compared with the preset first threshold and the preset second threshold for magnitude to determine its validity. It should be noted that the first preset modulus threshold is greater than the second preset modulus threshold; If the frequency modulus of the frequency domain coefficient is less than the second preset modulus threshold, then the frequency domain coefficient is determined to belong to the low frequency region. If the frequency magnitude of the frequency domain coefficient is greater than or equal to the preset second threshold and less than the preset first threshold, then the frequency domain coefficient is determined to belong to the mid-frequency region. If the frequency magnitude of the frequency domain coefficient is greater than or equal to a preset first threshold value, then the frequency domain coefficient is determined to belong to the high-frequency region. Perform the following operations on the frequency domain coefficient matrix of each video frame using the encoder: The predicted frequency domain coefficient matrix of each video frame is obtained by compressing and predicting each video frame using an encoder. The residual of each frequency coefficient in the frequency coefficient matrix of each video frame is obtained by subtracting the predicted frequency coefficient in the corresponding predicted frequency coefficient matrix. The residual energy of each frequency region in a video frame is obtained by squaring the residuals of the frequency domain coefficients corresponding to each frequency region and taking the average value. Repeat the above steps to obtain the residual energy of each frequency region of each video frame.
[0023] It needs to be explained that the first and second preset modulus thresholds are decision thresholds used to divide the frequency domain coefficients into frequency regions. The maximum range of frequency modulus is determined based on historical data. Frequency modulus values within 15% to 30% of this maximum range are selected as the second preset modulus threshold, and frequency modulus values within 50% to 70% of this maximum range are selected as the first preset modulus threshold. The encoder refers to an algorithm implementation system that follows the video coding standards set by the International Organization for Standardization (ISO), used to compress and predict each video frame to obtain the predicted frequency domain coefficient matrix for each frame. Compression... Prediction is the most critical technology in modern video coding systems. It is the core means of eliminating redundant information in video data. Its basic idea is: instead of directly encoding the original pixel values, it utilizes the high spatial and temporal correlation of the video to predict the part to be encoded based on the already encoded parts, and then only encodes and transmits the difference between the predicted value and the true value. Through frame processing and frequency region division, the frequency residual energy of each video frame is accurately extracted, providing a stable reference for watermark embedding. This ensures the adaptive selection of the watermark embedding position, improves the stability and anti-tampering capability of the watermark in the compressed video, and also takes into account the visual quality of the video.
[0024] In step S2, if the watermark is directly embedded into the residual energy, it is easy to select an unstable region, thereby reducing the watermark retention in the compressed video. Therefore, this step analyzes the frequency region stability of each video frame through time-series transformation coefficients to adaptively determine the marked frequency region. The video frames of the video to be processed are sorted according to the sampling time. The residual energy of the frequency region corresponding to the current video frame is subtracted from the residual energy of the frequency region corresponding to the next adjacent video frame, and the absolute value is used as the temporal transformation coefficient of the frequency region corresponding to the next adjacent video frame. Repeat the above steps to obtain the timing transformation coefficients for each frequency region of each video frame; The embedding weights of each frequency region of each video frame are obtained by standardizing the temporal transform coefficients of each video frame. The embedding weights of each frequency region in each video frame are compared with a preset weight threshold for determination. If the embedding weight of a frequency region is greater than or equal to a preset weight threshold, the frequency region is determined to be a marked frequency region, and simulated watermark embedding is performed. Conversely, if the frequency region is not the marked frequency region, then it is determined that the frequency region is not the marked frequency region. It should be explained that the standardization methods include, but are not limited to, standard linear transformation based on interval scaling, statistical Z-score standardization, or normalization based on nonlinear mapping functions. The specific methods of standardization will not be elaborated upon here. The preset weight threshold is used to filter the embedding weights after the temporal transformation coefficients are standardized. It serves as a fixed benchmark for distinguishing stable and unstable regions. A large number of typical video samples of different types are collected, and the embedding weights for all frequency regions of all video frames are calculated for each sample, forming a weight set. By analyzing the distribution of this set and its correlation with the stability of the video content, a fixed value is selected as the preset weight threshold that ensures most stable regions are selected while most unstable regions are filtered out. For example, in this historical dataset, the 65th highest embedding weight is selected. An empirical value within the range of the 75th percentile; simulated watermark embedding calculation is a virtual evaluation of watermark performance. This process refers to the mathematical model of actual digital watermark embedding, performing mathematical operations such as amplitude perturbation and phase shift on the frequency domain coefficients of the marked frequency region, generating a set of predicted frequency domain coefficient values after simulated embedding. This operation is only calculated in memory and is used in the subsequent simulated compression detection stage. It does not change any data of the original video. Therefore, its output is not the real watermark information, but a data prediction set used to evaluate the effect that a real watermark might produce if it were embedded here. By analyzing the temporal transformation coefficients and standardized embedding weights of each frequency region of the video frame, stable marked frequency regions are accurately selected, providing an adaptive reference for watermark embedding, improving the watermark's retention and anti-tampering ability after video compression, while ensuring that the video visual quality is not affected.
[0025] In step S3, this step quantifies the compression impact on the marked frequency region by simulating compression detection and extracting watermark information. After the simulated watermark is embedded, the video to be processed is input into the compression encoder for simulated compression detection to obtain the compressed and encoded video to be processed. The compression encoder performs intra-frame compression and inter-frame compression operations according to the preset compression standard, and performs simulated compression processing on the spatial redundancy and temporal redundancy of the video to be processed. It should be noted that a compression encoder is an encoding processing unit used to perform compression encoding operations on the video to be processed. Based on a preset video compression standard, it performs encoding processes such as intra-frame prediction, inter-frame prediction, transform, quantization, and entropy coding on the input video frame sequence to reduce data redundancy and generate video data in a compressed encoding format. The preset compression standard refers to a set of reference encoding rules used in simulated compression testing to standardize the compression encoder's compression processing. These include standardized compression parameters such as prediction mode, transform method, quantization parameter range, bitrate constraints, and frame structure. The most frequently occurring parameter combination is selected as the preset standard based on the historical video encoding quality and bitrate change trends.
[0026] Watermark information refers to the raw data actually extracted from the video after simulated embedding and simulated compression, used to evaluate performance, including the rate of change of watermark coefficients and watermark phase offset values in each marked frequency region; The compressed video frame sequence is obtained by decoding and restoring the compressed encoded video. The frequency domain coefficient matrix of each compressed video frame is obtained by sequentially performing discrete cosine transform on the compressed video frame sequence. The frequency domain coefficients of each compressed video frame are obtained by filtering the frequency domain coefficient matrix of each marked frequency region. The frequency domain difference sequence of the marked frequency region is obtained by subtracting the frequency domain coefficients of each compressed marked frequency region from the corresponding frequency domain coefficients of the marked frequency region and taking the absolute value. The rate of change of the watermark coefficient for the marked frequency region is obtained by averaging the ratios of the frequency domain difference value sequence to the corresponding frequency domain coefficients. Repeat the above steps to obtain the rate of change of the watermark coefficient in each marked frequency region; The phase values of each frequency domain coefficient in each marked frequency region and each compressed frequency domain coefficient are calculated to obtain the phase values of each frequency domain coefficient in each marked frequency region and each compressed frequency domain coefficient. The watermark phase offset sequence of the marked frequency region is obtained by subtracting the phase value of each frequency domain coefficient after compression of the marked frequency region from the phase value of the corresponding frequency domain coefficient of the marked frequency region and taking the absolute value. The watermark phase shift value for the marked frequency region is obtained by averaging the ratio of the watermark phase shift sequence to the phase value of the corresponding frequency domain coefficient. Repeat the above steps to obtain the watermark phase offset value for each marked frequency region; The bitrate data before and after compression of each marked frequency region is obtained through a compression encoder. The compression rate change ratio for each marked frequency region is calculated based on the bitrate data before and after compression. The calculation formula is as follows: ,in, For the first Compressed bitrate data for each marked frequency region For the first The uncompressed bitrate data for each marked frequency region For the first The compression ratio change ratio of each marked frequency region; The larger the compressed bitrate data and the smaller the original bitrate data, the greater the increase in bitrate during the compression process relative to the original bitrate in that frequency region, and the greater the change in compression ratio in that frequency region; conversely, the smaller the original bitrate data and the smaller the change in compression ratio in that frequency region. It should be explained that the decoding and restoration operation involves reverse parsing, inverse quantization, inverse transformation, and predictive reconstruction of the compressed bitstream generated by the compression encoder according to a preset compression standard, thereby generating a compressed video frame sequence for watermark information extraction and compression robustness analysis. Phase value calculation involves calculating the phase angle of each frequency domain coefficient after frequency domain transformation of the video frame in complex form, which is used to quantize the phase information of the frequency components and for subsequent watermark phase shift and robustness analysis. Through simulated compression detection, decoding and restoration, and watermark information extraction, the watermark retention rate and phase shift of the marked frequency region are quantified, and combined with compression rate change analysis, a reliable basis is provided for subsequent embedding weight adjustment, improving the stability and anti-tampering capability of the watermark in the video compression process, while ensuring that the video visual quality is not affected.
[0027] In step S4, during the video anti-tampering watermark embedding process, the watermark may be lost or distorted during compression, thereby reducing the anti-tampering capability and embedding stability. Therefore, this step performs quantitative analysis on the watermark information in the marked frequency region, calculates the coding stability and compression quality score, and adaptively adjusts the embedding weight based on the score to ensure the watermark's retention and reliability during compression. The coefficient change rate and phase shift value of the watermark coefficient in each marked frequency region are standardized to obtain the coefficient change factor and phase shift factor. The combined coefficient variation factor and phase offset factor are used to calculate the coding stability of each marker frequency region. The calculation formula is as follows: ,in, For coefficient variation factors, For phase offset factor, The coding stability state of each marker frequency region; It should be noted that the larger the coefficient change factor and the larger the phase offset factor, the lower the coding stability and the smaller the coding stability of the marked frequency region; conversely, the larger the coding stability.
[0028] The stability factor and compression ratio change factor of the coding stability state in each marker frequency region are obtained by standardizing the ratio of the coding stability state to the compression ratio change factor. The compression quality score for each marked frequency region is calculated by combining the steady-state factor and the compressibility variation factor. The calculation formula is as follows: ,in, As the steady-state factor, The compression ratio variation factor Score the compression quality for each marked frequency region; It should be noted that the larger the stability factor and the smaller the compression rate change factor, the higher the watermark retention and coding stability of the marked frequency region during the compression process, the smaller the bit rate change during the compression process, and the higher the compression quality score of the marked frequency region; conversely, the lower the compression quality score of the marked frequency region.
[0029] The compression quality score for each marked frequency region is compared with a preset compression quality score threshold for determination. If the compression quality score of each labeled frequency region is greater than or equal to the preset compression quality score threshold, it is determined that the embedding weight will not be adjusted and the pre-analysis mechanism will not be re-entered. If the compression quality score of each labeled frequency region is less than the preset compression quality score threshold, then it is determined to adjust the embedding weights; The specific adjustment rules are as follows: Subtract the compression quality score of the marked frequency region that needs adjustment from the preset compression quality score threshold, and multiply the result by the preset adjustment coefficient to obtain the adjustment factor; The adjusted embedding weights are obtained by adding the adjustment factor to the embedding weights of the corresponding labeled frequency regions; The adjusted embedding weights are compared with the preset weight thresholds for judgment. If the adjusted embedding weight is greater than or equal to the preset weight threshold, then the marked frequency region needs to re-enter the pre-analysis mechanism. If the adjusted embedding weight is less than the preset weight threshold, then the marked frequency region is determined not to need to re-enter the pre-analysis mechanism.
[0030] It should be explained that the preset compression quality score threshold is a reference value used to determine whether the compression quality score of the marked frequency region meets the embedding requirements. Simulated compression and watermark embedding are performed on a large number of typical video clips, and the distribution of compression quality scores for each marked frequency region is statistically analyzed. The median score covering most high-preservation regions is selected as the preset compression quality score threshold. The preset adjustment coefficient is the proportional coefficient by which the embedding weight is adjusted when the compression quality score of the marked frequency region is lower than the threshold. Marked frequency regions with compression quality scores lower than the threshold are selected from several typical video clips, and the embedding weight is gradually adjusted. Watermark preservation and video visual quality are observed, and the percentage increase in embedding weight when watermark preservation is good and video distortion is acceptable is recorded as the preset adjustment coefficient. Through quantitative analysis of the stable state of the marked frequency region encoding and the compression quality score, the embedding weight can be adaptively adjusted to achieve the watermark's anti-tampering capability during the compression process.
[0031] Finally, it should be noted that in this paper, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0032] Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0033] In this document, the singular forms “a,” “an,” and “the” may also include the plural forms unless the context clearly indicates otherwise. It should also be understood that terms such as “comprising / including” or “having” specify the presence of the stated features, integrals, steps, operations, components, parts, or combinations thereof, but do not preclude the possibility of the presence or addition of one or more other features, integrals, steps, operations, components, parts, or combinations thereof. Meanwhile, the term “and / or” as used in this specification includes any and all combinations of the associated listed items.
[0034] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.
[0035] The above description of the disclosed embodiments will enable those skilled in the art to make or use various modifications to these embodiments. It will be readily apparent to those skilled in the art that the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for embedding watermarks to prevent video tampering, characterized in that: Includes the following steps: Step S1: Before the video to be processed is compressed and encoded, the video to be processed is framed to generate video frames, the video frames are divided into different frequency regions, and the residual energy of each frequency region is extracted by the encoder. Step S2: Calculate the temporal transform coefficients of adjacent video frames based on the residual energy, set the embedding weights based on the temporal transform coefficients and enter the pre-analysis mechanism, filter the marked frequency regions according to the embedding weights, and perform simulated watermark embedding on the marked frequency regions. Step S3: After the simulated watermark embedding is completed, simulated compression detection is performed on the video to be processed, watermark information of the marked frequency region is extracted, bitrate data of the marked frequency region is obtained, and the compression rate change ratio is evaluated using the bitrate data. Step S4: Analyze the coding stability based on the watermark information, calculate the compression quality score by fusing the coding stability with the compression ratio change ratio, and determine whether to re-enter the pre-analysis mechanism after adjusting the embedding weights according to the compression quality score.
2. The video anti-tampering embedded watermarking method according to claim 1, characterized in that: In step S1, the video to be processed is framed to generate each video frame. The sampling time interval is determined according to the preset frame rate. The video frame corresponding to each sampling moment is extracted from the video to be processed according to the sampling time interval as each video frame of the video to be processed. The frequency domain coefficient matrix of each video frame is obtained by performing a discrete cosine transform on each video frame. The frequency modulus is obtained by sequentially calculating the frequency modulus of each frequency coefficient in the frequency domain coefficient matrix using the frequency modulus method.
3. The video anti-tampering embedded watermarking method according to claim 2, characterized in that: In step S1, the preset first threshold of the modulus is greater than the preset second threshold of the modulus. If the frequency modulus of the frequency domain coefficient is less than the preset second threshold of the modulus, then the frequency domain coefficient is determined to belong to the low frequency region. If the frequency magnitude of the frequency domain coefficient is greater than or equal to the preset second threshold and less than the preset first threshold, then the frequency domain coefficient is determined to belong to the mid-frequency region. Otherwise, the frequency domain coefficients are determined to belong to the high-frequency region; The prediction frequency domain coefficient matrix of each video frame is obtained by compressing and predicting each video frame through the encoder. The prediction frequency domain coefficient matrix includes each prediction frequency domain coefficient. The residual of the frequency domain coefficients is calculated based on the frequency domain coefficients and the predicted frequency domain coefficients; The residual energy of each frequency region is calculated based on the residual of the frequency domain coefficients corresponding to each frequency region.
4. The video anti-tampering embedded watermarking method according to claim 3, characterized in that: In step S2, the video frames of the video to be processed are sorted according to the sampling time; The residual energy of the frequency region corresponding to the current video frame is subtracted from the residual energy of the frequency region corresponding to the next adjacent video frame, and the absolute value is used as the temporal transformation coefficient of the frequency region corresponding to the next adjacent video frame. The embedding weights for each frequency region are obtained by standardizing the timing transformation coefficients of each frequency region. If the embedding weight of a frequency region is greater than or equal to a preset weight threshold, the frequency region is determined to be a marked frequency region, and simulated watermark embedding is performed. Conversely, if the frequency region is not the marked frequency region, then it is determined that the frequency region is not the marked frequency region.
5. The video anti-tampering embedded watermarking method according to claim 1, characterized in that: In step S3, the video to be processed after the simulated watermark embedding is input into the compression encoder for simulated compression detection to obtain the compressed and encoded video to be processed. The compression encoder performs intra-frame compression and inter-frame compression operations according to the preset compression standard, and performs simulated compression processing on the spatial redundancy and temporal redundancy of the video to be processed. The compressed video frame sequence is obtained by decoding and restoring the compressed encoded video. The frequency domain coefficient matrix of each compressed video frame is obtained by sequentially performing discrete cosine transform on the compressed video frame sequence.
6. The video anti-tampering embedded watermarking method according to claim 5, characterized in that: In step S3, the frequency domain coefficient matrix of each compressed video frame is filtered according to the marked frequency region to obtain the compressed frequency domain coefficients of each marked frequency region. The frequency domain difference sequence of the marked frequency region is obtained by subtracting the frequency domain coefficients of each compressed marked frequency region from the corresponding frequency domain coefficients of the marked frequency region and taking the absolute value. The rate of change of the watermark coefficient in the marked frequency region is calculated by comparing the frequency domain difference value sequence with the corresponding frequency domain coefficients.
7. The video anti-tampering embedded watermarking method according to claim 6, characterized in that: In step S3, the phase values of the frequency domain coefficients of the marked frequency region and the compressed frequency domain coefficients are calculated to obtain the phase values of the frequency domain coefficients of the marked frequency region and the compressed frequency domain coefficients. The phase offset value of the watermark in the marked frequency region is calculated based on the phase value. The bitrate data before and after compression of each marked frequency region is obtained through a compression encoder. The compression ratio change ratio of each marked frequency region is calculated based on the bitrate data before compression and the bitrate data after compression for each marked frequency region.
8. The video anti-tampering embedded watermarking method according to claim 7, characterized in that: In step S4, the watermark coefficient change rate and watermark phase offset value of each marked frequency region are standardized to obtain the coefficient change factor and phase offset factor. The coding stability state of each marker frequency region is obtained by calculating the comprehensive coefficient variation factor and the phase offset factor. Compression quality scores for each marked frequency region are calculated by combining the stable state of the encoding with the ratio of compression rate changes. If the compression quality score is greater than or equal to the preset compression quality score threshold, it is determined that the embedding weight will not be adjusted and the pre-analysis mechanism will not be entered. Conversely, if the embedding weights are not adjusted, then the embedding weights will be adjusted.
9. The video anti-tampering embedded watermarking method according to claim 8, characterized in that: In step S4, for the labeled frequency region where the embedding weight is adjusted, the compression quality score is subtracted from the preset compression quality score threshold, and the result of the subtraction is multiplied by the preset adjustment coefficient to obtain the adjustment factor. The adjusted embedding weights are obtained by adding the adjustment factor to the embedding weights. If the adjusted embedding weight is greater than or equal to the preset weight threshold, the marked frequency region is determined to re-enter the pre-analysis mechanism; Conversely, if the marked frequency region is not selected, it will be determined that the region will not be included in the pre-analysis mechanism.