Dynamic watermark adding method, system and terminal based on video stream
By decoding in the video stream data and adding dynamic watermarks to each video frame image, the problem of static watermarks being easily removed is solved, and efficient copyright protection of video content is achieved.
Patent Information
- Application Number
- CN202411787197.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-04-01
AI Technical Summary
The static watermark added to the video content in the prior art is easily removed, and cannot effectively prevent the piracy and illegal spread of the video content.
By acquiring the video stream data to be processed, decode it into multiple video frame images, and adding dynamic watermarks to each video frame image for encoding, forming video stream data carrying dynamic watermarks.
Make video streaming data carry dynamic watermarks during playback, improve the security and reliability of watermarks, and effectively enhance the copyright protection capabilities of video content.
Smart Images

Figure CN119743657A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video stream processing, and in particular to a method, system, terminal and computer-readable storage medium for adding dynamic watermarks based on video streams. Background Art
[0002] With the rapid development of the Internet and multimedia technology, the dissemination of video content has become easier and easier. However, this has also brought some problems, such as the piracy and illegal dissemination of video content. In order to protect the copyright of video content, it is usually necessary to add a watermark to the video.
[0003] However, the traditional watermarking method usually adds a static watermark to the video, but this watermark is easy to remove and cannot effectively prevent the piracy and illegal dissemination of video content.
[0004] Therefore, the prior art still needs to be improved and developed. Summary of the invention
[0005] The main purpose of the present invention is to provide a method, system, terminal and computer-readable storage medium for adding dynamic watermarks based on video streams, aiming to solve the problem in the prior art that static watermarks added to video content are easily removed, resulting in the inability to effectively prevent piracy and illegal dissemination of video content.
[0006] To achieve the above object, the present invention provides a method for adding a dynamic watermark based on a video stream, and the method for adding a dynamic watermark based on a video stream comprises the following steps:
[0007] Obtaining video stream data to be processed, and decoding the video stream data to be processed to obtain multiple video frame images;
[0008] Performing dynamic watermark adding processing on the plurality of video frame images to obtain a plurality of dynamic watermark video frame images;
[0009] The plurality of dynamic watermark video frame images are encoded to obtain target dynamic watermark video frame data.
[0010] Optionally, the method for adding dynamic watermark based on video stream, wherein the step of obtaining the video stream data to be processed and decoding the video stream data to be processed to obtain a plurality of video frame images, specifically includes:
[0011] Determine the video stream data to be processed to which a dynamic watermark needs to be added, and read and process the video stream data to be processed frame by frame using a loop calling method to obtain a plurality of frame images and a Boolean value corresponding to each of the frame images;
[0012] It is determined whether the corresponding frame image is successfully decoded according to each of the Boolean values. If the decoding is successful, the successfully decoded frame image is extracted to obtain a plurality of video frame images.
[0013] Optionally, the method for adding dynamic watermarks based on video streams, wherein the step of performing dynamic watermark adding processing on a plurality of video frame images to obtain a plurality of dynamic watermark video frame images, specifically comprises:
[0014] Obtaining time information corresponding to each of the video frame images, and generating dynamic watermark content according to the time information;
[0015] Performing image format conversion processing on the dynamic watermark content to obtain a dynamic watermark image;
[0016] The dynamic watermark image is fused with each corresponding video frame image to obtain multiple dynamic watermark video frame images.
[0017] Optionally, the method for adding dynamic watermarks based on video streams, wherein the step of fusing the dynamic watermark image with each corresponding video frame image to obtain a plurality of dynamic watermark video frame images, specifically includes:
[0018] Acquire a first pixel of the video frame image and a corresponding second pixel of the dynamic watermark image, and calculate a similarity between the first pixel and the second pixel;
[0019] If the similarity is greater than a preset similarity, the dynamic watermark image and the corresponding video frame image are fused in a fusion method based on pixel operation to obtain a plurality of dynamic watermark video frame images.
[0020] Optionally, the method for adding a dynamic watermark based on a video stream, wherein the step of obtaining a first pixel of the video frame image and a corresponding second pixel of the dynamic watermark image, and calculating the similarity between the first pixel and the second pixel, further comprises:
[0021] If the similarity is less than or equal to the preset similarity, the dynamic watermark image and the corresponding video frame image are fused in an image superposition fusion manner to obtain a plurality of dynamic watermark video frame images.
[0022] Optionally, the method for adding dynamic watermarks based on video streams, wherein the fusion process of image superposition is used to fuse the dynamic watermark image and the corresponding video frame image to obtain multiple dynamic watermark video frame images, specifically:
[0023] Each of the dynamic watermark images is superimposed on the corresponding video frame image, and the display position and transparency of each of the dynamic watermark images on the video frame image are set to obtain a plurality of dynamic watermark video frame images.
[0024] Optionally, the method for adding dynamic watermark based on video stream, wherein the encoding process of the plurality of dynamic watermark video frame images to obtain target dynamic watermark video frame data specifically includes:
[0025] Acquire the encoding format of the video stream data to be processed, and perform encoding processing on the plurality of dynamic watermark video frame images according to the encoding format to obtain an image encoding result;
[0026] The encoding process includes image block processing, intra-frame prediction processing, and motion estimation and compensation processing;
[0027] Aggregation processing is performed on the image encoding results to obtain target dynamic watermark video frame data.
[0028] In addition, to achieve the above-mentioned purpose, the present invention further provides a video stream-based dynamic watermark adding system, wherein the video stream-based dynamic watermark adding system comprises:
[0029] A decoding processing module is used to obtain the video stream data to be processed, and decode the video stream data to be processed to obtain multiple video frame images;
[0030] A dynamic watermark adding module, used for performing dynamic watermark adding processing on the plurality of video frame images to obtain a plurality of dynamic watermark video frame images;
[0031] The encoding processing module is used to encode the multiple dynamic watermark video frame images to obtain target dynamic watermark video frame data.
[0032] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a video stream-based dynamic watermark adding program stored in the memory and executable on the processor, wherein the video stream-based dynamic watermark adding program implements the steps of the video stream-based dynamic watermark adding method as described above when executed by the processor.
[0033] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a dynamic watermark adding program based on video stream, and when the dynamic watermark adding program based on video stream is executed by a processor, the steps of the dynamic watermark adding method based on video stream as described above are implemented.
[0034] In the present invention, the video stream data to be processed is obtained, and the video stream data to be processed is decoded to obtain multiple video frame images; the multiple video frame images are subjected to dynamic watermark addition processing to obtain multiple dynamic watermark video frame images; the multiple dynamic watermark video frame images are encoded to obtain target dynamic watermark video frame data. The present invention decodes the video stream data to be processed into multiple video frame images, and adds a corresponding dynamic watermark to each video frame image for encoding, so that the video stream data to be processed can be played in a manner of carrying a dynamic watermark. At the same time, by setting a dynamic watermark, not only the security and reliability of the watermark are effectively increased, but also the copyright protection capability of the video content is effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a flow chart of a preferred embodiment of the method for adding dynamic watermark based on video stream of the present invention;
[0036] Figure 2 It is a structural diagram of a preferred embodiment of a dynamic watermark adding system based on video stream of the present invention;
[0037] Figure 3 It is a structural diagram of a preferred embodiment of the terminal of the present invention. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0039] With the rapid development of the Internet and multimedia technology, the dissemination of video content has become easier and easier. However, this has also brought some problems, such as the piracy and illegal dissemination of video content. In order to protect the copyright of video content, it is usually necessary to add a watermark to the video.
[0040] However, the traditional watermarking method usually adds a static watermark to the video, but this watermark is easy to remove and cannot effectively prevent the piracy and illegal dissemination of video content.
[0041] To solve the above problems, the present invention provides a method for adding dynamic watermarks based on video streams, comprising the following steps: 1. Receiving video stream data; 2. Decoding the video stream data to obtain a video frame image; 3. Adding a dynamic watermark to the video frame image; 4. Encoding the video frame image to which the dynamic watermark is added to obtain video stream data to which the dynamic watermark is added; 5. Outputting the video stream data to which the dynamic watermark is added.
[0042] The method for adding dynamic watermark based on video stream described in the preferred embodiment of the present invention is as follows: Figure 1 As shown, the method for adding dynamic watermark based on video stream includes the following steps:
[0043] Step S10: Obtain the video stream data to be processed, and decode the video stream data to be processed to obtain a plurality of video frame images.
[0044] Video stream decoding refers to decomposing the video stream data to be processed into a set of corresponding frames. The frame division can be selected according to the node sequence of the playback time of the video stream data to be processed, specifically decomposing the video stream data to be processed into the first frame, the second frame, the third frame...the Nth frame.
[0045] The system architecture of the present invention includes a video stream receiving module, a video decoding module, a watermark adding module, a video encoding module and a video stream output module. Among them, the video stream receiving module is used to receive video stream data; the video decoding module is used to decode the video stream data to obtain a video frame image; the watermark adding module is used to add a dynamic watermark to the video frame image; the video encoding module is used to encode the video frame image with the dynamic watermark added to obtain the video stream data with the dynamic watermark added; the video stream output module is used to output the video stream data with the dynamic watermark added.
[0046] After obtaining the video stream to which a dynamic watermark needs to be added through the video stream receiving module, the present invention inputs the video stream into the video decoding module to realize decoding processing of the video stream.
[0047] Specifically, the video stream data to be processed that needs to be added with a dynamic watermark is determined, and the video stream data to be processed is read frame by frame using a loop calling method to obtain multiple frame images and a Boolean value corresponding to each frame image; based on each Boolean value, it is determined whether the corresponding frame image is decoded successfully. If the decoding is successful, the frame image that is decoded successfully is extracted to obtain multiple video frame images.
[0048] First, the video stream receiving module receives the video stream data (ie, the video stream data to be processed in the present invention) and transmits it to the video decoding module. The video decoding module decodes the video stream data to obtain multiple video frame images and transmits them to the watermark adding module.
[0049] For the decoding process of the video stream, the present invention uses the python language (the decoding operation is implemented using a python toolkit, which can obtain each video frame). The OpenCV library automatically decodes when the VideoCapture object reads the video frame. During the decoding process, H264 will be used for decoding internally first. When H264 decoding fails, H265 will be used for decoding. The video stream is read frame by frame by cyclically calling the video_capture.read() method. After reading, a return value will be obtained, wherein the return value includes a Boolean value (indicating whether the frame is successfully read) and the frame image itself (in the form of a NumPy array).
[0050] Step S20: performing dynamic watermark adding processing on the plurality of video frame images to obtain a plurality of dynamic watermark video frame images.
[0051] After the video stream data to be processed is decoded to obtain multiple video frame images, a watermark can be added to each frame image. This watermark is generated in real time according to the time information corresponding to the video frame. The watermark corresponding to each frame is then merged with each frame image to generate a dynamic watermark video frame image.
[0052] The steps of adding a dynamic watermark to a video frame image include: 1. generating a dynamic watermark image; 2. fusing the dynamic watermark image with the video frame image to obtain a video frame image with a dynamic watermark added thereto (ie, the dynamic watermark video frame image in the present invention).
[0053] The steps of generating a dynamic watermark image include: 1. acquiring current time information; 2. generating dynamic watermark content according to the current time information; 3. converting the dynamic watermark content into an image format to obtain a dynamic watermark image.
[0054] Specifically, the time information corresponding to each of the video frame images is obtained, and dynamic watermark content is generated according to the time information; the dynamic watermark content is converted into an image format to obtain a dynamic watermark image; the first pixel of the video frame image and the corresponding second pixel of the dynamic watermark image are obtained, and the similarity between the first pixel and the second pixel is calculated; if the similarity is greater than a preset similarity, the dynamic watermark image and the corresponding video frame image are fused using a fusion method based on pixel operations to obtain multiple dynamic watermark video frame images.
[0055] After obtaining the time information corresponding to each video frame image, the present invention generates the corresponding dynamic watermark content according to the time information. Furthermore, in order to make the dynamic watermark content more closely fit the corresponding video frame image and be able to merge with the video frame image, it is necessary to perform image format conversion processing on the dynamic watermark content to obtain the dynamic watermark image.
[0056] After that, it is necessary to combine the dynamic watermark image with the video frame image. Of course, there are many ways of fusion, such as weighted fusion, image superposition, and pixel-based fusion. Therefore, considering the effect after fusion, the present invention selects the image superposition method and the pixel-based fusion method, and the choice between the image superposition method and the pixel-based fusion method is determined according to the similarity between the dynamic watermark image and the video frame image. In the present invention, it is preferred to set the preset similarity to 70%. If the similarity between the dynamic watermark image and the video frame image is greater than 70%, the pixel-based fusion method is used. If it is less than or equal to 70%, the image superposition method is used for fusion.
[0057] Furthermore, if the similarity is less than or equal to the preset similarity, each of the dynamic watermark images is superimposed on the corresponding video frame image, and the display position and transparency of each of the dynamic watermark images on the video frame image are set to obtain multiple dynamic watermark video frame images.
[0058] Furthermore, the display position and transparency of the dynamic watermark image on the video frame image can also be set according to the display parameters of the video playback device, wherein the display parameters of the video playback device include screen size, resolution and brightness. The display position and transparency of the dynamic watermark image can be adjusted according to these display parameters to improve the presentation effect of the watermark in the playback video stream.
[0059] When adding a watermark to each frame of a video stream, it is necessary to obtain the latest current time (i.e., the time information in the present invention) and generate corresponding watermark content (i.e., the dynamic watermark content in the present invention) to achieve a dynamic update effect, wherein the current time is only for achieving a dynamic effect display, and ultimately the time needs to be converted into text and added to the video stream to generate a new video image.
[0060] For the fusion process of the dynamic watermark image and the corresponding video frame image in the present invention, there can be three fusion methods: 1. Weighted fusion method: specify weights for the watermark image and the video frame image respectively to control the fusion effect. 2. Image overlay method: This method directly overlays the watermark image on the video frame image, and usually sets a threshold to control the display position and transparency of the watermark. 3. Fusion method based on pixel operation: the pixels of the image can be directly traversed, for example, the fusion method can be adjusted according to the brightness value or color channel value of the pixel. In the present invention, the similarity is calculated based on the pixels of the video and the pixels of the watermark image. When the similarity value is greater than 70% (that is, the dynamic watermark video frame image in the present invention presets the similarity, preferably set to 70%), pixel fusion is directly used, and the transparency of the watermark image is reduced. When the similarity is small, image overlay is used.
[0061] Step S30: Encode the multiple dynamic watermark video frame images to obtain target dynamic watermark video frame data.
[0062] After each video frame image is added with a watermark, it is necessary to integrate all the video frame images with the watermarks into a complete video stream. Therefore, a video encoding module is set up in the present invention, and the video encoding module is used to encode the multiple dynamic watermark video frame images to obtain the complete video stream data after the dynamic watermark is added.
[0063] The present invention encodes the video frame image with the dynamic watermark through the video encoding module to obtain the video stream data with the dynamic watermark (i.e. the target dynamic watermark video frame data in the present invention), and transmits it to the video stream output module, and then the video stream output module outputs the video stream data with the dynamic watermark.
[0064] Specifically, the encoding format of the video stream data to be processed is obtained, and the multiple dynamic watermark video frame images are encoded according to the encoding format to obtain image encoding results; wherein the encoding processing includes image block processing, intra-frame prediction processing, and motion estimation and compensation processing; the image encoding results are aggregated to obtain target dynamic watermark video frame data.
[0065] Before encoding the multiple dynamic watermark video frame images, it is necessary to first obtain all the information of the previous video stream including: encoding, format, bit rate and resolution, etc. The format generated during subsequent encoding needs to be filled in according to the previous format.
[0066] In the specific implementation process, the process of encoding multiple dynamic watermark video frame images is as follows: first, determine whether the new video stream encoding is H264 or H265 according to the encoding format of the previous video (for example, if the encoding format of the video stream data to be processed is H264, then when encoding the dynamic watermark video frame image, the encoding format of the dynamic watermark video frame image should also be converted to H264). At the same time, in addition to the need to keep the encoding format consistent, the frame rate, resolution and bit rate of the video stream also need to be consistent with the previous video stream.
[0067] The encoding process is also implemented through the python library. The watermark video, picture and text are passed through parameters and can be changed at will. The specific encoding process is as follows: 1. Image segmentation: Combine the video stream I frame and the watermark video I frame to generate new I frame data, and generate new image macroblocks from the I frame. Macroblocks are the basic processing unit of video encoding. Different encoding standards may have different definitions of macroblock size. For example, the common macroblock size in H264 is 16×16 pixels. 2. Intra-frame prediction: For each macroblock, prediction is made based on the pixel information of adjacent macroblocks. In intra-frame coding, the pixel values of the encoded macroblocks in the same frame are used to predict the pixel values of the current macroblock, and then the difference (residual) between the predicted value and the actual pixel value is calculated. This can reduce the amount of data to be encoded because adjacent macroblocks usually have a certain correlation. 3. Motion estimation and compensation (if inter-frame coding): In video coding, in addition to intra-frame coding, inter-frame coding is also used to utilize the temporal correlation between video frames. For consecutive frames in a video sequence, motion estimation is used to find the best matching position of the current frame macroblock in the reference frame, and then the motion vector is calculated to represent the displacement of the macroblock between frames. Next, the macroblock in the reference frame is compensated according to the motion vector to obtain the predicted current frame macroblock. Finally, the residual between the current frame macroblock and the predicted macroblock is calculated, and the above-mentioned transformation, quantization, and entropy coding operations are performed on the residual. Inter-frame coding can effectively reduce redundant information in the video sequence and improve compression efficiency.
[0068] The macroblock data, motion vector (if it is inter-frame coding), quantization parameter, coding mode and other information processed by the above encoding process are organized in a certain format to form the final encoded video stream data. These steps can be implemented by Python.
[0069] Among them, the dynamic watermark set in the present invention should meet the following conditions: 1. The generation speed of the dynamic watermark should meet the requirements of real-time processing of video streams and should not affect the smoothness of video playback (the method used in the present invention has been tested and the delay is basically within 1 second, which can meet the requirements). 2. The image quality of the dynamic watermark should ensure sufficient clarity and readability without affecting the video viewing experience (the present invention is encoded according to the parameters of the original video, and the image quality is consistent with the previous video stream). 3. The stability and reliability of the system should be guaranteed and can run stably for a long time.
[0070] Beneficial effects of the present invention:
[0071] 1. The dynamic watermark set by the present invention has good stability and is difficult to remove, which can effectively improve the copyright protection capability of video content;
[0072] 2. The dynamic watermark content set by the present invention can change in real time according to time information, which can effectively improve the security and reliability of the watermark;
[0073] 3. The present invention can process video stream data in real time without affecting the smoothness of video playback.
[0074] Furthermore, if Figure 2 As shown, based on the above-mentioned video stream-based dynamic watermark adding method, the present invention also provides a video stream-based dynamic watermark adding system, wherein the video stream-based dynamic watermark adding system includes:
[0075] The decoding processing module 51 is used to obtain the video stream data to be processed, and decode the video stream data to be processed to obtain multiple video frame images;
[0076] A dynamic watermark adding module 52 is used to perform dynamic watermark adding processing on the plurality of video frame images to obtain a plurality of dynamic watermark video frame images;
[0077] The encoding processing module 53 is used to perform encoding processing on the multiple dynamic watermark video frame images to obtain target dynamic watermark video frame data.
[0078] Furthermore, if Figure 3 As shown, based on the above-mentioned method and system for adding dynamic watermark based on video stream, the present invention also provides a terminal accordingly, and the terminal includes a processor 10, a memory 20 and a display 30. Figure 3 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0079] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed in the terminal, such as the program code of the installation terminal. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a dynamic watermark adding program 40 based on video stream is stored on the memory 20, and the dynamic watermark adding program 40 based on video stream can be executed by the processor 10, thereby realizing the dynamic watermark adding method based on video stream in the present application.
[0080] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code or process data stored in the memory 20, such as executing the video stream-based dynamic watermarking method.
[0081] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the terminal and to display a visual user interface.
[0082] In one embodiment, when the processor 10 executes the video stream-based dynamic watermark adding program 40 in the memory 20, the following steps are implemented:
[0083] Obtaining video stream data to be processed, and decoding the video stream data to be processed to obtain multiple video frame images;
[0084] Performing dynamic watermark adding processing on the plurality of video frame images to obtain a plurality of dynamic watermark video frame images;
[0085] The plurality of dynamic watermark video frame images are encoded to obtain target dynamic watermark video frame data.
[0086] The step of obtaining the video stream data to be processed and decoding the video stream data to be processed to obtain a plurality of video frame images specifically includes:
[0087] Determine the video stream data to be processed to which a dynamic watermark needs to be added, and read and process the video stream data to be processed frame by frame using a loop calling method to obtain a plurality of frame images and a Boolean value corresponding to each of the frame images;
[0088] It is determined whether the corresponding frame image is successfully decoded according to each of the Boolean values. If the decoding is successful, the successfully decoded frame image is extracted to obtain a plurality of video frame images.
[0089] The step of performing dynamic watermark adding processing on the plurality of video frame images to obtain a plurality of dynamic watermark video frame images specifically includes:
[0090] Obtaining time information corresponding to each of the video frame images, and generating dynamic watermark content according to the time information;
[0091] Performing image format conversion processing on the dynamic watermark content to obtain a dynamic watermark image;
[0092] The dynamic watermark image is fused with each corresponding video frame image to obtain multiple dynamic watermark video frame images.
[0093] The step of fusing the dynamic watermark image with each corresponding video frame image to obtain a plurality of dynamic watermark video frame images specifically includes:
[0094] Acquire a first pixel of the video frame image and a corresponding second pixel of the dynamic watermark image, and calculate a similarity between the first pixel and the second pixel;
[0095] If the similarity is greater than a preset similarity, the dynamic watermark image and the corresponding video frame image are fused in a fusion method based on pixel operation to obtain a plurality of dynamic watermark video frame images.
[0096] The step of obtaining a first pixel of the video frame image and a corresponding second pixel of the dynamic watermark image, and calculating the similarity between the first pixel and the second pixel, further includes:
[0097] If the similarity is less than or equal to the preset similarity, the dynamic watermark image and the corresponding video frame image are fused in an image superposition fusion manner to obtain a plurality of dynamic watermark video frame images.
[0098] The method of using image superposition to fuse the dynamic watermark image and the corresponding video frame image to obtain multiple dynamic watermark video frame images is as follows:
[0099] Each of the dynamic watermark images is superimposed on the corresponding video frame image, and the display position and transparency of each of the dynamic watermark images on the video frame image are set to obtain a plurality of dynamic watermark video frame images.
[0100] The step of encoding the plurality of dynamic watermark video frame images to obtain target dynamic watermark video frame data specifically includes:
[0101] Acquire the encoding format of the video stream data to be processed, and perform encoding processing on the plurality of dynamic watermark video frame images according to the encoding format to obtain an image encoding result;
[0102] The encoding process includes image block processing, intra-frame prediction processing, and motion estimation and compensation processing;
[0103] Aggregation processing is performed on the image encoding results to obtain target dynamic watermark video frame data.
[0104] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a dynamic watermark adding program based on video stream, and when the dynamic watermark adding program based on video stream is executed by a processor, the steps of the dynamic watermark adding method based on video stream as described above are implemented.
[0105] In summary, the present invention provides a method, system, terminal and computer-readable storage medium for adding dynamic watermarks based on video streams, the method comprising: obtaining video stream data to be processed, and decoding the video stream data to be processed to obtain multiple video frame images; performing dynamic watermark adding processing on the multiple video frame images to obtain multiple dynamic watermark video frame images; encoding the multiple dynamic watermark video frame images to obtain target dynamic watermark video frame data. The present invention decodes the video stream data to be processed into multiple video frame images, and adds a corresponding dynamic watermark to each video frame image for encoding, so that the video stream data to be processed can be played in a manner of carrying a dynamic watermark. At the same time, by setting a dynamic watermark, not only the security and reliability of the watermark are effectively increased, but also the copyright protection capability of the video content is effectively improved.
[0106] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or terminal including the element.
[0107] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the program can be stored in a computer-readable storage medium that can be read by a computer, and the program can include the processes of the above-mentioned method embodiments when executed. The computer-readable storage medium can be a memory, a disk, an optical disk, etc.
[0108] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A method for adding dynamic watermarks based on video streams, characterized in that: The video stream-based dynamic watermark adding method comprises: Obtaining video stream data to be processed, and decoding the video stream data to be processed to obtain multiple video frame images; Performing dynamic watermark adding processing on the plurality of video frame images to obtain a plurality of dynamic watermark video frame images; The plurality of dynamic watermark video frame images are encoded to obtain target dynamic watermark video frame data.
2. The method for adding dynamic watermark based on video stream according to claim 1, characterized in that: The step of obtaining the video stream data to be processed and decoding the video stream data to be processed to obtain a plurality of video frame images specifically includes: Determine the video stream data to be processed to which a dynamic watermark needs to be added, and read and process the video stream data to be processed frame by frame using a loop calling method to obtain a plurality of frame images and a Boolean value corresponding to each of the frame images; It is determined whether the corresponding frame image is successfully decoded according to each of the Boolean values. If the decoding is successful, the successfully decoded frame image is extracted to obtain a plurality of video frame images.
3. The method for adding dynamic watermark based on video stream according to claim 1, characterized in that: The performing dynamic watermark adding processing on the plurality of video frame images to obtain a plurality of dynamic watermark video frame images specifically includes: Obtaining time information corresponding to each of the video frame images, and generating dynamic watermark content according to the time information; Performing image format conversion processing on the dynamic watermark content to obtain a dynamic watermark image; The dynamic watermark image is fused with each corresponding video frame image to obtain multiple dynamic watermark video frame images.
4. The method for adding dynamic watermark based on video stream according to claim 3 is characterized in that: The step of fusing the dynamic watermark image with each corresponding video frame image to obtain a plurality of dynamic watermark video frame images specifically includes: Acquire a first pixel of the video frame image and a corresponding second pixel of the dynamic watermark image, and calculate a similarity between the first pixel and the second pixel; If the similarity is greater than a preset similarity, the dynamic watermark image and the corresponding video frame image are fused using a fusion method based on pixel operation to obtain a plurality of dynamic watermark video frame images.
5. The method for adding dynamic watermark based on video stream according to claim 4 is characterized in that: The step of obtaining a first pixel of the video frame image and a corresponding second pixel of the dynamic watermark image, and calculating a similarity between the first pixel and the second pixel, further includes: If the similarity is less than or equal to the preset similarity, the dynamic watermark image and the corresponding video frame image are fused in an image superposition fusion manner to obtain a plurality of dynamic watermark video frame images.
6. The method for adding dynamic watermark based on video stream according to claim 5, characterized in that: The method of using image superposition to fuse the dynamic watermark image and the corresponding video frame image to obtain multiple dynamic watermark video frame images is specifically as follows: Each of the dynamic watermark images is superimposed on the corresponding video frame image, and the display position and transparency of each of the dynamic watermark images on the video frame image are set to obtain a plurality of dynamic watermark video frame images.
7. The method for adding dynamic watermark based on video stream according to claim 1, characterized in that: The encoding process of the plurality of dynamic watermark video frame images to obtain target dynamic watermark video frame data specifically includes: Acquire the encoding format of the video stream data to be processed, and perform encoding processing on the plurality of dynamic watermark video frame images according to the encoding format to obtain an image encoding result; The encoding process includes image block processing, intra-frame prediction processing, and motion estimation and compensation processing; Aggregation processing is performed on the image encoding results to obtain target dynamic watermark video frame data.
8. A dynamic watermarking system based on video stream, characterized in that: The video stream-based dynamic watermark adding system comprises: A decoding processing module is used to obtain the video stream data to be processed, and decode the video stream data to be processed to obtain multiple video frame images; A dynamic watermark adding module, used for performing dynamic watermark adding processing on the plurality of video frame images to obtain a plurality of dynamic watermark video frame images; The encoding processing module is used to encode the multiple dynamic watermark video frame images to obtain target dynamic watermark video frame data.
9. A terminal, characterized in that: The terminal includes: a memory, a processor, and a video stream-based dynamic watermark adding program stored in the memory and executable on the processor. When the video stream-based dynamic watermark adding program is executed by the processor, the steps of the video stream-based dynamic watermark adding method as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a video stream-based dynamic watermark adding program, and when the video stream-based dynamic watermark adding program is executed by a processor, the steps of the video stream-based dynamic watermark adding method as described in any one of claims 1-7 are implemented.
Citation Information
Patent Citations
Video processing method and device, equipment and storage medium
CN116980619A
Method for adding watermark to video
WO2022083237A1