Watermark adding method and system
Through dynamic selection watermark algorithm and parallel processing technology, the problems of video quality loss and computing resource utilization of traditional watermark methods during high-resolution video processing are solved, and the watermark embedding effect with high efficiency and low latency is achieved.
Patent Information
- Application Number
- CN202411682606.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the field of digital video processing, traditional watermarking methods will lead to video quality loss during high-resolution video processing, and will consume a large amount of computing resources, resulting in delays.
A watermark addition method is proposed, by obtaining the original video stream for preprocessing and decoding, dynamically selecting the LSB or DCT watermark algorithm according to the system load situation, and allocating the watermark content and uncompressed video frames to multiple CPU threads for parallel processing.
It significantly improves the speed of watermark embedding, reduces video quality loss, ensures the system's efficiency and stability, is highly adaptable, and can generate multiple types of watermark content according to different scenarios and needs.
Smart Images

Figure CN119583909A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of watermark generation, and in particular to a watermark adding method and system. Background Art
[0002] In the field of digital video processing, watermarking technology has been widely used in multiple scenarios such as copyright protection, content identification, and information hiding. In the process of watermark embedding, how to effectively embed the watermark content while ensuring the video quality becomes an important technical challenge. Traditional watermarking methods often introduce loss of video quality, especially when processing high-resolution videos. The process of embedding watermarks requires a lot of computing resources and may cause delays in video processing. Therefore, it is particularly important to develop an efficient and low-latency watermarking method.
[0003] At present, watermark algorithms are mainly divided into two categories: time domain and frequency domain. Time domain methods such as the least significant bit (LSB) method are simple and easy to implement, but have limitations in anti-interference and concealment; frequency domain methods such as watermark algorithms based on discrete cosine transform (DCT) can better resist compression and geometric attacks, but have high computational complexity. In order to solve this problem, a dynamic adjustment watermark embedding algorithm is needed to select the appropriate watermark embedding method according to the system load to ensure real-time and high efficiency.
[0004] In addition, with the widespread application of multi-core processors and graphics processing units (GPUs), using parallel computing capabilities to optimize the watermark embedding process and further improve system performance and processing efficiency has become a research focus. Therefore, designing a watermarking method and system that dynamically selects a watermarking algorithm based on system load can effectively improve watermark processing efficiency while ensuring video quality, which has important application value. Summary of the invention
[0005] In view of this, the present invention proposes a watermark adding method and system, which can effectively improve the watermark processing efficiency while ensuring the video quality.
[0006] On the one hand, the present invention provides a watermark adding method, comprising:
[0007] S1: obtain the original video stream, preprocess and decode the original video stream to obtain an uncompressed video frame;
[0008] S2: Generate watermark content to be embedded according to specific scenarios and requirements;
[0009] S3: assigning the generation of watermark content to be embedded and the acquisition of uncompressed video frames to multiple CPU threads for parallel processing;
[0010] S4: judging whether the system is in a high-load state according to the usage rates of the CPU and GPU; if the system is in a high-load state, using an LSB-based watermark algorithm to embed the watermark content into an uncompressed video frame to obtain a video frame to be compressed; if the system is not in a high-load state, using a DCT-based watermark algorithm to embed the watermark content into an uncompressed video frame to obtain a video frame to be compressed;
[0011] S5: compress the video frame to be compressed and output it.
[0012] Furthermore, the specific contents of preprocessing and decoding the original video stream described in S1 are as follows:
[0013] Dynamically adjust the resolution and adaptively adjust the video frame rate of the original video stream to obtain a first video stream;
[0014] The first video stream is decoded to obtain uncompressed video frames, that is, video frames are extracted from the first video stream in real time, and the video frames are divided into uncompressed key frames and uncompressed non-key frames according to the structure of the first video stream.
[0015] Furthermore, the watermark content in S2 includes company name, company logo, copyright statement, timestamp, user information and QR code.
[0016] Furthermore, the specific content of determining whether the system is in a high load state according to the CPU and GPU usage in S4 is:
[0017] Monitor the CPU and GPU usage in real time, perform weighted summation of the CPU and GPU usage to obtain the load index L, and compare the load index L with the set overall load threshold T L To determine whether the system is in a high load state, the formula is:
[0018] L=α·U CPU +β·U GPU ;
[0019] Where L is the load index, α is the first weight factor of the CPU in load determination, β is the second weight factor of the GPU in load determination, and U CPU is the real-time CPU usage, U GPU is the real-time utilization rate of the GPU;
[0020]
[0021] Among them, HighLoad is the high load state, T L is the set overall load threshold; when L ≥ T L When , the system is in a high load state, otherwise, the system is not in a high load state.
[0022] Furthermore, the watermark content is embedded into the uncompressed video frame using the LSB-based watermark algorithm described in S4 to obtain the video frame to be compressed, and the specific content is:
[0023] The watermark content is converted into a binary sequence, and the red component, green component and blue component in the uncompressed video frame are all represented by 8-bit binary. According to the binary sequence, the least significant bits of the red component, green component and blue component are modified one by one, and the modified color information is written back to the uncompressed video frame to obtain the video frame to be compressed.
[0024] Furthermore, the watermark content is embedded into the uncompressed video frame using the DCT-based watermark algorithm described in S4 to obtain the video frame to be compressed, and the specific content is:
[0025] Each frame in the uncompressed video frame is processed into an N*N pixel block, and a DCT transform is performed on each N*N pixel block to obtain a DCT coefficient, that is, converting the time domain data into the frequency domain data, and embedding the watermark content into the DCT coefficient of each pixel block. Then, each pixel block is inversely transformed by DCT, that is, converting the frequency domain data into the time domain data, and each pixel block is combined to obtain the video frame to be compressed.
[0026] Furthermore, it also includes:
[0027] The DCT transformation is performed on each N*N pixel block to obtain the DCT coefficient, and the formula is:
[0028]
[0029] Where f(x,y) is the pixel value of the uncompressed video frame block in row x and column y, F(u,v) is the DCT coefficient, u is the horizontal component in the frequency domain, v is the vertical component in the frequency domain, α(u) is the first normalization coefficient, α(v) is the second normalization coefficient, and N is a constant.
[0030] Furthermore, the watermark content is embedded into the DCT coefficient of each pixel block, and then each pixel block is subjected to inverse DCT transformation, the formula is:
[0031]
[0032] Furthermore, the video frame to be compressed is compressed and outputted in S5, and specifically includes: selecting a corresponding encoding format for the video frame to be compressed and re-compressing it.
[0033] Compared with the prior art, the present invention has the following beneficial effects:
[0034] The watermark adding method of the present invention effectively utilizes computing resources and significantly improves the speed of watermark embedding by allocating watermark content and uncompressed video frames to multiple CPU threads for parallel processing; adds dynamic load management: judges the system load state based on the real-time utilization rate of the CPU and GPU, and flexibly selects the watermark embedding algorithm (LSB or DCT) according to different load conditions, ensuring that the watermark embedding task can be quickly completed under high load conditions, thereby maintaining the efficiency and stability of the system; video quality assurance: effectively reduces the impact of watermark embedding on video quality by selecting a suitable watermark algorithm under different load conditions, ensuring that the video after watermark embedding still maintains high quality and meets the user's demand for visual effects; strong adaptability: the method can generate various types of watermark content according to different scenarios and requirements, such as company names, copyright statements, etc., enhances the flexibility and applicability of watermarks, and is suitable for various video application scenarios; optimizes computing resources: uses DCT transformation to embed watermarks, so that watermarks can be processed in the frequency domain, reduces direct interference with time domain data, optimizes the use of computing resources, and improves the overall performance of the system.
[0035] On the other hand, the present invention also proposes a system for applying the above-mentioned watermark adding method, the system comprising:
[0036] A video processing module, configured to pre-process and decode the original video stream;
[0037] A watermark generation module, configured to generate embedded watermark content according to specific scenarios and requirements;
[0038] An allocation module is configured to allocate the generation of watermark content to be embedded and the acquisition of uncompressed video frames to multiple CPU threads for parallel processing;
[0039] A watermark embedding module is configured to embed the watermark content into the uncompressed video frame using a corresponding watermark algorithm;
[0040] The judgment module is configured to judge whether the system is in a high load state according to the usage rate of the CPU and the GPU, and adjust the watermark algorithm in the watermark embedding module in real time;
[0041] The video output module is configured to re-encode and output the video frames to be compressed.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] The watermark adding system of the present invention is easy to integrate and expand: the watermark adding system has a modular design, which is easy to integrate with the existing video processing system and can be expanded according to future needs, thereby improving the maintainability and upgradeability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0045] Figure 1 A flow chart of a watermark adding method according to an embodiment of the present invention;
[0046] Figure 2 This is a functional framework diagram of a watermark adding method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0047] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art. It should be noted that, in the absence of conflict, the embodiments of the present invention and the features described in the embodiments can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0048] See also Figure 1 As shown, an embodiment of the present invention provides a watermark adding method, comprising:
[0049] S1: Obtain the original video stream, preprocess and decode the original video stream to obtain an uncompressed video frame;
[0050] S2: Generate watermark content to be embedded according to specific scenarios and requirements;
[0051] S3: Assigning the generation of watermark content to be embedded and the acquisition of uncompressed video frames to multiple CPU threads for parallel processing, reducing the waiting time between tasks and improving the overall processing speed of the system;
[0052] S4: According to the CPU and GPU usage rates, determine whether the system is in a high-load state. If the system is in a high-load state, use an LSB (least significant bit)-based watermark algorithm to embed the watermark content into the uncompressed video frame to obtain a video frame to be compressed. If the system is not in a high-load state, use a DCT (discrete cosine transform)-based watermark algorithm to embed the watermark content into the uncompressed video frame to obtain a video frame to be compressed. For computationally intensive tasks such as frequency domain embedding, the high parallelism of the GPU makes it very efficient in processing large-scale frame data.
[0053] S5: compress the video frame to be compressed and output it.
[0054] Furthermore, the specific contents of preprocessing and decoding the original video stream described in S1 are as follows:
[0055] Dynamically adjust the resolution and adaptively adjust the video frame rate of the original video stream to obtain a first video stream;
[0056] The first video stream is decoded to obtain uncompressed video frames, that is, the first video stream is extracted in real time, and the video frames are divided into uncompressed key frames and uncompressed non-key frames according to the structure of the first video stream, and the embedding position of the watermark is determined according to the importance of the frame. Generally, the watermark is embedded in the key frame first to ensure the robustness of the watermark.
[0057] Furthermore, the watermark content in S2 includes company name, company logo, copyright statement, timestamp, user information and QR code.
[0058] Furthermore, the specific content of determining whether the system is in a high load state according to the CPU and GPU usage in S4 is:
[0059] Monitor the CPU and GPU usage in real time, perform weighted summation of the CPU and GPU usage to obtain the load index L, and compare the load index L with the set overall load threshold T L To determine whether the system is in a high load state, the formula is:
[0060] L=α·U CPU +β·U GPU ;
[0061] Where L is the load index, α is the first weight factor of the CPU in load determination, β is the second weight factor of the GPU in load determination, and U CPU is the real-time CPU usage, U GPU is the real-time utilization rate of the GPU;
[0062]
[0063] Among them, HighLoad is the high load state, T L is the set overall load threshold; when L ≥ T L When , the system is in a high load state, otherwise, the system is not in a high load state.
[0064] It should be noted that parallel processing is important in the present invention to improve processing efficiency: multi-task processing, parallel processing can process multiple video frames and watermark data at the same time, which greatly improves the overall processing speed. For example, the video frame can be divided into multiple blocks, which are processed in parallel by different threads or computing units, significantly reducing the processing time;
[0065] Reduce delay: Real-time requirements, delay is a key factor in video stream processing. Through parallel processing, watermark embedding can be completed quickly while ensuring video fluency, thus avoiding freezes or delays during video playback.
[0066] Improve resource utilization: Avoid resource waste. By allocating computing tasks to multiple processing units, some cores or threads can be kept idle, ensuring that system resources are fully utilized and improving computing efficiency. Dynamically adjust task allocation. According to real-time load conditions, task allocation can be dynamically adjusted to balance the load and avoid overloading of individual processing units.
[0067] The importance of judging the system status in the present invention is that intelligent load management: real-time monitoring, by monitoring the CPU and GPU usage, it can be determined whether the system is in a high-load state. This real-time feedback can help the system dynamically adjust the watermark algorithm according to the current load situation and select the most appropriate processing method; automated decision-making, the system can automatically switch to a watermark algorithm with lower computational complexity (such as an LSB-based algorithm) when the load is high, and switch to a more complex algorithm (such as a DCT-based algorithm) when the load is low, ensuring that the system can run efficiently in all situations.
[0068] Optimization algorithm selection:
[0069] Adaptive processing, under different load conditions, selecting the most appropriate algorithm can ensure the effectiveness and stability of the watermark embedding process. Under high load conditions, selecting the LSB algorithm can reduce the demand for computing resources, while using the DCT algorithm under low load can improve the concealment and robustness of the watermark; maintaining performance balance, by monitoring the load status, the system can achieve a balance between performance and quality, ensuring that video quality is not sacrificed under high pressure conditions.
[0070] Ensure system stability: Prevent system crashes. Under high load conditions, avoid using complex watermark algorithms to prevent system crashes due to overload and improve system reliability. Improve user experience by dynamically adjusting to ensure a smooth experience for users when watching videos and reduce user dissatisfaction caused by processing delays.
[0071] Utilize the high parallelism of GPU: GPU is designed to handle a large number of parallel tasks, especially suitable for image and video processing. Through parallel computing and making full use of the parallel processing capabilities of GPU, complex image processing tasks can be completed in a very short time.
[0072] In this embodiment, it is assumed that U CPU =85%, U GPU =65%, T L =75, α=0.6, β=0.4%,
[0073] Calculate the load index L, L = 0.6 * 85 + 0.4 * 65 = 51 + 26 = 77, because L = 77 is greater than T L =75, therefore, the system can be judged to be in a high load state.
[0074] Furthermore, the watermark content is embedded into the uncompressed video frame using the LSB-based watermark algorithm described in S4 to obtain the video frame to be compressed, and the specific content is:
[0075] The watermark content is converted into a binary sequence, and the red component, green component and blue component in the uncompressed video frame are all represented by 8-bit binary. According to the binary sequence, the least significant bits of the red component, green component and blue component are modified one by one, and the modified color information is written back to the uncompressed video frame to obtain the video frame to be compressed.
[0076] It should be noted that the LSB watermark method has low computational complexity and fast processing speed, and is suitable for real-time video processing needs, especially it can still run effectively under high load conditions. Modifying the least significant bit has a very small effect on the color information, which is usually difficult for the human eye to detect, thereby maintaining the overall quality of the video. It is suitable for scenes with high requirements for visual effects. By modifying bit by bit, the watermark content is effectively embedded, making the watermark capacity relatively large and able to embed more information. It is suitable for various types of video content and watermark needs, such as copyright information, logos and other identification information, and enhances the security and recognizability of video content.
[0077] Specifically, in a video frame, the color information of each pixel is usually composed of three 8-bit color channels (red, green, and blue), and the least significant bit of each channel can represent the smallest change in the color component. For example, for an 8-bit number, the least significant bit (LSB) is the 8th bit, which affects the value of 1 unit (such as 0 or 1).
[0078] The basic idea of LSB watermarking algorithm embedding is to embed watermark information (eg, binary sequence) into the least significant bit of each pixel of a video frame. This method can embed the watermark without being detected by the human eye.
[0079] In this embodiment, the embedded watermark content is a string "WM" (which stands for "Water Mark"), and the watermark content is converted into ASCII code and further converted into binary:
[0080] The ASCII code for 'W' is 87, which is represented in binary as 01010111;
[0081] The ASCII code for 'M' is 77, which is represented in binary as 01001101;
[0082] The binary watermark sequence is obtained: 0101011101001101.
[0083] Further, an image or video frame to be embedded with watermark content is selected, assuming that the image or video frame size is H×W, where H is the height and W is the width. The color information of each pixel consists of three channels (R, G, B), and each channel uses 8 bits of binary to represent the color information;
[0084] Get the red component (R), green component (G), and blue component (B) of the pixel (x, y) from the uncompressed video frame.
[0085] Assume the pixel color values are as follows:
[0086] R=11100011; G=11010101; B=10101110;
[0087] Embed the bits of the watermark content into the least significant bit of each color channel one by one. Assuming that the current watermark content has a bit value of 101, embed these three bits into the least significant bit of the R, G, and B channels respectively:
[0088] The least significant bit of R is changed from 1 to 1 (no change), that is, it is still 11100011;
[0089] The least significant bit of G is changed from 1 to 0, becoming 11010100;
[0090] The least significant bit of B changes from 0 to 1, becoming 10101111;
[0091] Finally the modified pixel values are written back to the uncompressed video frame.
[0092] Furthermore, the watermark content is embedded into the uncompressed video frame using the DCT-based watermark algorithm described in S4 to obtain the video frame to be compressed, and the specific content is:
[0093] Each frame in the uncompressed video frame is processed into an N*N pixel block, and a DCT transform is performed on each N*N pixel block to obtain a DCT coefficient, that is, converting the time domain data into the frequency domain data, and embedding the watermark content into the DCT coefficient of each pixel block. Then, each pixel block is inversely transformed by DCT, that is, converting the frequency domain data into the time domain data, and each pixel block is combined to obtain the video frame to be compressed.
[0094] Specifically, the process of dividing the uncompressed video frame into multiple N×N pixel blocks can effectively localize the watermark embedding, thereby reducing the impact on the overall video quality. Each pixel block is relatively independent visually, and the watermark embedding strategy can be adjusted according to the characteristics of each block during processing. This local processing method has the following advantages:
[0095] Reduce visual interference: embedding watermarks in local areas can avoid visual interference of the overall picture, thereby improving the audience's viewing experience;
[0096] Facilitates algorithm optimization: Local processing allows the watermark embedding algorithm to be optimized according to the content characteristics of different blocks (such as texture, color, etc.) to improve the concealment and robustness of the watermark.
[0097] Perform DCT processing on each N×N pixel block to convert time domain data into frequency domain data. DCT can concentrate the energy of image signals into a few low-frequency coefficients. This feature is of great significance for watermark embedding:
[0098] Energy concentration: DCT concentrates most of the information in the coefficients of lower frequencies, so that watermark embedding at these frequencies does not significantly affect the image quality;
[0099] Improve embedding efficiency: The coefficients in the low-frequency region are relatively stable. Modifying these coefficients can maintain high embedding efficiency while ensuring watermark visibility and anti-interference.
[0100] The watermark content is embedded in the DCT coefficients of each pixel block. Usually, it is embedded in the low-frequency area to ensure the anti-interference of the watermark. Since the human eye is more sensitive to low-frequency information, selecting appropriate coefficients for modification can reduce the impact on the visual effect;
[0101] Usually, the first few low-frequency coefficients after DCT transformation are selected for modification. This is because these coefficients have little visual impact on the image, and the human eye is more sensitive to low-frequency information. Proper adjustment of these coefficients can reduce interference with visual effects; since low-frequency information is relatively stable, embedding the watermark in the low-frequency domain can improve its ability to resist compression, noise and other interference, ensuring that the watermark can still be detected under various processing conditions.
[0102] The DCT coefficients after embedding the watermark are inversely transformed, and the frequency domain data is converted back to time domain data to obtain the pixel block with the watermark. The inverse DCT can effectively restore the time domain information of the image and ensure that the processed pixel block is as consistent as possible with the original block visually, thereby enhancing the concealment of the watermark. After each processed pixel block is inversely transformed by DCT, it is combined with other blocks in the original video frame to ensure the consistency and integrity of the video frame.
[0103] All processed pixel blocks are combined into a complete video frame to be compressed. This process ensures the consistency and integrity of the video frame, ensures the natural transition between each pixel block, reduces the block effect, and makes the final video smooth and complete; the video frame to be compressed is prepared for subsequent encoding and compression processing while maintaining high quality, ensuring that the final output video can maintain the watermark effect while having a good compression ratio.
[0104] It should be noted that the DCT-based watermark algorithm embeds the watermark in the frequency domain. First, it can effectively resist attacks such as compression and geometric transformation, and enhance the robustness of the watermark. Secondly, by embedding the watermark in the frequency domain, the impact of the watermark on the quality of the original video can be effectively controlled. The DCT transform can retain important visual information in the low-frequency coefficients, thereby reducing interference visible to the human eye. At the same time, embedding the watermark in the low-frequency area can significantly reduce the possibility of watermark detection and tampering compared to directly embedding in the time domain, improve the concealment of the watermark, and use block processing and DCT transformation methods, which help to make full use of computing resources for parallel processing, thereby improving the efficiency of watermark embedding and meeting the needs of real-time processing. Finally, through an efficient watermark embedding algorithm, not only the video quality is guaranteed, but also the real-time requirements can be met without increasing significant delays, thereby improving the performance of the entire video processing system.
[0105] Furthermore, it also includes:
[0106] The DCT transformation is performed on each N*N pixel block to obtain the DCT coefficient, and the formula is:
[0107]
[0108] Where f(x,y) is the pixel value of the uncompressed video frame block in row x and column y, F(u,v) is the DCT coefficient, u is the horizontal component in the frequency domain, v is the vertical component in the frequency domain, α(u) is the first normalization coefficient, α(v) is the second normalization coefficient, and N is a constant.
[0109] Furthermore, the watermark content is embedded into the DCT coefficient of each pixel block, and then each pixel block is subjected to inverse DCT transformation, the formula is:
[0110]
[0111] Furthermore, the video frame to be compressed is compressed and outputted in S5, and specifically includes: selecting a corresponding encoding format for the video frame to be compressed and re-compressing it.
[0112] See also Figure 2 As shown, the embodiment of the present invention further provides a watermark adding system, including:
[0113] A video processing module, configured to pre-process and decode the original video stream;
[0114] A watermark generation module, configured to generate embedded watermark content according to specific scenarios and requirements;
[0115] An allocation module is configured to allocate the generation of watermark content to be embedded and the acquisition of uncompressed video frames to multiple CPU threads for parallel processing;
[0116] A watermark embedding module is configured to embed the watermark content into the uncompressed video frame using a corresponding watermark algorithm;
[0117] The judgment module is configured to judge whether the system is in a high load state according to the usage rate of the CPU and the GPU, and adjust the watermark algorithm in the watermark embedding module in real time;
[0118] The video output module is configured to re-encode and output the video frames to be compressed.
[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A watermark adding method, characterized in that: include: S1: Obtain the original video stream, preprocess and decode the original video stream to obtain an uncompressed video frame; S2: Generate watermark content to be embedded according to specific scenarios and requirements; S3: assigning the generation of watermark content to be embedded and the acquisition of uncompressed video frames to multiple CPU threads for parallel processing; S4: judging whether the system is in a high-load state according to the usage rates of the CPU and GPU; if the system is in a high-load state, using an LSB-based watermark algorithm to embed the watermark content into an uncompressed video frame to obtain a video frame to be compressed; if the system is not in a high-load state, using a DCT-based watermark algorithm to embed the watermark content into an uncompressed video frame to obtain a video frame to be compressed; S5: compress the video frame to be compressed and output it.
2. A watermark adding method according to claim 1, characterized in that: The specific contents of preprocessing and decoding the original video stream described in S1 are as follows: Dynamically adjust the resolution and adaptively adjust the video frame rate of the original video stream to obtain a first video stream; The first video stream is decoded to obtain uncompressed video frames, that is, video frames are extracted from the first video stream in real time, and the video frames are divided into uncompressed key frames and uncompressed non-key frames according to the structure of the first video stream.
3. A watermark adding method according to claim 2, characterized in that: The watermark content described in S2 includes company name, company logo, copyright statement, timestamp, user information and QR code.
4. A watermark adding method according to claim 3, characterized in that: The specific contents of judging whether the system is in a high load state according to the CPU and GPU usage described in S4 are as follows: Monitor the CPU and GPU usage in real time, perform weighted summation of the CPU and GPU usage to obtain the load index L, and compare the load index L with the set overall load threshold T L To determine whether the system is in a high load state, the formula is: L=α·U CPU +β·U GPU ; Where L is the load index, α is the first weight factor of the CPU in load determination, β is the second weight factor of the GPU in load determination, and U CPU is the real-time CPU usage, U GPU is the real-time utilization rate of the GPU; Among them, HighLoad is the high load state, T L is the set overall load threshold; when L ≥ T L When , the system is in a high load state, otherwise, the system is not in a high load state.
5. A watermark adding method according to claim 4, characterized in that: As described in S4, the watermark content is embedded into the uncompressed video frame using the LSB-based watermark algorithm to obtain the video frame to be compressed. The specific content is: The watermark content is converted into a binary sequence, and the red component, green component and blue component in the uncompressed video frame are all represented by 8-bit binary. According to the binary sequence, the least significant bits of the red component, green component and blue component are modified one by one, and the modified color information is written back to the uncompressed video frame to obtain the video frame to be compressed.
6. A watermark adding method according to claim 5, characterized in that: S4 uses a DCT-based watermark algorithm to embed the watermark content into the uncompressed video frame to obtain the video frame to be compressed. The specific content is: Each frame in the uncompressed video frame is processed into an N*N pixel block, and a DCT transform is performed on each N*N pixel block to obtain a DCT coefficient, that is, converting the time domain data into the frequency domain data, and embedding the watermark content into the DCT coefficient of each pixel block. Then, each pixel block is inversely transformed by DCT, that is, converting the frequency domain data into the time domain data, and each pixel block is combined to obtain the video frame to be compressed.
7. A watermark adding method according to claim 6, characterized in that: Also includes: The DCT transformation is performed on each N*N pixel block to obtain the DCT coefficient, and the formula is: Where f(x,y) is the pixel value of the uncompressed video frame block in row x and column y, F(u,v) is the DCT coefficient, u is the horizontal component in the frequency domain, v is the vertical component in the frequency domain, α(u) is the first normalization coefficient, α(v) is the second normalization coefficient, and N is a constant.
8. A watermark adding method according to claim 7, characterized in that: The watermark content is embedded into the DCT coefficient of each pixel block, and then each pixel block is subjected to inverse DCT transformation. The formula is:
9. A watermark adding method according to claim 8, characterized in that: S5 compresses and outputs the video frame to be compressed, and specifically includes: selecting a corresponding encoding format for the video frame to be compressed and re-compressing it.
10. A watermark adding system, used to implement a watermark adding method according to any one of claims 1 to 9, characterized in that: The system comprises: A video processing module, configured to pre-process and decode the original video stream; A watermark generation module, configured to generate embedded watermark content according to specific scenarios and requirements; An allocation module is configured to allocate the generation of watermark content to be embedded and the acquisition of uncompressed video frames to multiple CPU threads for parallel processing; A watermark embedding module is configured to embed the watermark content into the uncompressed video frame using a corresponding watermark algorithm; The judgment module is configured to judge whether the system is in a high load state according to the usage rate of the CPU and the GPU, and adjust the watermark algorithm in the watermark embedding module in real time; The video output module is configured to re-encode and output the video frames to be compressed.
Citation Information
Patent Citations
Enhanced OMA DRM2.0 video digital copyright management system based on mixed watermark mechanism
CN101262593A
General video digital watermark method
CN101938618A
Method for superposing watermark on yuv frame, and watermark superposing device
CN106507130A
Video source tracing and encryption method based on watermark technology
CN107027055A
Video source tracing method based on watermarking technology
CN107133906A
Cited By
Database watermark processing method and device, storage medium and readable storage medium
CN120974465A
Database watermark processing method and device, storage medium and readable storage medium
CN120974465B