Video Watermark Overlay Method, Device, Computer Equipment and Storage Medium

By passing watermark information in multi-process mode of shared memory and superimposing the watermark information with the video stream in an independent process, the problem that the decoding process cannot directly obtain the watermark information, and the stable overlay and efficient playback of video watermarks are achieved.

CN115396742BActive Publication Date: 2025-05-27ZHEJIANG DAHUA SYST ENG
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210810040.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-11
Publication Date
2025-05-27
Estimated Expiration
2042-07-11

AI Technical Summary

Technical Problem

In multi-process mode, the decoding process cannot directly call the callback function to obtain the watermark information, resulting in the video watermark overlay failure.

Method used

The watermark information is transmitted between the first process and the second process through shared memory, and the third process is executed to superimpose the watermark information with the decoded video stream respectively.

Benefits of technology

The independent superposition of watermark information and video stream is realized, improving the stability and user experience of video playback.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115396742B_ABST
    Figure CN115396742B_ABST
Patent Text Reader

Abstract

This application relates to the field of video processing, and in particular, to a method, apparatus, computer device, and storage medium for video watermark overlay, including: executing a first process to set watermark information and write the watermark information into a shared memory; executing a second process to read the watermark information from the shared memory and decode the acquired video stream; executing a third process to overlay the watermark information with the decoded video stream. The present invention realizes the overlay of watermark information and video stream by executing the first process, the second process, and the third process that are independent of each other.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video processing, and in particular to a video watermarking method, device, computer equipment and storage medium. Background Art

[0002] In order to solve the memory bottleneck caused by business expansion and the program stability problems caused by video streaming, video decoding, and video drawing, the security video surveillance platform client separated the video decoding and video drawing processes into independent processes, that is, adjusted from the original single-process mode to a multi-process mode. However, after adopting the multi-process mode, the decoding process is isolated from the main process, and the two have independent address spaces and thread kernel objects. Therefore, the decoding process cannot directly call the callback function to obtain the watermark information. Summary of the invention

[0003] Based on this, it is necessary to provide a video watermark superposition method, device, computer equipment and storage medium to address the above technical problems.

[0004] In a first aspect, an embodiment of the present invention provides a video watermark superimposition method, the method comprising:

[0005] Execute the first process to set watermark information, and write the watermark information into the shared memory;

[0006] Executing a second process to read the watermark information from the shared memory and decode the acquired video stream;

[0007] A third process is executed to superimpose the watermark information with the decoded video stream.

[0008] In one embodiment, executing the first process to set watermark information includes:

[0009] The first process is executed to call the watermark information setting function of the link library, and the watermark information is set using the watermark information setting function.

[0010] In one embodiment, executing the second process to read the watermark information from the shared memory includes:

[0011] The second process is executed to call the watermark information acquisition function of the link library, and the watermark information is read from the shared memory using the watermark information acquisition function.

[0012] In one embodiment, executing the third process to superimpose the watermark information with the decoded video stream includes:

[0013] The third process is executed to call the watermark information drawing function of the link library, and the watermark information is superimposed on the decoded video stream by using the watermark information drawing function.

[0014] In one embodiment, the method further comprises:

[0015] Execute the first process to write the video stream into the shared memory;

[0016] The second process is executed to read the video stream from the shared memory.

[0017] In one embodiment, the method further comprises:

[0018] After the first process and the second process are started, the link library is loaded to obtain the function pointer.

[0019] In one embodiment, the method further comprises:

[0020] The fourth process is executed to detect whether the second process is alive, and if not, the first process is executed to recreate the second process.

[0021] In a second aspect, an embodiment of the present invention provides a video watermark superimposition device, the device comprising:

[0022] A first execution module, used for executing a first process to set watermark information, and writing the watermark information into a shared memory;

[0023] A second execution module, used for executing a second process to read the watermark information from the shared memory and decode the acquired video stream;

[0024] The third execution module is used to execute a third process to superimpose the watermark information with the decoded video stream.

[0025] In a third aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the steps described in the first aspect.

[0026] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the processor implements the steps described in the first aspect when executing the computer program.

[0027] Compared with the prior art, the above method, apparatus, computer equipment and storage medium execute the first process to set watermark information and write the watermark information into the shared memory, execute the second process to read the watermark information from the shared memory and decode the acquired video stream, and execute the third process to superimpose the watermark information with the decoded video stream. Compared with the prior art, the present method uses the shared memory to realize the transmission of watermark information between the first process and the second process, and executes the first process, the second process and the third process independently of each other to realize the superposition of watermark information with the video stream. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1A schematic diagram of the structure of an application environment of a video watermark superimposition method in an embodiment;

[0029] Figure 2 Schematic diagram of the process of a video watermark superimposition method in one embodiment;

[0030] Figure 3 is a flow chart of a video watermark superimposition method in another embodiment;

[0031] Figure 4 A schematic diagram of the overall process of a video watermark superimposition method in an embodiment;

[0032] Figure 5 A schematic diagram of module connections of a video watermark superimposition device in an embodiment;

[0033] Figure 6 Schematic diagram of the structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following is a brief introduction to the drawings required for the description of the embodiments. Obviously, the drawings described below are only some examples or embodiments of the present invention. For ordinary technicians in this field, the present invention can also be applied to other similar scenarios based on these drawings without creative work. Unless it is obvious from the language environment or otherwise explained, the same reference numerals in the figures represent the same structure or operation.

[0035] As shown in the present invention and claims, unless the context clearly indicates an exception, the words "a", "an", "an" and / or "the" do not refer to the singular, but also include the plural. Generally speaking, the terms "include" and "comprise" only indicate the inclusion of the steps and elements that have been clearly identified, and these steps and elements do not constitute an exclusive list, and the method or device may also include other steps or elements.

[0036] Although the present invention makes various references to certain modules in the system according to an embodiment of the present invention, any number of different modules can be used and run on a computing device and / or processor. The modules are only illustrative, and different aspects of the system and method can use different modules.

[0037] It should be understood that when a unit or module is described as being "connected," "coupled" to other units, modules, or blocks, it may refer to being directly connected or coupled, or communicating with other units, modules, or blocks, or there may be intermediate units, modules, or blocks, unless the context clearly indicates otherwise. The term "and / or" as used herein may include any and all combinations of one or more of the associated listed items.

[0038] The video watermarking method provided in this application can be applied to Figure 1 In the application environment shown in the figure, the terminal 102 communicates with the server 104 through the network. The terminal 102 executes the first process to set watermark information, and writes the watermark information and the video stream obtained from the server 104 into the shared memory, executes the second process to read the watermark information from the shared memory and decode the video stream obtained from the shared memory, executes the third process to superimpose the watermark information with the decoded video stream, and the superimposed video stream can be played by executing the second process.

[0039] Terminal 30 includes but is not limited to: cameras, terminals, mobile terminals, PCs, servers, vehicle-mounted equipment, entertainment equipment, advertising equipment, personal digital assistants (PDAs), tablet computers, laptop computers, handheld game consoles, smart glasses, smart watches, wearable devices, virtual display devices or display enhancement devices, etc.

[0040] The network may be or include a public network (e.g., the Internet), a private network (e.g., a local area network (LAN)), a wired network, a wireless network (e.g., an 802.11 network, a Wi-Fi network), a frame relay network, a virtual private network (VPN), a satellite network, a telephone network, a router, a hub, a switch, a server computer, and / or any combination thereof. For example, the network may include a cable network, a wired network, a fiber optic network, a telecommunications network, an intranet, a wireless local area network (WLAN), a metropolitan area network (MAN), a public switched telephone network (PSTN), a Bluetooth network, a ZigBee network, a near field communication (NFC) network, etc., or any combination thereof. In some embodiments, the network may include one or more network access points. For example, the network may include wired and / or wireless network access points such as base stations and / or Internet exchange points.

[0041] In one embodiment, if Figure 2 As shown, a video watermark superposition method is provided, which is applied to Figure 1 The application environment in the example is used to illustrate the following steps:

[0042] S201: Execute a first process to set watermark information, and write the watermark information into a shared memory.

[0043] In this embodiment, the first process refers to the main decoding and playing process, and the first process is mainly used for setting watermark information.

[0044] Specifically, the first process is executed to call the watermark information setting function of the link library, and the watermark information is set by using the watermark information setting function, and the watermark information is written into the shared memory.

[0045] The shared memory refers to a storage space that can be accessed by each process. In this embodiment, although the first process, the second process and the third process are independent of each other, data transmission can be achieved through the shared memory.

[0046] S202: Execute a second process to read the watermark information from the shared memory and decode the acquired video stream.

[0047] In this embodiment, the second process refers to the decoding and playing sub-process, and the second process is mainly used for reading watermark information, decoding video streams, and playing video streams with watermark information superimposed.

[0048] Specifically, the second process is executed to call the watermark information acquisition function of the link library, and the watermark information is read from the shared memory using the watermark information acquisition function.

[0049] S203: Execute a third process to superimpose the watermark information with the decoded video stream.

[0050] In this embodiment, the third process refers to a video rendering thread, and the third process is mainly used for superimposing watermark information with a decoded video stream.

[0051] Specifically, the third process is executed to call the watermark information drawing function of the link library, and the watermark information is superimposed on the decoded video stream by using the watermark information drawing function.

[0052] The superimposed video stream can be played in a specified window by executing a second process.

[0053] Based on the above steps S201-S203, the first process is executed to set the watermark information and write the watermark information into the shared memory, the second process is executed to read the watermark information from the shared memory and decode the acquired video stream, and the third process is executed to superimpose the watermark information with the decoded video stream. Compared with the prior art, the present method uses the shared memory to realize the transmission of the watermark information between the first process and the second process, and executes the first process, the second process, and the third process independently of each other to realize the superposition of the watermark information with the video stream.

[0054] In one embodiment, in addition to using the shared memory to implement the transmission of watermark information between the first process and the second process, the transmission of video streams can also be implemented.

[0055] After receiving the encoded video stream from the network server, the first process is executed and written into the shared memory, and the second process is executed to read the video stream from the shared memory, thereby realizing the transmission of the video stream.

[0056] In one embodiment, after the first process and the second process are started, the link library is loaded to obtain a function pointer, so that the watermark information setting function and the watermark information obtaining function can be called based on the function pointer.

[0057] In one embodiment, if Figure 3 As shown, the method of the present invention further comprises the following steps:

[0058] S204: Execute the fourth process to detect whether the second process is alive, and if not, execute the first process to recreate the second process.

[0059] The fourth process refers to the watchdog subprocess. The first process creates the watchdog subprocess. After the watchdog subprocess is started, the timer is turned on to detect the survival status of the second process. If the second process is not alive, the first process is executed to recreate the second process, thereby avoiding the failure of superimposing watermark information or the failure of playing the video stream, further improving the stability of video playback and improving user experience.

[0060] When the first process exits, the second and fourth processes need to be destroyed first to avoid the emergence of zombie processes.

[0061] The overall flow chart of the video watermarking method is as follows: Figure 4 As shown, first the first process starts, loads the link library, executes the first process to create the fourth process, after the fourth process starts, starts the timer, detects the survival status of the second process, executes the first process to create the second process, and pre-places the second process creation process to avoid the delay problem of video playback caused by dynamically creating the process when it needs to be played. When the second process starts, loads the link library, obtains the function pointer, executes the first process to start playing a certain channel video on a certain window, sets the playback window handle to the second process, and calls the watermark information setting function to set the watermark information at the same time, executes the first process to send the video stream received on the server to the second process, executes the second process to decode the received video stream, and executes the third process to render the decoded video stream to the specified window, executes the second process to call the watermark information acquisition function of the link library, reads the watermark information from the shared memory, executes the third process to superimpose the watermark information with the decoded video stream, and executes the fourth process to detect whether the second process is alive. If so, the first process exits and destroys the second process and the fourth process. If not, notify the first process to recreate the second process.

[0062] In one embodiment, if Figure 5 As shown, the present invention provides a video watermark superimposition device, the device comprising:

[0063] The first execution module 501 is used to execute the first process to set watermark information and write the watermark information into the shared memory;

[0064] A second execution module 502, configured to execute a second process to read the watermark information from the shared memory and decode the acquired video stream;

[0065] The third execution module 503 is used to execute a third process to superimpose the watermark information with the decoded video stream.

[0066] In this embodiment, the first execution module is used to execute the first process to set the watermark information and write the watermark information into the shared memory, the second execution module executes the second process to read the watermark information from the shared memory and decode the acquired video stream, and the third execution module executes the third process to superimpose the watermark information with the decoded video stream. Compared with the prior art, this method uses the shared memory to realize the transmission of watermark information between the first process and the second process, and executes the first process, the second process, and the third process independently of each other to realize the superposition of the watermark information and the video stream.

[0067] In one embodiment, the first execution module executes the first process to call the watermark information setting function of the link library, and uses the watermark information setting function to set the watermark information.

[0068] In one embodiment, the second execution module executes the second process to call the watermark information acquisition function of the link library, and uses the watermark information acquisition function to read the watermark information from the shared memory.

[0069] In one embodiment, the third execution module executes a third process to call a watermark information drawing function of a link library, and uses the watermark information drawing function to superimpose the watermark information with the decoded video stream.

[0070] In one embodiment, the first execution module executes the first process to write the video stream into a shared memory; and the second execution module executes the second process to read the video stream from the shared memory.

[0071] In one embodiment, after the first process and the second process are started, the link library is loaded to obtain the function pointer.

[0072] In one embodiment, it further includes:

[0073] The fourth execution module is used to execute a fourth process to detect whether the second process is alive, and if not, execute the first process to recreate the second process.

[0074] For the specific definition of the video watermark superposition device, please refer to the definition of the video watermark superposition method above, which will not be repeated here. Each module in the above-mentioned video watermark superposition device can be implemented in whole or in part by software, hardware and their combination. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0075] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store motion detection data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in any of the above-mentioned video watermark superimposition method embodiments are implemented.

[0076] Specifically, the video watermark superposition method includes the following steps:

[0077] Execute the first process to set watermark information, and write the watermark information into the shared memory;

[0078] Executing a second process to read the watermark information from the shared memory and decode the acquired video stream;

[0079] A third process is executed to superimpose the watermark information with the decoded video stream.

[0080] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0081] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in any of the above-mentioned video watermark superimposition method embodiments when executing the computer program.

[0082] Specifically, the video watermark superposition method includes the following steps:

[0083] Execute the first process to set watermark information, and write the watermark information into the shared memory;

[0084] Executing a second process to read the watermark information from the shared memory and decode the acquired video stream;

[0085] A third process is executed to superimpose the watermark information with the decoded video stream.

[0086] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in any of the above-mentioned video watermark superimposition method embodiments are implemented.

[0087] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0088] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0089] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for video watermark overlay, characterized in that, the method includes: Execute the first process to create a fourth process, where the fourth process is used to detect whether the second process is alive; if not, execute the first process to create the second process; execute the first process to set watermark information, write the watermark information into shared memory, and send the received video stream to the second process; Execute the second process to read the watermark information from the shared memory and decode the video stream; Execute the third process to render the decoded video stream onto a preset window and overlay the watermark information with the decoded video stream; Execute the fourth process to detect whether the second process is alive, and if so, exit the first process and destroy the second process and the fourth process.

2. The method according to claim 1, characterized in that, the execution of the first process to set watermark information includes: Execute the first process to call the watermark information setting function of the link library and use the watermark information setting function to set watermark information.

3. The method according to claim 1, characterized in that, the execution of the second process to read the watermark information from the shared memory includes: Execute the second process to call the watermark information acquisition function of the link library and use the watermark information acquisition function to read watermark information from the shared memory.

4. The method according to claim 1, characterized in that, the execution of the third process to overlay the watermark information with the decoded video stream includes: Execute the third process to call the watermark information drawing function of the link library and use the watermark information drawing function to overlay the watermark information with the decoded video stream.

5. The method according to claim 1, characterized in that, the method further includes: Execute the first process to write the video stream into shared memory; Execute the second process to read the video stream from the shared memory.

6. The method according to claim 1, characterized in that, the method further includes: After the first process and the second process are started, load the link library to obtain function pointers.

7. A video watermark overlay device, characterized in that, the device includes: A first execution module for executing the first process to create a fourth process, where the fourth process is used to detect whether the second process is alive; if not, execute the first process to create the second process; execute the first process to set watermark information, write the watermark information into shared memory, and send the received video stream to the second process; A second execution module for executing the second process to read the watermark information from the shared memory and decode the video stream; A third execution module for executing the third process to render the decoded video stream onto a preset window and overlay the watermark information with the decoded video stream; execute the fourth process to detect whether the second process is alive, and if so, exit the first process and destroy the second process and the fourth process.

8. A computer device, including a memory and a processor, the memory stores a computer program, characterized in that, when the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Adding method and system of digital visible watermark

    CN106778105A

  • Video image processing method and device

    CN110730355A