A video watermarking method, device, equipment and storage medium
By obtaining and adjusting the attribute description file of video watermark information, the deformation and picture quality problems caused by mismatch between watermark information and video attributes in the prior art are solved, and the high resolution and smooth video watermark addition effect is achieved.
Patent Information
- Application Number
- CN202211440534.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-04-28
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2039-04-28
AI Technical Summary
In the existing video watermark addition method, the properties such as the resolution of the watermark information do not match the properties of the video, resulting in watermark deformation, low resolution of the video picture and poor fluency.
By obtaining the attribute description file of the watermark information, setting the target attributes in the attribute description file based on the target attribute data of the target video, adaptive adjustment of the target attributes of the watermark information, and converting the set attribute description file into a format consistent with the target video pixel data, adding it directly to the video, and finally encoding the watermark pixel data.
The rendering and generation of watermark information is realized, avoiding the problems of watermark deformation and low resolution and poor smoothness of video images, and improving the resolution and smoothness of video images with watermarks.
Smart Images

Figure CN115866356B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of video information processing, and in particular to a method, device, equipment and storage medium for adding watermarks to a video. Background Art
[0002] With the development of video technology, the demand for adding watermark information to videos is becoming more and more urgent. For example, watermark information is added to videos to protect copyright, or advertising-related watermarks are added to videos for advertising promotion.
[0003] At present, when adding watermark information to a video, the video is often decoded first to obtain the decoded video information; then, the watermark information is directly added to the decoded video information; finally, the decoded video information with the watermark information is encoded again to complete the addition of the watermark information to the video. However, in the above-mentioned existing video watermarking method, since the resolution and other attributes of the video to be watermarked and the watermark information are fixed, the resolution and other attributes of the video and the watermark information are often different. In the process of adding the watermark information, the watermark information needs to be scaled based on the video resolution, resulting in deformation of the added watermark, poor resolution and smoothness of the video after adding the watermark, and other problems. Therefore, a more reliable or more effective solution is needed. Summary of the invention
[0004] The present application provides a method, device, equipment and storage medium for adding watermarks to a video, which can realize adaptive adjustment of target attributes of watermark information and improve the resolution and smoothness of the video picture with the watermark added.
[0005] On the one hand, the present application provides a method for adding a watermark to a video, the method comprising:
[0006] Get the attribute description file of watermark information;
[0007] Setting the target attribute in the attribute description file based on the target attribute data of the target video;
[0008] Converting the set attribute description file into pixel data in a first format;
[0009] Adding pixel data of the first format of the watermark information to pixel data of the first format of the target video to obtain watermark-added pixel data;
[0010] The watermark-added pixel data is processed to obtain video data with watermark information added.
[0011] On the other hand, a video watermarking device is provided, the device comprising:
[0012] An attribute description file acquisition module is used to obtain an attribute description file of watermark information;
[0013] A target attribute setting module, used for setting the target attribute in the attribute description file based on the target attribute data of the target video;
[0014] A pixel data conversion module, used for converting the set attribute description file into pixel data in a first format;
[0015] A watermark adding module, used for adding the pixel data of the first format of the watermark information to the pixel data of the first format of the target video to obtain the watermark added pixel data;
[0016] The pixel data processing module is used to process the watermark-added pixel data to obtain video data with added watermark information.
[0017] In some embodiments, the watermark adding module includes:
[0018] A decoding processing unit, which can be used to decode the target video to obtain pixel data of the target video in a first format;
[0019] The watermark adding unit may be used to add the pixel data of the first format of the watermark information at a preset adding position of the pixel data of the first format of the target video to obtain the watermark added pixel data.
[0020] On the other hand, a device for adding watermark to a video is provided, the device comprising a processor and a memory, the memory storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by the processor to implement the method for adding watermark to the video as described above.
[0021] On the other hand, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the video watermarking method as described above.
[0022] The video watermarking method, device, equipment and storage medium provided by this application have the following technical effects:
[0023] The present application can achieve adaptive adjustment of the target attributes of the watermark information by setting the target attributes in the attribute description file based on the target attribute data of the target video by acquiring the attribute description file of the watermark information instead of directly acquiring the watermark information of fixed attributes; then, the attribute description file after setting is converted into pixel data in a format consistent with the pixel data of the target video, and directly added to the pixel data of the target video to obtain watermark-added pixel data; finally, the watermark-added pixel data is encoded to obtain video data with a smooth picture after the watermark is added; in the encoding process of the watermark-added pixel data with the watermark information added, the rendering generation of the watermark information is achieved, which can avoid the problems of watermark deformation caused by attribute adjustment during the adding process of the existing watermark information with fixed attributes, low resolution and poor smoothness of the video picture with the watermark added, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 is a schematic diagram of an application environment provided by an embodiment of the present application;
[0026] Figure 2 is a schematic diagram of a video watermark editing interface provided by an embodiment of the present application;
[0027] Figure 3 is a schematic diagram of a video watermark display interface provided in an embodiment of the present application;
[0028] Figure 4 It is a flowchart of a method for adding a watermark to a video provided in an embodiment of the present application;
[0029] Figure 5 is a schematic diagram of watermark information provided by an embodiment of the present application;
[0030] Figure 6 It is a schematic diagram of a process of setting target attributes in the attribute description file based on target attribute data of a target video provided by an embodiment of the present application;
[0031] Figure 7 It is another flow chart of setting target attributes in the attribute description file based on target attribute data of a target video provided by an embodiment of the present application;
[0032] Figure 8is a schematic diagram of a process of converting the set attribute description file into pixel data in a first format provided by an embodiment of the present application;
[0033] Fig. 9 This is a schematic diagram of frame rate comparison of a target video and watermark information provided by an embodiment of the present application;
[0034] Fig.10 It is a schematic diagram of pictures corresponding to different video frames of video watermark information added to a target video provided by an embodiment of the present application;
[0035] Fig.11 is a schematic diagram of a video picture of a certain frame of a target video provided in an embodiment of the present application;
[0036] Fig.12 This is a schematic diagram of a certain frame of video data after adding a watermark provided by an embodiment of the present application;
[0037] Fig.13 It is a structural schematic diagram of a video watermarking device provided in an embodiment of the present application;
[0038] Fig.14 This is a block diagram of a target attribute setting module provided in an embodiment of the present application;
[0039] Fig.15 This is a block diagram of a pixel data conversion module provided in an embodiment of the present application;
[0040] Fig.16 It is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0042] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0043] See also Figure 1 , Figure 1 is a schematic diagram of an application environment provided by an embodiment of the present application, such as Figure 1 As shown, the application environment may include a client 01 and a server 02 .
[0044] Specifically, the client 01 may include software running in a physical device, such as an application provided by a certain service provider, etc., and may also include a physical device such as a smart phone, a desktop computer, a tablet computer, a laptop computer, a digital assistant, a smart wearable device, etc. with an application installed. The operating system running on the client 01 in the embodiment of the present application may include but is not limited to Android system, IOS system, Linux, Windows, etc. Specifically, the client 01 may provide the user with an editing interface for adding watermark information to the video, such as inputting the video to be watermarked, inputting the watermark information, etc.
[0045] Specifically, the server 02 may include an independently operated server, a distributed server, or a server cluster composed of multiple servers. The server 02 may be a background service of the client 01, and is used to perform watermarking processing on the video.
[0046] In practical applications, the client 01 can send the video and watermark information to the server 02 so that the server 02 can perform watermarking processing on the video. Figure 2 As shown, Figure 2 is a schematic diagram of a video watermark editing interface provided by an embodiment of the present application, from Figure 2 The video watermark editing interface corresponding to (a) in FIG. 1 is visible. Users can add video and watermark information in the video watermark editing interface provided by client 01. After adding the video and watermark information, Figure 2In the video watermark editing interface corresponding to (b), the user can click the button to generate a watermarked video to enable the client 01 to send the video and watermark information to the server 02, and then the server 02 will add the watermark to the video.
[0047] In the embodiment of the present specification, the watermark information sent by the client 01 to the server 02 may be a property description file of the watermark information. Specifically, the property description file may include a file in a data exchange format that describes the properties of the watermark information. (Wherein, the file in the data exchange format may include a description data file that can be recognized by different programs of a computer or different programming languages, and generally describes data in a specific form such as text.) Figure 2 As shown in , the file in the data exchange format describing the attributes of the watermark information may include a JSON (JavaScript Object Notation, JS object notation) file describing the attributes of the watermark information; in addition, the video format may be FLV (FLASH VIDEO, streaming media format).
[0048] In addition, it should be noted that the above Figure 2 It is only a schematic diagram of an example of a video watermark editing interface. In actual applications, the video watermark editing interface may also include other information, and the supported video formats are not limited to the FLV format, but may also include other video formats, such as RMVB (RealMedia Variable Bitrate) and other video formats; the supported attribute description files are not limited to JSON files, and in actual applications, may also include files in other data exchange formats.
[0049] In practical applications, the server 02 may also send the video with the watermark information added to the client 01 so that the video can be played and displayed on the client 01. Figure 3 As shown, Figure 3 is a schematic diagram of a video watermark display interface provided by an embodiment of the present application, from Figure 3 As can be seen, by clicking play, users can watch the video with the watermark added.
[0050] In addition, it should be noted that the above Figure 3 This is only a schematic diagram of an example of a video watermark display interface. In actual applications, the video watermark display interface may also include other information, such as watermark information added to the video.
[0051] The following is a specific embodiment of a method for adding a watermark to a video of the present application. Figure 4It is a flowchart of a method for adding watermarks to a video provided in an embodiment of the present application. This specification provides method operation steps as described in the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or server product is executed, it can be executed in sequence or in parallel (for example, in a parallel processor or multi-threaded processing environment) according to the method shown in the embodiment or the accompanying drawings. Specifically, Figure 4 As shown, the method may include:
[0052] S401: Obtain the attribute description file of the watermark information.
[0053] In the embodiments of this specification, the watermark information may include watermark information in a picture format (abbreviated as picture watermark information) or watermark information in a video format (abbreviated as video watermark information). Specifically, the attributes described in the attribute description file of the watermark information may include characteristic attribute information of the object constituting the watermark information and attribute information corresponding to the format of the watermark.
[0054] In a specific embodiment, Figure 5 As shown, assuming that the watermark information is as follows Figure 5 For static picture watermark information, the attributes described in the attribute description file may include: the shape, size, color and other characteristic attribute information of each object (the earth, trees, various buildings) that constitutes the watermark information, as well as the resolution and other attribute information corresponding to the static picture format. In addition, for dynamic picture formats such as GIF, the corresponding attribute information such as the total playback time can also be used.
[0055] In addition, it should be noted that Figure 5 This is just an example of watermark information. In actual applications, different watermark information can be corresponding to the value adjustment of different attributes in the attribute description file, for example Figure 5 The color of the medium tree can be green.
[0056] In another specific embodiment, it is assumed that the watermark information is video watermark information, specifically, for example Figure 5 The corresponding image watermark information is a video formed by shooting in a preset direction (e.g. clockwise) at a certain speed. Correspondingly, the attributes described in the attribute description file may include: the shape, size, color, movement direction, movement speed and other characteristic attribute information of each moving object (the earth, trees, various buildings) constituting the watermark information, as well as the resolution, frame rate, total playback time and other attribute information corresponding to the video format.
[0057] In the embodiments of this specification, when it is necessary to add watermark information to a video, the attribute description file of the watermark information can be obtained from the client side of the foreground, or from a database storing the attribute description file of the watermark information. In a specific embodiment, the acquisition of the attribute description file of the watermark information may include: acquiring a file in a json data exchange format that describes the attributes of the watermark information.
[0058] In the embodiments of the present specification, when watermarking a video, an attribute description file of the watermark information is obtained rather than directly obtaining watermark information with fixed attributes, so that the relevant attributes of the watermark information can be adaptively adjusted in combination with the video to which the watermark is to be added, thereby reducing the difficulty of designing the watermark information and ensuring the watermarking effect on videos with different attributes.
[0059] S403: Setting the target attributes in the attribute description file based on the target attribute data of the target video.
[0060] In the embodiment of this specification, the target video may include video data to be watermarked. The target attribute may include an attribute that affects the quality of the watermark information.
[0061] In a specific embodiment, when the watermark information is video watermark information, the target attribute may include a resolution attribute and a frame rate attribute, and the target attribute data of the target video may include a resolution and a frame rate; accordingly, Figure 6 As shown, the setting of the target attribute in the attribute description file based on the target attribute data of the target video may include:
[0062] S4031: Parse the attribute description file to obtain the resolution attribute and frame rate attribute of the watermark information.
[0063] In practical applications, the attribute description file is often encoded according to a certain data structure when it is encoded. For example, the data structure of the json file is a key-value pair of an object (attribute of the watermark information): {"t":25} (the value of object t is 25). Accordingly, during the parsing process, the attribute description file can be parsed based on its data structure when it is encoded, and the attributes of the watermark information described in the attribute description file can be obtained.
[0064] Specifically, the attribute description file includes a large number of watermark information attributes. When the watermark information is video watermark information, since the attributes affecting the image quality of the video watermark information include resolution attributes and frame rate attributes, the resolution attributes and frame rate attributes can be extracted from the parsed information.
[0065] S4033: Obtain the resolution and frame rate of the target video.
[0066] S4035: Set the resolution attribute and the frame rate attribute in the attribute description file to the resolution and frame rate of the target video respectively.
[0067] In practical applications, resolution can be used as a parameter to measure the amount of data in an image. Generally, it can be expressed by width and height. For example, it can be assumed that the resolution of the target video is 1920*1080 (the unit is generally pixels). Accordingly, the width and height values corresponding to the resolution attribute in the attribute description file can be set to 1920 and 1080 respectively.
[0068] In practical applications, the frame rate can be used to measure the number of displayed frames, and the unit is FPS (Frames per Second). For example, it can be assumed that the frame rate of the target video is 60fps. Accordingly, the value of the frame rate attribute in the attribute description file can be set to 60.
[0069] In another specific embodiment, when the watermark information is picture watermark information, the target attribute may include a resolution attribute, and the target attribute data of the target video may include a resolution; accordingly, Figure 7 As shown, the setting of the target attribute in the attribute description file based on the target attribute data of the target video may include:
[0070] S4037: Parse the attribute description file to obtain the resolution attribute of the watermark information.
[0071] S4039: Obtain the resolution of the target video.
[0072] S40311: Set the resolution attribute in the attribute description file to the resolution of the target video.
[0073] Specifically, when the watermark information is picture watermark information, the steps for parsing the attribute description file and setting the resolution can refer to the steps for the watermark information being video watermark information, which will not be repeated here.
[0074] In the embodiments of the present specification, the target attributes that affect the image quality of the watermark information in the attribute description file of the watermark information can be directly set according to the target attribute data of the video, so that when the subsequent watermark information is added to the video, there is no need to match and adjust the attributes of the two, and the watermark information can be added directly; at the same time, the existing problem of deformation of the watermark information caused by directly adjusting the attributes of the watermark information with fixed attributes can be avoided.
[0075] S405: Convert the set attribute description file into pixel data in a first format.
[0076] In practical applications, adding a watermark to a video often requires adding the watermark information to the decoded video (pixel data). Accordingly, the watermark information can also be converted into pixel data in a format consistent with the decoded video data.
[0077] Specifically, the first format is the format of pixel data after the target video is decoded. Generally, the first format may be YUV, where "Y" represents brightness, "U" represents chrominance, and "V" represents density.
[0078] In a specific embodiment, Figure 8 As shown, when the watermark information is video watermark information, converting the set attribute description file into pixel data in the first format may include:
[0079] S4051: Determine the time axis data of the video watermark information based on the frame rate attribute set in the attribute description file.
[0080] In the embodiment of the present specification, the frame rate attribute set in the attribute description file may include a value of the frame rate attribute.
[0081] In practical applications, video watermark information often corresponds to a time axis, for example, 30 seconds of video watermark information corresponds to a 30-second time axis. In the embodiment of this specification, the time axis data of the video watermark information may include the number of frames at each time point in the time axis of the video watermark information.
[0082] In a specific embodiment, assuming that the frame rate attribute set in the attribute description file is 60fps, it can be determined that the number of frames at each time point in the time axis of the video watermark information is 60 accordingly.
[0083] S4053: Convert the set attribute description file into pixel data in a second format according to the timeline data and the set resolution parameters.
[0084] Specifically, the second format may include an initial format of pixel data converted from a property description file, such as RGBA, where R may represent Red, G may represent Green, B may represent Blue and A may represent Alpha (generally used as an opacity parameter).
[0085] S4055: Convert the pixel data in the second format into pixel data in the first format.
[0086] In the embodiment of the present specification, in order to ensure that the format of the pixel data is consistent when adding the pixel data of the watermark information to the pixel data of the target video, the pixel data in the second format may be converted into the pixel data in the first format.
[0087] In some other embodiments, when the watermark information is picture watermark information, converting the set attribute description file into pixel data in the first format may include: converting the set attribute description file into pixel data in a second format according to the set resolution attribute, and converting the pixel data in the second format into pixel data in the first format.
[0088] In the embodiments of the present specification, after the target attributes in the attribute description file of the watermark information are set based on the target attribute data of the target video, the attribute description file of the watermark information is converted into pixel data in a format consistent with the pixel data after decoding the target video, thereby avoiding the deformation of the existing fixed-attribute watermark information due to attribute adjustment during the adding process.
[0089] S407: Add the pixel data of the first format of the watermark information to the pixel data of the first format of the target video to obtain watermark-added pixel data.
[0090] In the embodiment of the specification, after obtaining the pixel data of the first format of the watermark information based on the set attribute description file, the pixel data of the first format of the watermark information can be added to the pixel data of the first format of the target video to obtain watermark-added pixel data. Specifically, the watermark-added pixel data can include the target video pixel data (pixel data of the target video) to which the watermark pixel data (pixel data of the watermark information) is added.
[0091] Specifically, the target video may be decoded to obtain pixel data of the target video in a first format; pixel data of the watermark information in a first format may be added to a preset adding position of the pixel data of the target video in the first format to obtain the watermark-added pixel data.
[0092] Specifically, the decoding process of the target video can be combined with the encoding algorithm used when the video is encoded to perform decoding. For details, please refer to the following steps related to encoding and decoding.
[0093] In the embodiment of the present specification, the preset adding position may be the position information where the watermark information is added to the video, for example, the 20th to 30th second of the target video. Fig. 9 As shown, Fig. 9 The video watermark information includes some video frames and some video frames corresponding to the preset adding position of the target video. Since the frame rate corresponding to the video watermark information is consistent with the frame rate of the target video, correspondingly, Fig. 9As can be seen, the video frames of the video watermark information and the video frames corresponding to the preset adding positions of the target video correspond one to one, and the pixel data of the watermark information can be directly added to the pixel data of the target video, avoiding the operation of adding frames or dropping frames due to different frame rates in the prior art, and improving the processing efficiency in the watermark adding process.
[0094] S409: Process the watermark-added pixel data to obtain video data with watermark information added.
[0095] In the embodiments of the present specification, the watermark added pixel data is processed to obtain the video data with the watermark information, which may include but is not limited to encoding the pixel data using the H264 encoding algorithm to obtain the video data. Specifically, H264 is a highly compressed digital video codec standard proposed by the Joint Video Team (JVT) jointly formed by the ITU-T Video Coding Experts Group (VCEG) and the ISO / IEC Moving Picture Experts Group (MPEG).
[0096] In the embodiments of the present specification, during the encoding process, the pixel data corresponding to each frame is encoded in sequence in units of frames. Specifically, the mode (i.e., the size of each frame, such as 16*16) can be determined based on the pixel data (watermark added pixel data), and it is determined whether there is a reference frame for the frame corresponding to the pixel data currently to be encoded (the reference frame can be a frame that has already been encoded and whose pixel data has a high degree of similarity with the pixel data currently to be encoded).
[0097] In some embodiments, if there is a reference frame, inter-frame prediction processing can be performed based on the pixel data currently to be encoded and the pixel data of the reference frame, that is, the motion vector and residual recovery image of the pixel data currently to be encoded are determined based on the pixel data of the reference frame;
[0098] In other embodiments, if there is no reference frame, intra-frame prediction processing can be performed based on the pixel data currently to be encoded, that is, the motion vector and residual recovery image of the pixel data currently to be encoded are determined based on different pixel points in the pixel data currently to be encoded.
[0099] Furthermore, the pixel data after the inter-frame prediction process or the intra-frame prediction process is subjected to time-frequency transformation (the low-frequency (contour) and high-frequency (detail) parts of the image can be separated through time-frequency transformation) to obtain frequency domain data; then, the frequency domain data is quantized (i.e., lossy compression is performed, for example, the frequency domain data after the time-frequency transformation is: 22, 30, 45, the quantization step is 20, and the quantization results are 1 (22 / 20), 1 (30 / 20), 2 (45 / 20), i.e., rounding is performed based on the step length); then, the quantized data is entropy encoded to obtain the current video frame of the pixel data. Based on the video frame corresponding to each pixel data, the video data with the watermark information added can be obtained.
[0100] In addition, after the above quantization, inverse quantization and inverse time-frequency transform can be performed, and the image can be restored through motion vectors and residuals, and the image can be added to the reference frame sequence to provide a reference frame for the subsequent encoding process.
[0101] Specifically, the specific process of decoding the video data obtained based on the above encoding process can be as follows:
[0102] Each video frame is parsed to obtain the minimum coding unit of entropy coding (macroblock, i.e., data after entropy coding), and then each minimum coding unit is entropy decoded; then, the entropy decoded data is inversely quantized (i.e., multiplied by the step size during quantization); then, an inverse time-frequency transform is performed (i.e., converting the data from the frequency domain to the time domain) to obtain time domain data (i.e., motion vector and motion residual recovery data); then, based on the motion vector and motion residual recovery data, the pixel data corresponding to each frame of video data is obtained.
[0103] Specifically, in the embodiments of this specification, during the encoding process of the watermark added pixel data, the video data with the watermark information added is obtained based on the watermark added pixel data corresponding to each frame, and the rendering generation of the target video and the picture of each frame of the watermark information is realized.
[0104] It can be seen from the technical solutions provided by the above embodiments of this specification that, in the embodiments of this specification, by obtaining the attribute description file of the watermark information instead of directly obtaining the watermark information with fixed attributes, the target attributes in the attribute description file can be set based on the target attribute data of the target video to achieve adaptive adjustment of the target attributes of the watermark information. Then, the attribute description file after setting is converted into pixel data in a format consistent with the pixel data after video decoding, and directly added to the pixel data after target video decoding to obtain watermark added pixel data. Finally, the watermark added pixel data is encoded to obtain video data with smooth watermark added. The technical solutions provided by the embodiments of this specification can be used to adaptively adjust the target attributes of the watermark information based on the target attribute data of the target video. In the encoding process of the watermark added pixel data with watermark information added, the rendering generation of the watermark information is achieved, and the resolution and smoothness of the video picture with watermark added are improved. The existing fixed attribute watermark information can avoid the deformation of the watermark due to the attribute adjustment during the adding process, the low resolution and poor smoothness of the video picture with watermark added, and other problems.
[0105] In a specific embodiment, the above Figure 5 The corresponding picture is shot clockwise at a certain speed to form a video watermark information, for example, Fig.10 As shown, Fig.10 Schematic diagram of pictures corresponding to different video frames of video watermark information added to a target video provided by an embodiment of the present application. Fig.10 It can be seen that in the process of adding watermark information, the target attribute of the attribute description file of the watermark information is adaptively adjusted based on the target attribute data of the target video; and the pixel data of the watermark information is added after the adaptive adjustment to obtain the watermark-added pixel data; finally, in the process of encoding the watermark-added pixel data, the rendering and generation of the watermark information is realized, thereby avoiding the problem of watermark deformation caused by attribute adjustment during the adding process of the existing fixed-attribute watermark information.
[0106] In another specific embodiment, Fig.11 As shown, Fig.11 is a schematic diagram of a video picture of a certain frame of a target video provided by an embodiment of the present application. Assume that Fig.11The watermark information added to the corresponding target video is dynamic video watermark information of bombs dropped by airplanes. Accordingly, by utilizing the technical solution provided in the embodiment of the present application, an attribute description file of the video watermark information can be obtained. The attribute description file may include object characteristic attribute information such as the size, shape, color, flight direction, and flight speed of the airplane and the bomb, as well as the size, shape, color, movement direction after dropping, and movement speed of the bomb, as well as attribute information such as resolution, frame rate, and total playback time corresponding to the video format. Accordingly, after obtaining the attribute description file, the resolution attribute and frame rate attribute that affect the image quality of the video watermark information in the attribute description file can be adaptively adjusted based on the target attribute data of the target video, and the adaptively adjusted attribute description file can be converted into pixel data in a format consistent with the pixel data after decoding of the target video, and directly added to the pixel data after decoding of the target video to obtain watermark-added pixel data; finally, as Fig.12 As shown, Fig.12 This is a schematic diagram of a frame of video data after watermarking provided by an embodiment of the present application. In the encoding process of watermarking pixel data with watermark information added, rendering generation of watermark information is achieved to obtain smooth and high-resolution video watermark data.
[0107] The present application also provides a video watermark adding device, such as Fig.13 As shown, the device comprises:
[0108] The attribute description file acquisition module 1310 can be used to obtain the attribute description file of the watermark information;
[0109] A target attribute setting module 1320 may be used to set the target attribute in the attribute description file based on the target attribute data of the target video;
[0110] The pixel data conversion module 1330 may be used to convert the set attribute description file into pixel data in a first format;
[0111] The watermark adding module 1340 may be used to add the pixel data of the first format of the watermark information to the pixel data of the first format of the target video to obtain the watermark added pixel data;
[0112] The pixel data processing module 1350 can be used to process the watermark-added pixel data to obtain video data with added watermark information.
[0113] In some embodiments, the attribute description file acquisition module 1310 can be specifically used to acquire a file in the JSON data exchange format that describes the attributes of the watermark information.
[0114] In some embodiments, Fig.14 As shown, when the watermark information is video watermark information, the target attribute includes a resolution attribute and a frame rate attribute; the target attribute setting module 1320 includes:
[0115] The first parsing processing unit 1321 may be used to parse the attribute description file to obtain the resolution attribute and the frame rate attribute of the watermark information;
[0116] The first attribute data acquisition unit 1323 may be used to acquire the resolution and frame rate of the target video;
[0117] The first target attribute setting unit 1325 may be configured to set the resolution attribute and the frame rate attribute in the attribute description file to the resolution and frame rate of the target video, respectively.
[0118] In some embodiments, Fig.15 As shown, when the watermark information is video watermark information, the pixel data conversion module 1330 may include:
[0119] A time axis data determining unit 1331 may be used to determine the time axis data corresponding to the video watermark information based on the frame rate attribute set in the attribute description file;
[0120] A first pixel data conversion unit 1333 may be used to convert the set attribute description file into pixel data in a second format according to the time axis data and the set resolution attribute;
[0121] The second pixel data conversion unit 1335 may be configured to convert the pixel data in the second format into pixel data in the first format.
[0122] In some embodiments, when the watermark information is picture watermark information, the target attribute includes a resolution attribute; the target attribute setting module 1320 may include:
[0123] A second parsing unit may be used to parse the attribute description file to obtain the resolution attribute of the watermark information;
[0124] A second attribute data acquisition unit may be used to acquire the resolution of the target video;
[0125] The second target attribute setting unit may be configured to set the resolution attribute in the attribute description file to the resolution of the target video.
[0126] In some embodiments, when the watermark information is picture watermark information, the pixel data conversion module 1330 may include:
[0127] A third pixel data conversion unit may be used to convert the set attribute description file into pixel data in a second format according to the set resolution attribute;
[0128] The fourth pixel data conversion unit may be configured to convert the pixel data in the second format into pixel data in the first format.
[0129] In some embodiments, the watermark adding module 1340 may include:
[0130] A decoding processing unit, which can be used to decode the target video to obtain pixel data of the target video in a first format;
[0131] The watermark adding unit may be used to add the pixel data of the first format of the watermark information at a preset adding position of the pixel data of the first format of the target video to obtain the watermark added pixel data.
[0132] The device and method embodiments in the described device embodiments are based on the same application concept.
[0133] An embodiment of the present application provides a video watermarking device, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement a video watermarking method provided in the above method embodiment.
[0134] The memory can be used to store software programs and modules. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required for functions, etc.; the data storage area can store data created according to the use of the device, etc. In addition, the memory can include a high-speed random access memory and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory can also include a memory controller to provide the processor with access to the memory.
[0135] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal, a server or a similar computing device. Taking running on a server as an example, Fig.16 1 is a hardware structure block diagram of a server of a video watermarking method provided in an embodiment of the present application. Fig.16As shown, the server 1600 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1610 (the processor 1610 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 1630 for storing data, and one or more storage media 1620 (such as one or more mass storage devices) for storing application programs 1623 or data 1622. Among them, the memory 1630 and the storage medium 1620 can be short-term storage or permanent storage. The program stored in the storage medium 1620 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processing unit 1610 can be configured to communicate with the storage medium 1620 and execute a series of instruction operations in the storage medium 1620 on the server 1600. The server 1600 may also include one or more power supplies 1660, one or more wired or wireless network interfaces 1650, one or more input and output interfaces 1640, and / or one or more operating systems 1621, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0136] The input / output interface 1640 may be used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the server 1600. In one example, the input / output interface 1640 includes a network adapter (Network Interface Controller, NIC), which may be connected to other network devices via a base station so as to communicate with the Internet. In one example, the input / output interface 1640 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0137] It can be understood by those skilled in the art that Fig.16 The structure shown is for illustration only and does not limit the structure of the above electronic device. Fig.16 More or fewer components as shown, or with Fig.16 Different configurations are shown.
[0138] An embodiment of the present application also provides a storage medium, which can be set in a device to store at least one instruction, at least one program, code set or instruction set related to a method for adding a watermark to a video in a method embodiment. The at least one instruction, the at least one program, the code set or instruction set is loaded and executed by the processor to implement the method for adding a watermark to a video provided in the above method embodiment.
[0139] Optionally, in this embodiment, the storage medium may be located in at least one of the multiple network devices of the computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0140] It can be seen from the embodiments of the video watermarking method, device, server or storage medium provided by the present application that in the present application, by obtaining the attribute description file of the watermark information instead of directly obtaining the watermark information of fixed attributes, the target attribute in the attribute description file can be set based on the target attribute data of the target video to achieve adaptive adjustment of the target attribute of the watermark information, and then the attribute description file after setting is converted into pixel data in a format consistent with the pixel data after video decoding, and directly added to the pixel data after target video decoding to obtain watermark added pixel data, and finally, the watermark added pixel data is encoded to obtain the video data with smooth picture after watermarking. The technical solution provided by the embodiments of this specification can be used to adaptively adjust the target attribute of the watermark information based on the target attribute data of the target video, and in the encoding process of the watermark added pixel data with watermark information added, the rendering generation of the watermark information is achieved, which can avoid the problems of watermark deformation caused by attribute adjustment during the adding process of the existing fixed attribute watermark information, low resolution and poor smoothness of the video picture with watermark added, etc.
[0141] It should be noted that the above-mentioned sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above-mentioned specific embodiments of this specification are described. Other embodiments are within the scope of the attached claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0142] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0143] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0144] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for adding a watermark to a video, characterized in that: The method comprises: Displaying a video watermark editing interface, wherein the video watermark editing interface includes input controls; In response to an operation on the input control, a video to which watermark information needs to be added and watermark information to be added to the video are input, wherein the watermark information includes video watermark information; Sending the video and the watermark information to a server so that the server performs watermarking processing on the video; Receiving the video with the watermark information added sent by the server, and displaying the video with the watermark information added to the user; The watermark information includes an attribute description file; the attribute description file includes a file in a data exchange format that describes the attributes of the watermark information, and the attributes described in the attribute description file include characteristic attribute information of each moving object constituting the watermark information and attribute information corresponding to the video format; The sending the video and the watermark information to the server includes: The video and the attribute description file are sent to the server, so that the server sets the target attributes in the attribute description file based on the target attribute data of the video, wherein the target attribute data includes resolution and frame rate, and the target attributes in the attribute description file include resolution attribute and frame rate attribute; the server converts the attribute description file after setting into pixel data in a second format, the second format includes an initial format of the attribute description file converted into pixel data, converts the pixel data in the second format into pixel data in a first format, the first format is the format of the pixel data after decoding the video, adds pixel data in a first format with watermark information to the pixel data in the first format of the video, obtains watermark-added pixel data, processes the watermark-added pixel data, and obtains the video with the watermark information added.
2. The method according to claim 1, characterized in that The input controls include adding a video control and adding a watermark control; In response to the operation of the input control, the video to which watermark information needs to be added and the watermark information to be added to the video are input, including: In response to the operation of adding the video control, inputting the video to which watermark information needs to be added; In response to an operation on the watermark adding control, the watermark information to be added to the video is input.
3. The method according to claim 1, characterized in that After inputting a video to which watermark information is to be added and watermark information to be added to the video, the method further comprises: displaying a watermark video generation control on the video watermark editing interface; The sending the video and the watermark information to the server includes: sending the video and the watermark information to the server in response to an operation on the generate watermark video control.
4. The method according to claim 3, characterized in that After inputting a video to which watermark information is to be added and watermark information to be added to the video, the method further includes: The identifier of the video to which watermark information needs to be added and the identifier of the watermark information to be added to the video are displayed on the video watermark editing interface.
5. The method according to claim 1, characterized in that The step of displaying the watermarked video to the user comprises: In response to receiving the video with the watermark information added, displaying a video watermark display interface, and displaying a play control and an identifier corresponding to the video with the watermark information added on the video watermark display interface; In response to the operation on the playback control, the video with the watermark information added is played.
6. The method according to claim 5, characterized in that The video watermark display interface also includes watermark information added to the video.
7. A video watermarking device, characterized in that: The device comprises: A display module, used to display a video watermark editing interface, wherein the video watermark editing interface includes input controls; An input module, configured to input a video to be added with watermark information and watermark information to be added to the video in response to an operation on the input control, wherein the watermark information includes video watermark information; A sending module, used for sending the video and the watermark information to a server, so that the server can perform watermarking processing on the video; A receiving module, used for receiving the video with watermark information added sent by the server, and displaying the video with watermark information added to the user; The watermark information includes an attribute description file; the attribute description file includes a file in a data exchange format that describes the attributes of the watermark information, and the attributes described in the attribute description file include characteristic attribute information of each moving object constituting the watermark information and attribute information corresponding to the video format; The sending module is further used to send the video and the attribute description file to the server, so that the server sets the target attributes in the attribute description file based on the target attribute data of the video, wherein the target attribute data includes resolution and frame rate, and the target attributes in the attribute description file include resolution attribute and frame rate attribute. The server converts the set attribute description file into pixel data in a second format, the second format includes an initial format of the attribute description file converted into pixel data, converts the pixel data in the second format into pixel data in a first format, the first format is the format of the pixel data after decoding the video, adds pixel data in a first format with watermark information to the pixel data in the first format of the video, obtains watermark-added pixel data, and processes the watermark-added pixel data to obtain the video with the watermark information added.
8. The device according to claim 7, characterized in that The display module is used to display a watermark video control on the video watermark editing interface after inputting a video to which watermark information is to be added and watermark information to be added to the video; The sending module is used to send the video and the watermark information to the server in response to the operation of the watermark video generation control.
9. The device according to claim 7, characterized in that The display module is used to display a video watermark display interface in response to receiving the video with the watermark information added, and to display a playback control and an identifier corresponding to the video with the watermark information added on the video watermark display interface; In response to the operation on the playback control, the video with the watermark information added is played.
10. The device according to claim 9, characterized in that The display module further displays the watermark information added to the video in the video watermark display interface.
11. A video watermarking device, characterized in that: The device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the video watermarking method as described in any one of claims 1 to 6.
12. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the video watermarking method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and system for embedding and extracting watermark of video files
CN101325700A
Video watermark generating method, device and terminal
CN107911641A