A video watermark adding method and device, electronic equipment and storage medium

CN116347184BActive Publication Date: 2026-06-16SHENZHEN FALCON NETWORK MEDIA CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN FALCON NETWORK MEDIA CO LTD
Filing Date
2023-03-15
Publication Date
2026-06-16

Smart Images

  • Figure CN116347184B_ABST
    Figure CN116347184B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a video watermark adding method and device, electronic equipment and a storage medium; a to-be-downloaded video can be downloaded through at least two video download threads, the to-be-downloaded video includes video header information and video metadata, the video header information is located at the head end of the to-be-downloaded video, downloaded information of the video download thread is detected, when the downloaded information includes all information of the video header information, the downloaded information is unpacked to obtain video frame data corresponding to at least one video frame, a watermark picture corresponding to the to-be-downloaded video is acquired, the watermark picture is added to the video frame data to obtain watermark video frame data, the watermark video frame data is used to display the video frame with the watermark picture when being played; the video frame can be processed to add watermark in real time, the adding speed of the video watermark is improved, and the experience of a user when downloading a video is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of audio and video processing technology, and specifically to a method, apparatus, electronic device, and storage medium for adding video watermarks. Background Technology

[0002] With the rapid development of audio and video technology, various types of videos have enriched people's lives and are increasingly widely used. Along with advancements in communication technology, people often download and save videos, and applications frequently need to add watermarks to these videos to indicate their source.

[0003] Currently, the main method for adding watermarks to videos is to download the entire video and save it locally before adding the watermark. However, this approach results in long download times for longer videos, preventing users from quickly viewing the downloaded content. This inefficient watermarking process negatively impacts the user's download experience. Summary of the Invention

[0004] This invention provides a video watermarking method, apparatus, electronic device, and storage medium that can add watermarks to video frames in real time, improving the speed of watermarking and enhancing the user experience when downloading videos.

[0005] This invention provides a method for adding a video watermark, comprising:

[0006] The video to be downloaded is downloaded using at least two video download threads. The video to be downloaded includes video header information and video metadata, with the video header information located at the beginning of the video to be downloaded.

[0007] The downloaded information of the video download thread is detected. When the downloaded information includes all the information of the video header information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame.

[0008] Obtain the watermark image corresponding to the video to be downloaded;

[0009] The watermark image is added to the video frame data to obtain watermarked video frame data, which is used to display the video frame with the watermark image when it is played.

[0010] Accordingly, embodiments of the present invention also provide a video watermarking device, comprising:

[0011] A multi-threaded download unit is used to download a video to be downloaded using at least two video download threads. The video to be downloaded includes video header information and video metadata, with the video header information located at the beginning of the video to be downloaded.

[0012] The decapsulation unit is used to detect the downloaded information of the video download thread. When the downloaded information includes all the information of the video header information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame.

[0013] The image acquisition unit is used to acquire the watermark image corresponding to the video to be downloaded;

[0014] A watermark adding unit is used to add the watermark image to the video frame data to obtain watermarked video frame data, which is used to display the video frame with the watermark image when it is played.

[0015] Optionally, the video watermarking device provided in this embodiment of the invention further includes an information moving unit, used to send a download request to the download server of the video to be downloaded, triggering the download server to parse the video to be downloaded to obtain the video header information and the video metadata, and move the video metadata to the beginning of the video to be downloaded.

[0016] Optionally, the decapsulation unit is used to detect whether the downloaded information of the video download thread includes the end identifier information corresponding to the video header information;

[0017] When the downloaded information includes the end identifier information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame.

[0018] Optionally, the decapsulation unit is used to obtain video track attribute information corresponding to the downloaded information;

[0019] Read the video track data corresponding to the video track in the downloaded information;

[0020] Based on the video track attribute information and the video track data, video frame data corresponding to at least one video frame is generated.

[0021] Optionally, the decapsulation unit is used to decapsulate the downloaded information to obtain audio frame data and video frame data corresponding to at least one video frame;

[0022] The video watermarking device provided in this embodiment of the invention further includes a mixing processing unit, which is used to perform audio and video mixing processing based on the audio frame data and the watermark video frame data to obtain a playable video that displays the watermark image when played.

[0023] Optionally, the video watermarking device provided in this embodiment of the invention further includes a video storage unit for obtaining a preset video storage address;

[0024] The playable video is stored in the video storage address.

[0025] Optionally, the multi-threaded download unit is used to download the video header information of the video to be downloaded through at least one first video download thread;

[0026] The amount of data obtained from the video header information is used to calculate the position offset for reading video metadata based on the amount of data.

[0027] The video metadata is downloaded using at least one second video download thread based on the position offset.

[0028] Accordingly, embodiments of the present invention also provide an electronic device, including a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to perform the steps in any of the video watermarking methods provided in the embodiments of the present invention.

[0029] Accordingly, embodiments of the present invention also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute the steps in any of the video watermarking methods provided in the embodiments of the present invention.

[0030] Furthermore, embodiments of the present invention also provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in any of the video watermarking methods provided in the embodiments of the present invention.

[0031] The solution of this invention allows for the download of a video to be downloaded using at least two video download threads. The video to be downloaded includes video header information and video metadata. The video header information is located at the beginning of the video to be downloaded. The downloaded information of the video download threads is detected. When the downloaded information includes all the information of the video header information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame. A watermark image corresponding to the video to be downloaded is obtained and added to the video frame data to obtain watermarked video frame data. The watermarked video frame data is used to display the video frame with the watermark image during playback. Since this invention uses multiple threads to download the video to be downloaded, and watermarks are added to the video frame data immediately after the video header information of the video to be downloaded is downloaded, watermarking can be added to video frames in real time, improving the speed of adding video watermarks and enhancing the user experience when downloading videos. Attached Figure Description

[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0033] Figure 1 This is a schematic diagram of a scenario illustrating the video watermarking method provided in an embodiment of the present invention;

[0034] Figure 2 This is a flowchart of the video watermarking method provided in an embodiment of the present invention;

[0035] Figure 3 This is a schematic diagram of the multi-threaded download process provided in an embodiment of the present invention;

[0036] Figure 4 This is a schematic diagram of the decapsulation process provided in an embodiment of the present invention;

[0037] Figure 5 This is a schematic diagram illustrating the technical implementation of the video watermarking method provided in this embodiment of the invention;

[0038] Figure 6 This is a schematic diagram of the video watermarking device provided in an embodiment of the present invention;

[0039] Figure 7 This is another structural schematic diagram of the video watermarking device provided in an embodiment of the present invention;

[0040] Figure 8 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation

[0041] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0042] This invention provides a video watermarking method, apparatus, electronic device, and computer-readable storage medium. Specifically, this invention provides a video watermarking method suitable for a video watermarking apparatus that can be integrated into an electronic device.

[0043] The electronic device can be a terminal or other device, including but not limited to mobile terminals and fixed terminals. For example, mobile terminals include but are not limited to smartphones, smartwatches, tablets, laptops, smart vehicles, etc., while fixed terminals include but are not limited to desktop computers, smart TVs, etc.

[0044] The electronic device can also be a server or other similar device. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, but it is not limited to these.

[0045] The video watermarking method of this invention can be implemented by a server or by a terminal and a server together.

[0046] The following example illustrates how to add a video watermark using both a terminal and a server.

[0047] like Figure 1 As shown, the video watermarking system provided in this embodiment of the invention includes a terminal 10 and a server 20, etc. The terminal 10 and the server 20 are connected via a network, such as a wired or wireless network. The terminal 10 can serve as a terminal for a user to request the server 20 to download a video to be downloaded.

[0048] The terminal 10 can be used to download a video to be downloaded using at least two video download threads. The video to be downloaded includes video header information and video metadata. The video header information is located at the beginning of the video to be downloaded. The terminal detects the downloaded information of the video download threads. When the downloaded information includes all the information of the video header information, the terminal decapsulates the downloaded information to obtain video frame data corresponding to at least one video frame. The terminal obtains the watermark image corresponding to the video to be downloaded and adds the watermark image to the video frame data to obtain watermarked video frame data. The watermarked video frame data is used to display the video frame with the watermark image when it is played.

[0049] The server 20 can store videos to be downloaded. The server 20 can parse the video to be downloaded to obtain the video header information and the video metadata, either in advance or upon receiving a download request from the terminal 10, and move the video metadata to the beginning of the video to be downloaded.

[0050] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.

[0051] The embodiments of the present invention will be described from the perspective of a video watermarking device, which can be integrated into a terminal.

[0052] like Figure 2 As shown, the specific process of the video watermarking method in this embodiment can be as follows:

[0053] 201. The video to be downloaded is downloaded using at least two video download threads. The video to be downloaded includes video header information and video metadata, and the video header information is located at the beginning of the video to be downloaded.

[0054] In this invention, the video download thread can be a thread scheduled and assigned by the operating system to download videos. Each video download thread targets the video to be downloaded, but the content downloaded by different video download threads can be different.

[0055] Specifically, the video header information describes the video to be downloaded. For example, the video header information may include, but is not limited to, the file format information of the video to be downloaded, the number of video tracks, the number of audio tracks, and so on.

[0056] Among them, video metadata is the specific audio and video stream information in the video to be downloaded, which can control the specific video frames displayed during playback.

[0057] Taking an MP4 video as an example, an MP4 video file can contain three parts: ftyp, moov, and metadata. ftyp and moov are the video header information, while metadata is the video metadata.

[0058] Generally, video header information is stored at the end of the video file during recording. However, complete video header information is required for the processed video to play correctly during video processing. The approach of storing the video header information at the end of the video file has several drawbacks. If using a single-threaded download, the entire video needs to be downloaded to obtain the complete header information. If using a multi-threaded download, the unknown size of the video metadata makes it impossible to instruct the threads to download the header information precisely.

[0059] Therefore, in some optional embodiments, when the cloud receives a download request and sends the video file to be downloaded, it can move the video header information to the beginning of the file. That is, before the step "downloading the video to be downloaded through at least two video download threads", the video watermarking method provided in this embodiment of the invention may further include:

[0060] A download request is sent to the download server of the video to be downloaded, which triggers the download server to parse the video to be downloaded to obtain the video header information and the video metadata, and moves the video metadata to the beginning of the video to be downloaded.

[0061] By moving the video metadata to the beginning of the video to be downloaded, at least one video download thread can be instructed to download from the starting point of the video metadata, i.e., the starting point of the video to be downloaded.

[0062] In some alternative embodiments, the cloud may also process the video header information of the video to be downloaded when the user who published the video to be downloaded uploads the video to the cloud or at any time after it has been uploaded to the cloud.

[0063] In some examples, video metadata can be read in segments when downloading the video to be downloaded. The step "download the video to be downloaded using at least two video download threads" can specifically include:

[0064] The video header information of the video to be downloaded is downloaded through at least one first video download thread;

[0065] The amount of data obtained from the video header information is used to calculate the position offset for reading video metadata based on the amount of data.

[0066] The video metadata is downloaded using at least one second video download thread based on the position offset.

[0067] The first video download thread is a video download thread that downloads the video header information; the second video download thread is a video download thread that downloads the video metadata.

[0068] Optionally, the download of video header information can be done with only one first video download thread or multiple first video download threads; the download of video metadata can be done with only one second video download thread or multiple second video download threads.

[0069] Specifically, during download, the `readAt` method can be used to read the video to be downloaded. The `readAt` method can read the remaining string content by offsetting a certain number of positions without affecting the content being read by the `Read` method. For example, based on the starting position `base`, the read position offset can be calculated as `base + off` according to the input parameter `off`, and then data within the readable range can be read into a byte array starting from that position.

[0070] In practical applications, some operating systems do not support multi-threaded downloads. For example, in Android... Figure 3As shown, if an instruction to export a video is received, it can first determine whether the video data corresponding to the video export instruction is cached. If the video data is cached, it can be read from the cache and then the video watermark can be added.

[0071] If the cache does not contain the video data corresponding to the video export command, it can check if the current operating system version is greater than or equal to 6.0. If the operating system version is lower than 6.0, the complete video file needs to be downloaded over the network. The watermark can only be added after the video is downloaded. If the version requirement is met (i.e., the operating system version is greater than or equal to 6.0), multiple threads (i.e., video download threads) can be started in the readAt method of MediaDataSource to download the video file.

[0072] MediaDataSource is the media data source, which is subsequently passed to MediaExtractor for data reading and distribution. MediaExtractor can be used to read video header information. Furthermore, watermarks can be drawn using OpenGL to obtain watermarked video frame data.

[0073] It is understandable that this example uses the Android system. If any other operating system version supports this video watermarking method, the step of determining the operating system version can be omitted.

[0074] 202. Detect the downloaded information of the video download thread. When the downloaded information includes all the information of the video header information, decapsulate the downloaded information to obtain video frame data corresponding to at least one video frame.

[0075] Specifically, decapsulation refers to the process of separating audio and video information from downloaded data. For example, decapsulation can be performed by constructing a MediaDataSource for transmission.

[0076] The MediaExtractor can read the video header information using its readAt method and then separate the audio and video tracks. Alternatively, decapsulation can be performed using the FFmpeg library to decapsulate the MP4 file, extracting the video and audio streams and outputting them to separate output files.

[0077] Specifically, video frame data refers to data related to the content displayed during playback of the video to be downloaded. In some examples, in VideoTrackTranscoder, MediaCodec can be specified as the decoder to decode the video stream into h264 data and save it to the Surface specified by MediaCodec.

[0078] Specifically, when determining whether all video header information has been downloaded, the end marker of the video header information can be used for judgment. That is, the step "detecting the downloaded information of the video download thread, and when the downloaded information includes all the video header information, decapsulating the downloaded information to obtain video frame data corresponding to at least one video frame" can specifically include:

[0079] Detect whether the downloaded information of the video download thread includes the end identifier information corresponding to the video header information;

[0080] When the downloaded information includes the end identifier information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame.

[0081] For example, multiple threads can be started in the `readAt` method of `MediaDataSource` to download the video file, and the header information can be checked to see if the download is complete. When the end-of-moov flag is detected, it means that the header information has been read completely.

[0082] In some optional embodiments, during decapsulation, it is necessary to decapsulate according to the video track. That is, the step "decapsulating the downloaded information to obtain video frame data corresponding to at least one video frame" may specifically include:

[0083] Obtain the video track attribute information corresponding to the downloaded information;

[0084] Read the video track data corresponding to the video track in the downloaded information;

[0085] Based on the video track attribute information and the video track data, video frame data corresponding to at least one video frame is generated.

[0086] For example, audio or video can be extracted separately using MediaExtractor and MediaMuxer, and the extracted audio and video can be played independently. During decapsulation, the number of tracks in the source file, the MediaFormat of a specific track, and the selection of a specific video track can be obtained. After selecting a track, its data can be read.

[0087] It is understandable that during decapsulation, audio-related information from the video to be downloaded can also be obtained. In some optional embodiments, the step "decapsulating the downloaded information to obtain video frame data corresponding to at least one video frame" may specifically include:

[0088] The downloaded information is decapsulated to obtain audio frame data and video frame data corresponding to at least one video frame.

[0089] For example, such as Figure 4 As shown, downloaded information can be decapsulated using the MediaExtractor to obtain separately playable audio and video streams. Furthermore, the audio stream can be processed in PassThroughTrackTranscoder, and the video stream in VideoTrackTranscoder.

[0090] In Android audio and video development, MediaExtractor is mainly responsible for extracting information and data streams from video or audio, such as separating audio and video from video files.

[0091] Accordingly, when generating a video with a watermark, it is necessary to mix the audio stream data and the video stream. That is to say, the video watermarking method provided in this embodiment of the invention may further include:

[0092] Based on the audio frame data and the watermarked video frame data, audio and video mixing processing is performed to obtain a playable video that displays the watermarked image when played.

[0093] For example, such as Figure 5 As shown, in step 501, the video stream is processed in VideoTrackTranscoder, and after processing in VideoTrackTranscoder, processed video data is obtained; in step 502, the data can be encoded and decoded by MediaCodec (H264), and the processed video data can be transcoded by the encoder MediaCodec to obtain video data in a specific format that can be rendered by OpenGL.

[0094] In step 503, the watermark image is overlaid and drawn in OpenGL (waterMask). OpenGL can overlay the watermark image onto video data of a specific format to obtain the initial watermark video frame data. In step 504, the data can be encoded and decoded by MediaCodec (H264). The initial watermark video frame data is processed by the encoder MediaCodec to obtain the watermark video frame data.

[0095] In some optional embodiments, the watermarked video frame data can be played directly. In other embodiments, in step 505, the watermarked video frame data can be passed to the MediaMuxer mixer, which can mix the watermarked video frame data and audio stream data. After mixing, new media data (such as the MP4 file in step 506) is obtained, and the video can be played.

[0096] 203. Obtain the watermark image corresponding to the video to be downloaded.

[0097] The watermark image is an image containing watermark information. For example, the watermark image can be an image containing text content such as time and location. This embodiment of the invention does not limit the content of the watermark image.

[0098] In this embodiment of the invention, a TextureRenderer can be created, along with an OpenGL vertex shader and a fragment shader. After the program is started, a block of memory is allocated for subsequent rendering of the watermark image.

[0099] OpenGL's vertex and fragment shaders can overlay the texture and color of a watermark image onto random or specified locations within a video frame. Technicians can also configure parameters such as transparency and size when overlaying the watermark image. This embodiment of the invention does not limit the rendering method of the watermark image.

[0100] 204. Add the watermark image to the video frame data to obtain watermarked video frame data, which is used to display the video frame with the watermark image when it is played.

[0101] Optionally, once the video decoding process is ready, a MediaCodec can be created and designated as the encoder. The MediaExtractor will decode each frame from the MediaDataSource as the streaming media downloads. Once a frame is decoded, the TextureRenderer will be notified, and the TextureRenderer will use an OpenGL shader to draw and overlay the watermark image onto the decoded frame data.

[0102] In some optional embodiments, the encoded data can be saved to a specified path. That is, the video watermarking method provided in this embodiment of the invention may further include:

[0103] Get the preset video storage address;

[0104] The playable video is stored in the video storage address.

[0105] Optionally, when storing playable videos, the playable videos can also be stored in a specific video format, such as MP4.

[0106] In this embodiment of the invention, video downloading and watermark addition are processed in parallel, which greatly improves the saving speed compared to the traditional serial method. For example, after testing the two processing methods on the same device, the saving speed can be improved by more than 50%.

[0107] As can be seen from the above, embodiments of the present invention can download videos to be downloaded using at least two video download threads. The videos to be downloaded include video header information and video metadata. The video header information is located at the beginning of the videos to be downloaded. The downloaded information of the video download threads is detected. When the downloaded information includes all the information of the video header information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame. The watermark image corresponding to the videos to be downloaded is obtained and added to the video frame data to obtain watermarked video frame data. The watermarked video frame data is used to display the video frames with the watermark image when played. Since the videos to be downloaded are downloaded using multiple threads in this embodiment of the present invention, and the watermark is added to the video frame data immediately after the video header information of the videos to be downloaded is downloaded, the watermarking process can be performed on the video frames in real time, improving the speed of adding video watermarks and improving the user experience when downloading videos.

[0108] To better implement the above methods, this embodiment of the invention also provides a video watermarking device.

[0109] refer to Figure 6 The device includes:

[0110] The multi-threaded download unit 601 can be used to download a video to be downloaded using at least two video download threads. The video to be downloaded may include video header information and video metadata, and the video header information is located at the beginning of the video to be downloaded.

[0111] The decapsulation unit 602 can be used to detect the downloaded information of the video download thread. When the downloaded information can include all the information of the video header information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame.

[0112] Image acquisition unit 603 can be used to acquire the watermark image corresponding to the video to be downloaded;

[0113] The watermark adding unit 604 can be used to add the watermark image to the video frame data to obtain watermarked video frame data, which can be used to display the video frame with the watermark image when it is played.

[0114] In some alternative embodiments, such as Figure 7 As shown, the video watermarking device provided in this embodiment of the invention may further include an information moving unit 605, which can be used to send a download request to the download server of the video to be downloaded, trigger the download server to parse the video to be downloaded to obtain the video header information and the video metadata, and move the video metadata to the beginning of the video to be downloaded.

[0115] In some optional embodiments, the decapsulation unit 602 can be used to detect whether the downloaded information of the video download thread can include the end identifier information corresponding to the video header information;

[0116] When the downloaded information may include the end identifier information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame.

[0117] In some optional embodiments, the decapsulation unit 602 can be used to obtain video track attribute information corresponding to the downloaded information;

[0118] Read the video track data corresponding to the video track in the downloaded information;

[0119] Based on the video track attribute information and the video track data, video frame data corresponding to at least one video frame is generated.

[0120] In some optional embodiments, the decapsulation unit 602 can be used to decapsulate the downloaded information to obtain audio frame data and video frame data corresponding to at least one video frame.

[0121] The video watermarking device provided in this embodiment of the invention may further include a mixing processing unit 606, which can be used to perform audio and video mixing processing based on the audio frame data and the watermark video frame data to obtain a playable video that displays the watermark image when played.

[0122] In some optional embodiments, the video watermarking device provided in this embodiment of the invention may further include a video storage unit 607, which can be used to obtain a preset video storage address;

[0123] The playable video is stored in the video storage address.

[0124] In some optional embodiments, the multi-threaded download unit 601 can be used to download the video header information of the video to be downloaded through at least one first video download thread;

[0125] The amount of data obtained from the video header information is used to calculate the position offset for reading video metadata based on the amount of data.

[0126] The video metadata is downloaded using at least one second video download thread based on the position offset.

[0127] As can be seen from the above, the video watermarking device allows for the download of a video to be downloaded using at least two video download threads. The video to be downloaded includes video header information and video metadata. The video header information is located at the beginning of the video to be downloaded. The device detects the downloaded information of the video download threads. When the downloaded information includes all the information of the video header information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame. The watermark image corresponding to the video to be downloaded is obtained and added to the video frame data to obtain watermarked video frame data. The watermarked video frame data is used to display the video frame with the watermark image during playback. Since the video to be downloaded is downloaded using multiple threads in this embodiment, and the watermark is added to the video frame data immediately after the video header information of the video to be downloaded is downloaded, the watermarking process can be performed on the video frames in real time, improving the speed of video watermarking and enhancing the user experience when downloading videos.

[0128] Furthermore, embodiments of the present invention also provide an electronic device, which may be a terminal or a server, etc. Figure 8 As shown, it illustrates a structural schematic diagram of the electronic device involved in an embodiment of the present invention, specifically:

[0129] The electronic device may include a radio frequency (RF) circuit 801, a memory 802 including one or more computer-readable storage media, an input unit 803, a display unit 804, a sensor 805, an audio circuit 806, a wireless Fidelity (WiFi) module 807, a processor 808 including one or more processing cores, and a power supply 809, etc. Those skilled in the art will understand that... Figure 8 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0130] in:

[0131] RF circuit 801 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and hands it over to one or more processors 808 for processing; additionally, it transmits uplink data to the base station. Typically, RF circuit 801 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, RF circuit 801 can also communicate wirelessly with networks and other devices. Wireless communication can use any communication standard or protocol, including but not limited to GSM, GPRS, CDMA, WCDMA, LTE, email, and SMS.

[0132] The memory 802 can be used to store software programs and modules. The processor 808 executes various functional applications and data processing by running the software programs and modules stored in the memory 802. The memory 802 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device (such as audio data, telephone directory, etc.). In addition, the memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 802 may also include a memory controller to provide access to the memory 802 for the processor 808 and the input unit 803.

[0133] Input unit 803 can be used to receive input digital or character information, and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. Specifically, in one embodiment, input unit 803 may include a touch-sensitive surface and other input devices. A touch-sensitive surface, also known as a touch display or touchpad, can collect user touch operations on or near it (e.g., user operations using fingers, styluses, or any suitable object or accessory on or near the touch-sensitive surface) and drive corresponding connection devices according to a pre-set program. Optionally, the touch-sensitive surface may include a touch detection device and a touch controller. The touch detection device detects the user's touch orientation and the signal generated by the touch operation, transmitting the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 808, and can receive and execute commands from the processor 808. Furthermore, various types of touch-sensitive surfaces, such as resistive, capacitive, infrared, and surface acoustic wave, can be used. In addition to the touch-sensitive surface, input unit 803 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0134] Display unit 804 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of electronic devices. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Display unit 804 may include a display panel, optionally configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar form. Furthermore, a touch-sensitive surface may cover the display panel. When the touch-sensitive surface detects a touch operation on or near it, it transmits the information to processor 808 to determine the type of touch event. Subsequently, processor 808 provides corresponding visual output on the display panel according to the type of touch event. Although in Figure 8 In this context, the touch-sensitive surface and the display panel are two separate components for implementing input and output functions. However, in some embodiments, the touch-sensitive surface and the display panel can be integrated to achieve both input and output functions.

[0135] Electronic devices may also include at least one sensor 805, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel according to the ambient light level, and the proximity sensor can turn off the display panel and / or backlight when the electronic device is moved to the ear. As a type of motion sensor, a gravity acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometers, taps), etc. Other sensors that may be configured in electronic devices, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0136] Audio circuitry 806, a speaker, and a microphone provide an audio interface between the user and the electronic device. Audio circuitry 806 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 806, converted back into audio data, and processed by processor 808. The processed data is then transmitted via RF circuitry 801 to, for example, another electronic device, or output to memory 802 for further processing. Audio circuitry 806 may also include an earphone jack to facilitate communication between peripheral headphones and the electronic device.

[0137] WiFi is a short-range wireless transmission technology. Electronic devices using the WiFi module 807 can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 8 WiFi module 807 is shown, but it is understood that it is not a necessary component of an electronic device and can be omitted as needed without changing the nature of the invention.

[0138] The processor 808 is the control center of the electronic device, connecting various parts of the phone via various interfaces and lines. It executes various functions and processes data by running or executing software programs and / or modules stored in the memory 802, and by calling data stored in the memory 802. Optionally, the processor 808 may include one or more processing cores; preferably, the processor 808 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 808.

[0139] The electronic device also includes a power supply 809 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 808 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 809 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0140] Although not shown, the electronic device may also include a camera, Bluetooth module, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 808 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 802 according to the following instructions, and the processor 808 runs the applications stored in the memory 802 to realize various functions, as follows:

[0141] The video to be downloaded is downloaded using at least two video download threads. The video to be downloaded includes video header information and video metadata, with the video header information located at the beginning of the video to be downloaded.

[0142] The downloaded information of the video download thread is detected. When the downloaded information includes all the information of the video header information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame.

[0143] Obtain the watermark image corresponding to the video to be downloaded;

[0144] The watermark image is added to the video frame data to obtain watermarked video frame data, which is used to display the video frame with the watermark image when it is played.

[0145] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0146] Therefore, embodiments of the present invention provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute the steps in any of the video watermarking methods provided in the embodiments of the present invention. For example, the instructions can execute the following steps:

[0147] The video to be downloaded is downloaded using at least two video download threads. The video to be downloaded includes video header information and video metadata, with the video header information located at the beginning of the video to be downloaded.

[0148] The downloaded information of the video download thread is detected. When the downloaded information includes all the information of the video header information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame.

[0149] Obtain the watermark image corresponding to the video to be downloaded;

[0150] The watermark image is added to the video frame data to obtain watermarked video frame data, which is used to display the video frame with the watermark image when it is played.

[0151] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0152] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0153] Since the instructions stored in the computer-readable storage medium can execute the steps of any of the video watermarking methods provided in the embodiments of the present invention, the beneficial effects that any of the video watermarking methods provided in the embodiments of the present invention can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0154] According to one aspect of this application, a computer program product or computer program is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in the various optional implementations of the above embodiments.

[0155] The above provides a detailed description of a video watermarking method, apparatus, electronic device, and storage medium provided by embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for adding a video watermark, characterized in that, include: The video header information of the video to be downloaded is downloaded by at least one first video download thread to obtain the data volume of the video header information. The position offset for reading video metadata is calculated based on the data volume. The video metadata is downloaded by at least one second video download thread according to the position offset. The video to be downloaded includes video header information and video metadata. The video header information is located at the beginning of the file of the video to be downloaded. The downloaded information of the video download thread is detected. When the downloaded information includes all the information of the video header information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame. Obtain the watermark image corresponding to the video to be downloaded; The watermark image is added to the video frame data to obtain watermarked video frame data, which is used to display the video frame with the watermark image when it is played.

2. The video watermarking method according to claim 1, characterized in that, Before downloading the video header information of the video to be downloaded through at least one first video download thread, the method further includes: A download request is sent to the download server of the video to be downloaded, which triggers the download server to parse the video to be downloaded to obtain the video header information and the video metadata, and moves the video header information to the beginning of the file of the video to be downloaded.

3. The video watermarking method according to claim 1, characterized in that, The process of detecting the downloaded information of the video download thread, and when the downloaded information includes all the information of the video header, decapsulating the downloaded information to obtain video frame data corresponding to at least one video frame, includes: Detect whether the downloaded information of the video download thread includes the end identifier information corresponding to the video header information; When the downloaded information includes the end identifier information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame.

4. The video watermarking method according to claim 1, characterized in that, The step of decapsulating the downloaded information to obtain video frame data corresponding to at least one video frame includes: Obtain the video track attribute information corresponding to the downloaded information; Read the video track data corresponding to the video track in the downloaded information; Based on the video track attribute information and the video track data, video frame data corresponding to at least one video frame is generated.

5. The video watermarking method according to claim 1, characterized in that, The step of decapsulating the downloaded information to obtain video frame data corresponding to at least one video frame includes: The downloaded information is decapsulated to obtain audio frame data and video frame data corresponding to at least one video frame; The method further includes: Based on the audio frame data and the watermarked video frame data, audio and video mixing processing is performed to obtain a playable video that displays the watermarked image when played.

6. The video watermarking method according to claim 5, characterized in that, The method further includes: Get the preset video storage address; The playable video is stored in the video storage address.

7. A video watermarking device, characterized in that, include: A multi-threaded download unit is used to download the video header information of the video to be downloaded through at least one first video download thread, obtain the data volume of the video header information, calculate the position offset for reading video metadata based on the data volume, and download the video metadata according to the position offset through at least one second video download thread. The video to be downloaded includes video header information and video metadata, and the video header information is located at the beginning of the file of the video to be downloaded. The decapsulation unit is used to detect the downloaded information of the video download thread. When the downloaded information includes all the information of the video header information, the downloaded information is decapsulated to obtain video frame data corresponding to at least one video frame. The image acquisition unit is used to acquire the watermark image corresponding to the video to be downloaded; A watermark adding unit is used to add the watermark image to the video frame data to obtain watermarked video frame data, which is used to display the video frame with the watermark image when it is played.

8. An electronic device, characterized in that, It includes a memory and a processor; the memory stores an application program, and the processor runs the application program within the memory to perform the steps of the video watermarking method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the video watermarking method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the video watermarking method as described in any one of claims 1 to 6.