Video watermark embedding method and device, equipment, medium and program product
Through the watermark analysis and synthesis module of the hardware abstraction layer, the video frames embedded in the watermark are directly generated and sent, which solves the problem of high power consumption caused by the long process of video watermark embedding in the prior art, and achieves lower power consumption and more efficient video watermark embedding effects.
Patent Information
- Application Number
- CN202311873011.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2025-07-01
AI Technical Summary
The process of video watermark embedding methods in the prior art is too long, resulting in high power consumption of electronic devices and even serious heat generation problems.
Through the watermark analysis and synthesis module of the hardware abstraction layer, the video frames embedded in the watermark are directly generated and sent to the video encoder to shorten the processing flow and reduce the power consumption of electronic devices.
The processing process of video watermark embedding is shortened, the power consumption of electronic devices is reduced, and the heating problem caused by high power consumption is avoided.
Smart Images

Figure CN120238677A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of electronic devices, and in particular, to a method, apparatus, device, medium, and program product for embedding video watermarks. Background Art
[0002] With the continuous development of technology, the multimedia functions (such as video recording) of electronic devices have become an indispensable part of human society. In related technologies, the security of video files can be ensured by embedding watermarks in video files.
[0003] In the method for embedding video watermarks in related technologies, after an application program (Application, abbreviated as APP) in the application layer obtains the usage permission of the camera, it applies to the kernel layer for video frames through the framework layer and the hardware abstraction layer, and embeds watermarks in each video frame. Then, the video frames with embedded watermarks are sent back to the hardware abstraction layer through the framework layer for video encoding, and the encoded video files with embedded watermarks are saved.
[0004] However, the method for embedding video watermarks in related technologies has the problem of too long processing flow, which in turn leads to high power consumption of electronic devices and even serious overheating of electronic devices. Summary of the Invention
[0005] Embodiments of this application provide a method, apparatus, device, medium, and program product for embedding video watermarks, which can shorten the processing flow and thus reduce the power consumption of electronic devices.
[0006] In a first aspect, embodiments of this application provide a method for embedding video watermarks, including:
[0007] The application program in the application layer calls the camera interface and sends a video recording request to the camera service in the framework layer;
[0008] The camera service in the framework layer forwards the video recording request to the camera kernel driver in the kernel layer through the camera hardware abstraction layer in the hardware abstraction layer;
[0009] The camera kernel driver in the kernel layer responds to the video recording request, controls the camera to record video to obtain video frames, and sends the video frames to the watermark parsing and synthesis module in the hardware abstraction layer through the camera hardware abstraction layer in the hardware abstraction layer;
[0010] The watermark parsing and synthesis module in the hardware abstraction layer generates video frames with embedded watermarks according to the video frames and the watermark resource file placed in the framework layer, and sends the video frames with embedded watermarks to the video encoder in the hardware abstraction layer;
[0011] The video encoder in the hardware abstraction layer generates a video file in the target format according to the video frames with embedded watermarks and performs a saving process.
[0012] In one implementation, it further includes:
[0013] The application program at the application layer generates a watermark resource file according to the obtained watermark requirement information;
[0014] The application program at the application layer places the watermark resource file in the framework layer.
[0015] In one implementation, the watermark requirement information includes: watermark size, watermark position, and watermark content.
[0016] In one implementation, the watermark resource file includes a configuration file and a watermark file; the configuration file includes the watermark position and the watermark size;
[0017] The watermark parsing and synthesis module at the hardware abstraction layer generates a video frame with an embedded watermark according to the video frame and the watermark resource file placed in the framework layer, including:
[0018] The watermark parsing and synthesis module at the hardware abstraction layer generates a video frame with an embedded watermark according to the watermark position, the watermark size, the watermark file, and the video frame.
[0019] In one implementation, the application program at the application layer generates a watermark resource file according to the obtained watermark requirement information, including:
[0020] The application program at the application layer generates a watermark resource file according to the obtained watermark requirement information and the obtained resolution.
[0021] In a second aspect, an embodiment of the present application provides a video watermark embedding device, including:
[0022] The application program at the application layer is used to call the camera interface and send a video recording request to the camera service in the framework layer;
[0023] The camera service in the framework layer is used to forward the video recording request to the camera kernel driver in the kernel layer through the camera hardware abstraction layer in the hardware abstraction layer;
[0024] The camera kernel driver in the kernel layer is used to respond to the video recording request, control the camera to record video to obtain a video frame, and send the video frame to the watermark parsing and synthesis module in the hardware abstraction layer through the camera hardware abstraction layer in the hardware abstraction layer;
[0025] The watermark parsing and synthesis module in the hardware abstraction layer is used to generate a video frame with an embedded watermark according to the video frame and the watermark resource file placed in the framework layer, and send the video frame with the embedded watermark to the video encoder in the hardware abstraction layer;
[0026] A video encoder in the hardware abstraction layer is used to generate a video file in a target format based on a video frame embedded with a watermark and perform a saving process.
[0027] In one implementation,
[0028] An application program in the application layer is further used to generate a watermark resource file according to the obtained watermark requirement information;
[0029] An application program in the application layer is further used to place the watermark resource file in the framework layer.
[0030] In one implementation, the watermark requirement information includes: watermark size, watermark position, and watermark content.
[0031] In one implementation, the watermark resource file includes a configuration file and a watermark file; the configuration file includes the watermark position and the watermark size;
[0032] The watermark parsing and synthesis module in the hardware abstraction layer is specifically used for:
[0033] Generating a video frame embedded with a watermark according to the watermark position, watermark size, watermark file, and video frame.
[0034] In one implementation, the application program in the application layer is specifically used for:
[0035] Generating a watermark resource file according to the obtained watermark requirement information and the obtained resolution.
[0036] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0037] A processor, and a memory communicatively connected to the processor;
[0038] The memory stores computer-executable instructions;
[0039] The processor executes the computer-executable instructions stored in the memory to implement the video watermark embedding method in the first aspect.
[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the video watermark embedding method in the first aspect.
[0041] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it is used to implement the video watermark embedding method in the first aspect.
[0042] An embodiment of the present application provides a method, device, equipment, medium, and program product for embedding video watermarks. In this embodiment, an application program at the application layer calls the camera interface and sends a video recording request to the camera service at the framework layer. The camera service at the framework layer forwards the video recording request to the camera kernel driver at the kernel layer through the camera hardware abstraction layer at the hardware abstraction layer. In response to the video recording request, the camera kernel driver at the kernel layer controls the camera to record video to obtain video frames, and sends the video frames to the watermark parsing and synthesis module at the hardware abstraction layer through the camera hardware abstraction layer at the hardware abstraction layer. The watermark parsing and synthesis module at the hardware abstraction layer generates video frames with embedded watermarks based on the video frames and the watermark resource file placed in the framework layer, and sends the video frames with embedded watermarks to the video encoder at the hardware abstraction layer. The video encoder at the hardware abstraction layer generates a video file in the target format based on the video frames with embedded watermarks and performs a save process. Compared with the related art, in which the application program at the application layer executes the process of embedding video watermarks and, after the embedding is completed, sends it back to the video encoder at the hardware abstraction layer for encoding, resulting in a long processing flow for the method of embedding video watermarks and thus a high power consumption problem in the electronic device, in the embodiment of the present application, the watermark parsing and synthesis module at the hardware abstraction layer executes the process of embedding video watermarks, and then directly sends the video frames with embedded watermarks to the video encoder at the hardware abstraction layer by the watermark parsing and synthesis module at the hardware abstraction layer, shortening the processing flow and thus reducing the power consumption of the electronic device. Description of the Drawings
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the following will briefly introduce the drawings required for use in the description of the embodiments or the related art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0044] Figure 1 Schematic diagram of the scenario for the method of embedding video watermarks in the related art;
[0045] Figure 2 Software framework diagram of a method for embedding video watermarks provided by an embodiment of the present application;
[0046] Figure 3a Flow chart of the first embodiment of a method for embedding video watermarks provided by an embodiment of the present application;
[0047] Figure 3b Schematic diagram of the scenario for a method for embedding video watermarks provided by an embodiment of the present application;
[0048] Figure 4aSchematic flowchart of Embodiment 2 of a video watermark embedding method provided by an embodiment of the present application;
[0049] Figure 4b Schematic diagram of generating a video frame with an embedded watermark provided by an embodiment of the present application;
[0050] Figure 5 Schematic diagram of the structure of an electronic device provided by the present application. Detailed implementation manners
[0051] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art under the inspiration of this embodiment fall within the protection scope of the present application.
[0052] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above accompanying drawings are used to distinguish similar objects and do not necessarily need to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments of the present application described here can be implemented in an order different from those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0053] With the continuous development of technology, the multimedia functions (such as video recording) of electronic devices have become an indispensable part of human society. In related technologies, the security of video files can be ensured by embedding watermarks in video files.
[0054] First, the video watermark embedding method in related technologies will be described.
[0055] Figure 1 Scenario schematic diagram of the video watermark embedding method in related technologies.
[0056] Such as Figure 1As shown, the operating system of the electronic device includes an Application Layer, a Framework Layer, a Hardware Abstraction Layer (HAL for short), and a Kernel Layer.
[0057] The Application Layer may include a series of applications (APP for short). For example, the applications may include camera, short video, gallery, chat, call, map, navigation, Bluetooth, music, conference, short message and other applications. Exemplarily, Figure 1 An application is shown.
[0058] The Framework Layer provides application programming interfaces (API for short) and programming frameworks for the applications in the Application Layer. The application framework layer includes some predefined functions. The Framework Layer may include camera server, windows manager service (WMS for short), view system, graphics system, display engine service, resource manager, notification manager, etc. Among them, the camera server is the core process module of the camera framework, mainly providing API interface functions to the Application Layer, and calling the camera hardware abstraction layer of the Hardware Abstraction Layer in the way of HIDL (hardware interface definition language) downward. Exemplarily, Figure 1 The camera interface, camera service, and media codec API are shown.
[0059] The Hardware Abstraction Layer is the encapsulation of hardware drivers, providing a unified general interface for hardware capabilities to the upper layer. The Hardware Abstraction Layer includes CPU HAL, GPU HAL, sensor HAL, display HAL, camera HAL, etc. In addition, the Hardware Abstraction Layer may also include a video encoder. Exemplarily, Figure 1 The camera hardware abstraction layer and the video encoder are shown.
[0060] The Kernel Layer is the layer between hardware and software. The Kernel Layer at least includes CPU driver, GPU driver, display driver, sensor driver, camera kernel driver, etc. Exemplarily, Figure 1 The camera kernel driver is shown.
[0061] In the related art, an application in the application layer (such as a short video application) can send a video frame application request to the camera service (camera server) in the framework layer by calling a camera interface (such as the Android Camera API 2).
[0062] The camera service in the framework layer sends a video frame application request to the camera hardware abstraction layer (Camera HAL) in the hardware abstraction layer.
[0063] The camera hardware abstraction layer in the hardware abstraction layer sends a video frame application request to the camera kernel driver in the kernel layer.
[0064] The camera kernel driver in the kernel layer can send a video frame to the camera hardware abstraction layer in the hardware abstraction layer.
[0065] After receiving the video frame, the camera hardware abstraction layer in the hardware abstraction layer sends the video frame to the camera service in the framework layer.
[0066] The camera service in the framework layer sends the video frame to the application in the application layer through the camera interface.
[0067] After receiving the video frame, the application in the application layer generates a video frame with an embedded watermark based on the video frame and watermark data.
[0068] After generating the video frame, the application in the application layer can send the video frame with the embedded watermark to the video encoder in the hardware abstraction layer by calling the media codec API in the framework layer.
[0069] The video encoder in the hardware abstraction layer generates a video file in the target format based on the video frame with the embedded watermark and performs a save process.
[0070] However, the method for embedding video watermarks in the related art has the problem of a too long processing flow, which in turn leads to a high power consumption problem of the electronic device and even causes the electronic device to overheat severely.
[0071] Based on the above technical problems, the embodiments of the present application provide a method for embedding a video watermark, which can generate a video frame with an embedded watermark according to a watermark resource file and a video frame through a watermark parsing and synthesis module in the hardware abstraction layer, thereby shortening the processing flow and reducing the power consumption of the electronic device.
[0072] The following details the video watermark embedding solution of the embodiments of the present application.
[0073] Figure 2 It is a software framework diagram of a method for embedding a video watermark provided by the embodiments of the present application.
[0074] AsFigure 2 As shown in Figure 2 , the operating system of the electronic device includes an Application Layer, a Framework Layer, a Hardware Abstraction Layer (HAL for short), and a Kernel Layer.
[0075] The Application Layer includes application programs.
[0076] The Framework Layer includes a camera interface (such as the Android Camera API 2) and a camera server. The Framework Layer also stores watermark resource files.
[0077] The Hardware Abstraction Layer includes a camera hardware abstraction layer, a watermark parsing and synthesis module, and a video encoder.
[0078] The Kernel Layer includes a camera kernel driver.
[0079] Next, the technical solution of the present application will be described in detail through specific embodiments. It should be noted that these specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
[0080] Figure 3a FIG. Figure 3a is a schematic flowchart of Embodiment 1 of a method for embedding a video watermark provided by an embodiment of the present application. Refer to Figure 3a Figure 3a , and the method specifically includes the following steps:
[0081] S301: The application program in the Application Layer calls the camera interface and sends a video recording request to the camera server in the Framework Layer.
[0082] In this embodiment, when the application program in the Application Layer obtains the video recording request information input by the user, it can generate a video recording request, call the camera interface in the Framework Layer, and send the video recording request to the camera server in the Framework Layer. Among them, the video recording request is used to apply to open the camera for video recording.
[0083] S302: The camera server in the Framework Layer forwards the video recording request to the camera kernel driver in the Kernel Layer through the camera hardware abstraction layer in the Hardware Abstraction Layer.
[0084] In this embodiment, after obtaining the video recording request, the camera server in the Framework Layer can forward the video recording request to the camera hardware abstraction layer in the Hardware Abstraction Layer.
[0085] After obtaining the video recording request, the camera hardware abstraction layer in the Hardware Abstraction Layer can forward the video recording request to the camera kernel driver in the Kernel Layer.
[0086] S303: In response to a video recording request, the camera kernel driver in the kernel layer controls the camera to record video to obtain video frames, and sends the video frames to the watermark parsing and synthesis module in the hardware abstraction layer through the camera hardware abstraction layer in the hardware abstraction layer.
[0087] In this embodiment, in response to receiving a video recording request, the camera kernel driver in the kernel layer can control the camera to record video to obtain video frames. It should be noted that the video frames can be video frames in YUV format. YUV is a video format represented by a luminance component (Y component) and chrominance components (U component and V component). Additionally, the two chrominance components can also be represented by Cb component and Cr component, and YUV has a compression function and supports three different compression formats: 420, 422, and 444.
[0088] After obtaining the video frames, the camera kernel driver in the kernel layer can send the video frames to the camera hardware abstraction layer in the hardware abstraction layer.
[0089] After obtaining the video frames, the camera hardware abstraction layer in the hardware abstraction layer can forward the video frames to the watermark parsing and synthesis module in the hardware abstraction layer.
[0090] S304: The watermark parsing and synthesis module in the hardware abstraction layer generates video frames with embedded watermarks based on the video frames and the watermark resource file placed in the framework layer, and sends the video frames with embedded watermarks to the video encoder in the hardware abstraction layer.
[0091] In this embodiment, a video resource file is placed in the framework layer.
[0092] The watermark parsing and synthesis module in the hardware abstraction layer can obtain the watermark resource file placed in the framework layer. The watermark parsing and synthesis module in the hardware abstraction layer can generate video frames with embedded watermarks based on the video frames and the watermark resource file. After generating the video frames with embedded watermarks, the watermark parsing and synthesis module in the hardware abstraction layer can send the video frames with embedded watermarks to the video encoder in the hardware abstraction layer.
[0093] It should be noted that in the case where the hardware abstraction layer includes an algorithm module, the watermark parsing and synthesis module can be integrated with the algorithm module. That is to say, the watermark parsing and synthesis module and the algorithm module are integrated into one module. This module can directly generate video frames with embedded watermarks based on the processed video frames and the watermark resource file in the framework layer after performing algorithm processing on the video frames. Through this method, it is possible to avoid introducing memory copies and reduce system overhead.
[0094] It should also be noted that in the case where the hardware abstraction layer does not include the algorithm module, the watermark parsing and synthesis module can exist as a separate module in the hardware abstraction layer. After obtaining the video frame sent by the camera hardware abstraction layer, the watermark parsing and synthesis module can directly generate a video frame with an embedded watermark based on the video frame and the watermark resource file in the framework layer.
[0095] S305: The video encoder in the hardware abstraction layer generates a video file in the target format based on the video frame with the embedded watermark and performs a save process.
[0096] In this embodiment, the video encoder in the hardware abstraction layer can generate a video file in the target format after obtaining the video frame with the embedded watermark and perform a save process.
[0097] Specifically, the video encoder in the hardware abstraction layer can generate a video file in the target format based on multiple video frames with embedded watermarks and perform a save process.
[0098] For example, the video encoder in the hardware abstraction layer can encode multiple video frames with embedded watermarks in the YUV format into a video file in the Moving Picture Experts Group 4 (abbreviated as MP4) format and perform a save process.
[0099] Figure 3b It is a schematic diagram of the scenario of a method for embedding a video watermark provided by an embodiment of the present application.
[0100] As Figure 3b shown, the application in the application layer calls the camera interface and sends a video recording request to the camera service in the framework layer. The application in the application layer generates a watermark resource file according to the obtained watermark requirement information and the obtained resolution. The application in the application layer places the watermark resource file in the framework layer. The camera service in the framework layer forwards the video recording request to the camera hardware abstraction layer in the hardware abstraction layer. The camera hardware abstraction layer in the hardware abstraction layer forwards the video recording request to the camera kernel driver in the kernel layer. In response to the video recording request, the camera kernel driver in the kernel layer controls the camera to record video to obtain a video frame and sends the video frame to the camera hardware abstraction layer in the hardware abstraction layer. The camera hardware abstraction layer in the hardware abstraction layer forwards the video frame to the watermark parsing and synthesis module in the hardware abstraction layer. The watermark parsing and synthesis module in the hardware abstraction layer generates a video frame with an embedded watermark according to the watermark resource file placed in the framework layer and the obtained video frame. The watermark parsing and synthesis module in the hardware abstraction layer sends the video frame with the embedded watermark to the video encoder in the hardware abstraction layer. The video encoder in the hardware abstraction layer generates a video file in the target format based on the video frame with the embedded watermark and performs a save process.
[0101] Beneficial effects of this embodiment: In this embodiment, an application in the application layer calls the camera interface to send a video recording request to the camera service in the framework layer. The camera service in the framework layer forwards the video recording request to the camera kernel driver in the kernel layer through the camera hardware abstraction layer in the hardware abstraction layer. The camera kernel driver in the kernel layer responds to the video recording request, controls the camera to record video to obtain video frames, and sends the video frames to the watermark parsing and synthesis module in the hardware abstraction layer through the camera hardware abstraction layer in the hardware abstraction layer. The watermark parsing and synthesis module in the hardware abstraction layer generates video frames with embedded watermarks based on the video frames and the watermark resource file placed in the framework layer, and sends the video frames with embedded watermarks to the video encoder in the hardware abstraction layer. The video encoder in the hardware abstraction layer generates a video file in the target format based on the video frames with embedded watermarks and performs a save process. Compared with the related art, in which the application in the application layer executes the process of embedding video watermarks and, after the embedding is completed, sends it back to the video encoder in the hardware abstraction layer for encoding, resulting in a long processing flow for the method of embedding video watermarks and thus a high power consumption problem for the electronic device, in the embodiment of the present application, the watermark parsing and synthesis module in the hardware abstraction layer executes the process of embedding video watermarks, and then the watermark parsing and synthesis module in the hardware abstraction layer directly sends the video frames with embedded watermarks to the video encoder in the hardware abstraction layer, shortening the processing flow and thus reducing the power consumption of the electronic device.
[0102] Figure 4a It is a schematic flowchart of Embodiment 2 of a method for embedding video watermarks provided by an embodiment of the present application. Refer to Figure 4a , the method specifically includes the following steps:
[0103] S401: An application in the application layer calls the camera interface to send a video recording request to the camera service in the framework layer.
[0104] In this embodiment, an application in the application layer can call the camera interface to send a video recording request to the camera service in the framework layer.
[0105] S402: The application in the application layer generates a watermark resource file according to the obtained watermark requirement information.
[0106] In this embodiment, the application in the application layer can obtain watermark requirement information. Among them, the watermark requirement information includes the watermark size, watermark position, and watermark content. In one implementation, the watermark requirement information may further include information such as watermark color, watermark font, watermark transparency, and watermark content arrangement method.
[0107] In one implementation, the application in the application layer can obtain the watermark requirement information sent by the host computer.
[0108] In one implementation, an application in the application layer can obtain the watermark requirement information sent by the acquisition station.
[0109] After obtaining the watermark requirement information, the application in the application layer can generate a watermark resource file according to the watermark requirement information. The watermark resource file includes a configuration file and a watermark file. The configuration file includes the watermark size and the watermark position.
[0110] In one implementation, the application in the application layer can also obtain the resolution. The application in the application layer can generate a watermark resource file according to the obtained watermark requirement information and the obtained resolution.
[0111] S403: The application in the application layer places the watermark resource file in the framework layer.
[0112] In this embodiment, after generating the watermark resource file, the application in the application layer can place the watermark resource file in the framework layer.
[0113] S404: The camera service in the framework layer forwards the video recording request to the camera kernel driver in the kernel layer through the camera hardware abstraction layer in the hardware abstraction layer.
[0114] In this embodiment, the camera service in the framework layer forwards the video recording request to the camera kernel driver in the kernel layer through the camera hardware abstraction layer in the hardware abstraction layer.
[0115] It should be noted that S402 and S403 can occur before S404, can occur after S404, or can occur simultaneously with S404. The embodiments of the present application do not limit this.
[0116] S405: In response to the video recording request, the camera kernel driver in the kernel layer controls the camera to record video to obtain video frames, and sends the video frames to the watermark parsing and synthesis module in the hardware abstraction layer through the camera hardware abstraction layer in the hardware abstraction layer.
[0117] In this embodiment, in response to the video recording request, the camera kernel driver in the kernel layer controls the camera to record video to obtain video frames, and sends the video frames to the watermark parsing and synthesis module in the hardware abstraction layer through the camera hardware abstraction layer in the hardware abstraction layer.
[0118] S406: The watermark parsing and synthesis module in the hardware abstraction layer generates video frames with embedded watermarks according to the watermark position, watermark size, watermark file, and video frames, and sends the video frames with embedded watermarks to the video encoder in the hardware abstraction layer.
[0119] In this embodiment, after obtaining a video frame, the watermark parsing and synthesis module in the hardware abstraction layer can obtain the watermark resource file placed in the framework layer. Among them, the watermark resource file includes a configuration file and a watermark file. The configuration file includes the watermark position and the watermark size.
[0120] Based on the watermark position and watermark size in the configuration file, the watermark file, and the video frame, the watermark parsing and synthesis module can generate a video frame with an embedded watermark. Figure 4b It is a schematic diagram of generating a video frame with an embedded watermark provided by an embodiment of the present application. As Figure 4b shown, the watermark parsing and synthesis module can generate a video frame with an embedded watermark according to the watermark resource file and the video frame.
[0121] After generating the video frame with the embedded watermark, the watermark parsing and synthesis module can send the video frame with the embedded watermark to the video encoder in the hardware abstraction layer.
[0122] S407: The video encoder in the hardware abstraction layer generates a video file in a target format according to the video frame with the embedded watermark, and performs a saving process.
[0123] In this embodiment, the video encoder in the hardware abstraction layer generates a video file in a target format according to the video frame with the embedded watermark, and performs a saving process.
[0124] Advantageous effects of this embodiment: In this embodiment, the generation process of the watermark resource file and the embedding process of the video watermark are split. The application program in the application layer can generate a watermark resource file including a watermark file and a configuration file based on the watermark size, watermark position, and watermark content in the obtained watermark requirement information, and place the watermark resource file in the framework layer. The watermark parsing and synthesis module in the hardware abstraction layer can directly obtain the watermark resource file in the framework layer. The watermark parsing and synthesis module can generate a video frame with an embedded watermark according to the watermark size, watermark position, watermark file in the watermark resource file, and the obtained video frame, and send the video frame with the embedded watermark to the video encoder in the hardware abstraction layer for encoding. Compared with the related art, where the application program in the application layer executes the embedding process of the video watermark, and after the embedding is completed, it is sent back to the video encoder in the hardware abstraction layer for encoding, resulting in a too long processing flow for the video watermark embedding method, and thus a high power consumption problem for the electronic device. In the present application, on the one hand, the generation process of the watermark resource file is executed by the application program, and the embedding process of the video watermark is executed by the watermark parsing and synthesis module in the hardware abstraction layer, and the two processes are independent and executed in parallel; on the other hand, after generating the video frame with the embedded watermark, the watermark parsing and synthesis module in the hardware abstraction layer can directly send the video frame with the embedded watermark to the video encoder in the hardware abstraction layer. By the above method, the processing flow is shortened, the processing speed is improved, and thus the power consumption of the electronic device is reduced.
[0125] The following is an embodiment of the device of the present application, which can be used to execute the method embodiment of the present application. For details not disclosed in the device embodiment of the present application, please refer to the method embodiment of the present application.
[0126] The embodiment of the present application provides an embedding device for video watermark, including:
[0127] An application program at the application layer, which is used to call the camera interface and send a video recording request to the camera service at the framework layer;
[0128] The camera service at the framework layer is used to forward the video recording request to the camera kernel driver at the kernel layer through the camera hardware abstraction layer at the hardware abstraction layer;
[0129] The camera kernel driver at the kernel layer is used to respond to the video recording request, control the camera to record video to obtain video frames, and send the video frames to the watermark parsing and synthesis module at the hardware abstraction layer through the camera hardware abstraction layer at the hardware abstraction layer;
[0130] The watermark parsing and synthesis module at the hardware abstraction layer is used to generate video frames with embedded watermarks according to the video frames and the watermark resource file placed in the framework layer, and send the video frames with embedded watermarks to the video encoder at the hardware abstraction layer;
[0131] The video encoder at the hardware abstraction layer is used to generate a video file in the target format according to the video frames with embedded watermarks and perform a saving process.
[0132] The embedding device for video watermark provided by the embodiment of the present application can be used to execute the technical solution of the above method embodiment, and its implementation principle and technical effect are similar, which will not be elaborated here.
[0133] In one implementation,
[0134] The application program at the application layer is further used to generate a watermark resource file according to the obtained watermark requirement information;
[0135] The application program at the application layer is further used to place the watermark resource file in the framework layer.
[0136] The embedding device for video watermark provided by the embodiment of the present application can be used to execute the technical solution of the above method embodiment, and its implementation principle and technical effect are similar, which will not be elaborated here.
[0137] In one implementation, the watermark requirement information includes: watermark size, watermark position, and watermark content.
[0138] The embedding device for video watermark provided by the embodiment of the present application can be used to execute the technical solution of the above method embodiment, and its implementation principle and technical effect are similar, which will not be elaborated here.
[0139] In one implementation, the watermark resource file includes a configuration file and a watermark file; the configuration file includes the watermark position and the watermark size;
[0140] The watermark parsing and synthesis module of the hardware abstraction layer is specifically configured to:
[0141] Generate a video frame with an embedded watermark according to the watermark position, the watermark size, the watermark file, and the video frame.
[0142] The video watermark embedding device provided by the embodiments of the present application can be used to execute the technical solutions of the foregoing method embodiments, and its implementation principle and technical effects are similar, which will not be elaborated herein.
[0143] In one implementation, the application program at the application layer is specifically configured to:
[0144] Generate a watermark resource file according to the obtained watermark requirement information and the obtained resolution.
[0145] The video watermark embedding device provided by the embodiments of the present application can be used to execute the technical solutions of the foregoing method embodiments, and its implementation principle and technical effects are similar, which will not be elaborated herein.
[0146] Figure 5 It is a schematic structural diagram of an electronic device provided by the present application. As Figure 5 shown, the electronic device 50 includes:
[0147] A processor 51, a memory 52, and a communication interface 53;
[0148] The memory 52 is used to store the executable instructions of the processor 51;
[0149] Wherein, the processor 51 is configured to execute the technical solutions of any of the foregoing method embodiments by executing the executable instructions.
[0150] Optionally, the memory 52 can be either independent or integrated with the processor 51.
[0151] Optionally, when the memory 52 is a device independent of the processor 51, the electronic device 50 may further include: a bus, and the memory 52 and the communication interface 53 are connected to the processor 51 through the bus and complete mutual communication, and the communication interface 53 is used to communicate with other devices.
[0152] Optionally, the communication interface 53 may be specifically implemented by a transceiver. The communication interface is used to implement communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM), and may also include non-volatile memory, such as at least one disk memory.
[0153] The bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity of representation, only a thick line is used in the figure to represent it, but it does not mean that there is only one bus or one type of bus.
[0154] The foregoing processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0155] This electronic device is used to execute the technical solutions in any of the foregoing method embodiments, and its implementation principle and technical effects are similar, which will not be elaborated here.
[0156] The embodiment of the present application also provides a computer-readable storage medium, on which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the technical solutions provided in any of the foregoing embodiments are implemented.
[0157] The embodiment of the present application also provides a computer program product, including a computer program, which is used to implement the technical solutions provided in any of the foregoing method embodiments when the computer program is executed by a processor.
[0158] Those of ordinary skill in the art can understand that all or part of the steps to implement the foregoing method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the foregoing method embodiments; and the foregoing storage medium includes: ROM, RAM, magnetic disk, or optical disk and other various media that can store program codes.
[0159] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than limiting them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for embedding video watermark, characterized in that, Including: The application program at the application layer calls the camera interface and sends a video recording request to the camera service at the framework layer; The camera service at the framework layer forwards the video recording request to the camera kernel driver at the kernel layer through the camera hardware abstraction layer at the hardware abstraction layer; The camera kernel driver at the kernel layer responds to the video recording request, controls the camera to record video to obtain video frames, and sends the video frames to the watermark parsing and synthesis module at the hardware abstraction layer through the camera hardware abstraction layer at the hardware abstraction layer; The watermark parsing and synthesis module at the hardware abstraction layer generates video frames with embedded watermarks according to the video frames and the watermark resource file placed in the framework layer, and sends the video frames with embedded watermarks to the video encoder at the hardware abstraction layer; The video encoder at the hardware abstraction layer generates a video file in the target format according to the video frames with embedded watermarks and performs a save process.
2. The video watermark embedding method according to claim 1, characterized in that, Also including: The application program at the application layer generates the watermark resource file according to the obtained watermark requirement information; The application program at the application layer places the watermark resource file in the framework layer.
3. The video watermark embedding method according to claim 2, wherein The watermark requirement information includes: watermark size, watermark position, and watermark content.
4. The video watermark embedding method according to claim 3, characterized in that, The watermark resource file includes a configuration file and a watermark file; the configuration file includes the watermark position and the watermark size; The watermark parsing and synthesis module at the hardware abstraction layer generates video frames with embedded watermarks according to the video frames and the watermark resource file placed in the framework layer, including: The watermark parsing and synthesis module at the hardware abstraction layer generates the video frames with embedded watermarks according to the watermark position, the watermark size, the watermark file, and the video frames.
5. The method for embedding a video watermark according to any one of claims 2-4, characterized in that, The application program at the application layer generates the watermark resource file according to the obtained watermark requirement information, including: The application program at the application layer generates the watermark resource file according to the obtained watermark requirement information and the obtained resolution.
6. An embedding device for video watermarking, characterized in that, Including: An application program at the application layer, which is used to call the camera interface and send a video recording request to the camera service at the framework layer; The camera service at the framework layer is used to forward the video recording request to the camera kernel driver at the kernel layer through the camera hardware abstraction layer at the hardware abstraction layer; The camera kernel driver at the kernel layer is used to respond to the video recording request, control the camera to record video to obtain video frames, and send the video frames to the watermark parsing and synthesis module at the hardware abstraction layer through the camera hardware abstraction layer at the hardware abstraction layer; The watermark parsing and synthesis module at the hardware abstraction layer is used to generate video frames with embedded watermarks according to the video frames and the watermark resource file placed in the framework layer, and send the video frames with embedded watermarks to the video encoder at the hardware abstraction layer; The video encoder at the hardware abstraction layer is used to generate a video file in the target format according to the video frames with embedded watermarks and perform a save process.
7. The video watermark embedding device according to claim 6, wherein The application program at the application layer is further configured to generate the watermark resource file according to the obtained watermark requirement information; The application program at the application layer is further configured to place the watermark resource file in the framework layer.
8. An electronic device, characterized in that, Comprising: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the video watermark embedding method according to any one of claims 1-5.
9. A computer-readable storage medium, characterized in that, Computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by the processor, they are used to implement the video watermark embedding method according to any one of claims 1-5.
10. A computer program product, characterized in that, Comprising a computer program, which when executed by a processor, is used to implement the video watermark embedding method according to any one of claims 1-5.