Media data security protection method and system based on blockchain
By calculating the content similarity and watermark detection index of video frames, and using the image pyramid algorithm to determine the watermark insertion position, it solves the problems of low watermark security and affecting viewing experience in the existing technology, and achieves higher watermark security and accuracy. .
Patent Information
- Application Number
- CN202410725419.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-06-06
AI Technical Summary
Existing simple watermark adding methods have low security when inserting watermarks into videos, are easily tampered with or removed, and affect the audience's viewing experience.
By obtaining the media video to be protected, presetting multiple scales and window sizes, calculating the content similarity and watermark detection index of video frames, using the image pyramid algorithm and interpolation algorithm to determine the watermark insertion position, and clustering video frames to reduce the amount of calculation. Improve the accuracy and security of watermark insertion.
It improves the security of watermarks in media videos, reduces the impact on the audience's viewing experience, enhances the accuracy of the watermark insertion position, makes it difficult to tamper, and reduces the amount of calculation.
Smart Images

Figure CN118317167B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image data processing, and in particular to a media data security protection method and system based on blockchain. Background Art
[0002] Media data refers to various information and statistics related to media content, including but not limited to content data, user data, interaction data, traffic data, etc. Inserting watermarks into videos and pictures in media data is a common way to protect media data. Combined with the tamper-proof nature of blockchain technology, it can provide strong content protection for media data. Therefore, it is necessary to add watermarks to the media videos to be protected in the blockchain.
[0003] The existing simple watermarking method is to protect the media data by superimposing text, images or logos at a fixed position in each video frame. This method has low security and is easily tampered or removed by others. In addition, because each video frame is different from other video frames, the optimal watermark insertion position of each video frame is different from the optimal watermark insertion position of other video frames. As a result, when inserting a watermark in a video using the simple watermarking method, it will affect the audience's viewing experience of the media content. Summary of the invention
[0004] The present invention provides a media data security protection method and system based on blockchain to solve the existing problems.
[0005] The blockchain-based media data security protection method and system of the present invention adopts the following technical solutions:
[0006] The present invention proposes a media data security protection method based on blockchain, which includes the following steps:
[0007] Acquire a media video to be protected and obtain a video frame data set including a plurality of video frames;
[0008] Preset multiple scales, and divide each video frame into multiple local ranges at each scale; obtain the content similarity between any two video frames according to the distribution of pixel gray values in the local ranges at different scales in each video frame; cluster the video frames in the video frame data set according to the content similarity between any two video frames to obtain multiple clusters and multiple representative video frames;
[0009] The window size is preset to divide the representative video frame into multiple windows; according to the grayscale value and The difference and distribution of channel values, as well as the gradient values of pixels, are used to obtain the watermark perception index for each window in each representative video frame;
[0010] Through the image pyramid algorithm and the interpolation algorithm, the sampled image of each representative video frame after each downsampling is obtained; in the representative video frame and the sampled image after each downsampling, the visual blur degree of each window in each representative video frame is obtained according to the difference in the gradient value and grayscale distribution of the pixel points in each window;
[0011] According to the visual blur degree and watermark perception index of each window in each representative video frame, the watermark insertion preference of each window in each representative video frame is obtained, and then the watermark insertion position of each video frame is obtained.
[0012] Furthermore, the step of obtaining the media video to be protected and obtaining a video frame data set including a plurality of video frames includes the following specific steps:
[0013] Obtain the media video to be protected, use a video decoder to read the media video to be protected, and restore the media video to be protected to the original frame; convert the original frame into multiple individual video frames to obtain an initial data set consisting of multiple individual video frames;
[0014] A sampling interval is preset, and individual video frames are sampled from the initial data set to obtain a number of sampled individual video frames; the sampled individual video frames are recorded as video frames to obtain a video frame data set.
[0015] Furthermore, the method of obtaining the content similarity of any two video frames according to the distribution of the grayscale values of the pixels in the local range at different scales in each video frame includes the following specific steps:
[0016] Obtaining the structural similarity index between each local range of each video frame and each local range of other video frames at the same scale;
[0017] According to the structural similarity index between the local range of each video frame and the local range of other video frames at each scale, the content similarity between any two video frames is obtained. The specific calculation formula is as follows:
[0018] ;
[0019] In the formula, Indicates The video frame and The similarity of the content of the video frames Indicates that each video frame is The number of local ranges contained in each scale, Indicates The scale The first video frame The local scope and The first video frame A local structural similarity index, Indicates the number of preset scales, Represents the normalization function.
[0020] Furthermore, the video frames in the video frame data set are clustered according to the similarity of the contents of any two video frames to obtain a plurality of clusters and a plurality of representative video frames, and the specific steps include the following:
[0021] The similarity of the contents of any two video frames is used as a distance metric;
[0022] The video frames in the video frame dataset are clustered into multiple clusters using the DBSCAN clustering algorithm;
[0023] The average of the similarities between any video frame and other video frames in the same cluster is recorded as the possibility that the video frame is a representative video frame; the video frame with the greatest possibility of being a representative video frame in any cluster is recorded as the representative video frame of the cluster.
[0024] Furthermore, the preset window size divides the representative video frame into a plurality of windows, and the specific steps include the following:
[0025] Through the size of Each representative video frame is divided into multiple windows. Indicates the preset window side length.
[0026] Furthermore, the grayscale value of each pixel in each window in each representative video frame and The difference and distribution of channel values and the gradient value of pixel points are used to obtain the watermark perception index of each window in each video frame, including the following specific steps:
[0027] Get the gradient value of each pixel in each representative video frame;
[0028] According to the gray value of each pixel in each window in each representative video frame, The channel value, gradient value, the position of each window in each representative video frame, and the distribution of the grayscale value of each pixel in each window are used to obtain the watermark perception index of each window in each representative video frame. The specific calculation formula is as follows:
[0029] ;
[0030] In the formula, Indicates represents the first The watermark perception index of the window is Indicates The number of pixels contained in a window, Indicates represents the first In the window The gray value of a pixel, Indicates represents the first In the window Pixels Channel value, Indicates The Euclidean distance between the central pixel point in the window and the central pixel point representing the video frame is Indicates represents the first The mean grayscale value of the pixels in the window is Indicates represents the first The variance of the grayscale value of the pixel in the window is Indicates represents the first The mean value of the gradient of the pixels in the window.
[0031] Furthermore, the method of obtaining a sampled image of each representative video frame after each downsampling by using an image pyramid algorithm and an interpolation algorithm includes the following specific steps:
[0032] The default downsampling scale is , the preset downsampling times are , using the preset downsampling scale and downsampling times, using the image pyramid algorithm, downsampling each representative video frame to obtain an image pyramid for each representative video frame;
[0033] An interpolation process is performed on the image of each representative video frame after each downsampling to obtain a sampled image of each representative video frame after each downsampling, wherein the sampled image of each representative video frame after each downsampling has the same size as the image of each representative video frame.
[0034] Furthermore, in the representative video frame and the sampled image after each downsampling, the visual blur degree of each window in each representative video frame is obtained according to the difference in gradient value and grayscale distribution of the pixel points in each window, and the specific steps include the following:
[0035] Obtaining the gradient value of each pixel in the sampled image of each representative video frame after each downsampling;
[0036] In each representative video frame and its sampled image after each downsampling, the visual blur degree of each window in each representative video frame is obtained according to the gray value, gradient value of the pixel point in each window and the structural similarity index between the representative video frame and the same window of its sampled image. The specific calculation formula is as follows:
[0037] ;
[0038] ;
[0039] In the formula, Indicates represents the first The degree of visual blur of each window, Indicates represents the first The window in The degree of blur during the downsampling process, Indicates The number of pixels contained in a window, Indicates represents the first In the window The gray value of a pixel, Indicates represents the video frame in After the downsampling, the sampled image In the window The gray value of a pixel, Indicates represents the video frame in After the downsampling, the sampled image The mean gradient of the pixels in the window is represents the first The absolute value of the difference in the mean gradient of the pixels in the window, Indicates represents the video frame in After the downsampling, the sampled image The mean gradient of the pixels in the window is Indicates represents the video frame in After the downsampling, the sampled image The window and represents the first The structural similarity index of the windows, Indicates the preset number of downsampling times.
[0040] Furthermore, the method of obtaining the watermark insertion preference of each window in each representative video frame according to the visual blur degree of each window in each representative video frame and the watermark perception index, and then obtaining the watermark insertion position of each video frame, includes the following specific steps:
[0041] ;
[0042] In the formula, Indicates represents the first The watermark insertion preference of each window, Indicates represents the first The watermark perception index of the window is Indicates represents the first The degree of visual blur of each window, represents the normalization function;
[0043] The first The area corresponding to the window with the highest watermark insertion preference in the video frame is represented by represents the watermark insertion position within the video frame;
[0044] The first The watermark insertion position of each video frame in the cluster representing the video frame is set to represents the watermark insertion position of the video frame, and gets represents the watermark insertion position of each video frame in the cluster where the video frame belongs.
[0045] The present invention also proposes a media data security protection system based on blockchain, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the aforementioned media data security protection method and system based on blockchain.
[0046] The beneficial effects of the technical solution of the present invention are as follows: by preprocessing the media video to be protected, a number of video frames are obtained. Before calculating the watermark insertion position of each video frame, the distribution of the grayscale values of the pixels in each video frame is used to obtain the content similarity of any two video frames, and multiple clusters are obtained by clustering. In each cluster, only the watermark insertion position of one video frame is calculated, and it is not necessary to calculate the watermark insertion positions of all video frames in each cluster, thereby reducing the amount of calculation; based on the fact that the human eye is more sensitive to green light than to blue light and red light, and that the corners of an image are usually not in the central field of view of the human eye, and that the more texture information each region contains, the greater the masking effect of this region on the watermark The better the effect, the watermark perception index of the area with less impact on the audience's viewing experience is smaller than the watermark perception index of the area with greater impact on the audience's viewing experience, which paves the way for obtaining the watermark insertion position of each video frame; by performing multiple downsampling on each representative video frame to simulate different distances between the human eye and the screen, the visual blur degree of each window obtained based on the texture change degree of the same window in the same representative video frame before and after downsampling is more credible, making the watermark insertion position of each video frame more accurate, thereby increasing the difficulty of tampering with watermarks in media videos and reducing the impact of watermarks in media videos on the audience's viewing experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0048] Figure 1 This is a flowchart of the steps of the media data security protection method based on blockchain of the present invention. DETAILED DESCRIPTION
[0049] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation, structure, features and effects of the media data security protection method and system based on blockchain proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0050] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0051] The specific scheme of the media data security protection method and system based on blockchain provided by the present invention is described in detail below with reference to the accompanying drawings.
[0052] See also Figure 1 , which shows a flowchart of a method for protecting media data security based on blockchain provided by an embodiment of the present invention, the method comprising the following steps:
[0053] Step S001: Acquire a media video to be protected and obtain a video frame data set including a plurality of video frames.
[0054] The purpose of this embodiment is to perform security protection on media videos, so the media videos to be protected are obtained and pre-processed.
[0055] Specifically, the media video to be protected is obtained, and the media video to be protected is read using a video decoder, and the media video to be protected is restored to the original frame. The original frame is converted into multiple separate video frames through existing tools such as Ffmpeg to obtain an initial data set consisting of several separate video frames.
[0056] It should be noted that, since there are often a large number of video frames in a video, in order to reduce the time cost of the subsequent watermark adding operation, only a few video frames need to be watermarked. Therefore, the video frames to be watermarked are obtained.
[0057] Specifically, set the sampling interval to Frames, sampling individual video frames from the initial data set to obtain a number of sampled individual video frames, the sampled individual video frames are recorded as video frames, and a video frame data set is obtained. The sampling interval preset in this embodiment is , which is described by taking this as an example, and other implementations may be set to other values. Among them, the video frames in the video frame data set are the video frames to be watermarked.
[0058] At this point, the video frame is obtained.
[0059] Step S002: Preset multiple scales, and divide each video frame into multiple local ranges at each scale; obtain the content similarity between any two video frames according to the distribution of pixel grayscale values in the local ranges at different scales in each video frame; cluster the video frames in the video frame data set according to the content similarity between any two video frames to obtain multiple clusters and multiple representative video frames.
[0060] It should be noted that the contents of some video frames in the video frame data set are relatively similar, so that the watermark insertion positions in some video frames are relatively similar. Therefore, in order to reduce the amount of calculation, the video frames with relatively similar contents can be clustered into a cluster so that the watermark insertion position in each video frame in each cluster is exactly the same. By calculating the watermark insertion position in a video frame in each cluster, the watermark insertion position in each video frame in each cluster is obtained, thereby reducing the amount of calculation.
[0061] It should be further explained that the structural similarity index is an indicator for measuring the similarity between two images. Therefore, the structural similarity index is used to quantify the content similarity between any two video frames. And if the two images are smaller, the credibility of the structural similarity index reflecting the content similarity between the two images is stronger. Therefore, multiple scales are preset, and each video frame is divided into multiple local ranges through each scale, and the structural similarity index of the local range of each video frame and the local range of other video frames at the same scale is obtained, and finally the content similarity between any two video frames is obtained.
[0062] Specifically, multiple scales are preset, and each video frame is divided into multiple local ranges according to each scale; For example, the scale is , the side length is The local scope of The video frame is divided into multiple local ranges. When dividing the local range, if the pixels in a certain area are not enough to fill the size of The local range of each video frame at each scale does not contain pixels with the same position, that is, the local ranges at the same scale do not overlap. , the maximum value of the scale preset in this embodiment , this is used as an example for description, and other values may be set in other implementation modes.
[0063] Through the above method, at each scale, each video frame is divided into multiple local ranges.
[0064] Furthermore, a structural similarity index between a local range of each video frame and a local range of other video frames at the same scale is obtained. The structural similarity index is referred to as SSIM index in English, which is a well-known technology and will not be described in detail in this embodiment.
[0065] Furthermore, the content similarity between any two video frames is obtained by calculating the structural similarity index between the local range of each video frame and the local range of other video frames at each scale. The specific calculation formula is as follows:
[0066] ;
[0067] In the formula, Indicates The video frame and The similarity of the content of the video frames Indicates that each video frame is The number of local ranges contained in each scale, Indicates The scale The first video frame The local scope and The first video frame A local structural similarity index, Indicates the number of preset scales, Represents a linear normalization function, the normalized object is any two video frames .
[0068] Furthermore, the similarity of the contents of any two video frames is used as a distance metric; the video frames in the video frame data set are clustered into multiple clusters using the DBSCAN clustering algorithm. The Chinese name of the DBSCAN clustering algorithm is density-based clustering algorithm, which is a well-known technology and will not be described in detail in this embodiment.
[0069] Furthermore, the average of the similarities between any video frame and other video frames in the same cluster is recorded as the possibility of the video frame being a representative video frame. The video frame with the greatest possibility of being a representative video frame in any cluster is recorded as the representative video frame of the cluster.
[0070] At this point, the video frames in the video frame dataset are clustered into multiple clusters, and the representative video frames of each cluster are obtained.
[0071] Step S003: Preset the window size and divide the representative video frame into multiple windows; obtain the watermark perception index of each window in each representative video frame according to the difference and distribution of the grayscale value and G channel value of the pixel points in each window in each representative video frame, as well as the gradient value of the pixel points.
[0072] It should be noted that since the watermark in the image is usually in a certain size area, the window size is preset to divide each representative video frame into multiple windows.
[0073] It should be further explained that since the corners of an image are usually not in the central field of vision of the human eye, adding a watermark in the corner area of an image often does not have a significant impact on the viewing experience of the audience. Therefore, according to the position of each window in the representative video frame, the watermark perception index of each window in each representative video frame is calculated. Since the human eye is more sensitive to green light than to red and blue light, the watermark perception index of each window is calculated based on the grayscale value of the pixel point in each window and the watermark perception index of the pixel point point in each window. Channel value, calculate the watermark perception index of each window in each representative video frame. Since it is difficult for the human eye to perceive watermarks in shadow areas or dark areas, the watermark perception index of each window in each video frame is calculated based on the grayscale value of each pixel in each window. Since watermark information can be better hidden in areas with rich texture information, that is, adding a watermark in an area with rich texture information will increase the difficulty of removing the watermark and reduce the impact of the watermark on the audience's viewing experience. Therefore, based on the texture information contained in each window, the watermark perception index of each window in each video frame is calculated. In addition, the texture information contained in each window is mainly related to the distribution of the grayscale values of the pixels in each window. Therefore, the watermark perception index of each window in each video frame is calculated through the distribution of the grayscale values of the pixels in each window.
[0074] Specifically, the size is Each representative video frame is divided into multiple windows. The window side length preset in this embodiment is , this is used as an example for description, and other implementations may be set to other values. When the number of pixels in a certain area is insufficient to fill the size The actual situation shall prevail. The operator obtains the gradient value of each pixel in each representative video frame. The Sobel operator is a well-known technology and will not be described in detail in this embodiment.
[0075] Further, according to the gray value of each pixel in each window in each representative video frame, The channel value, gradient value, the position of each window in each representative video frame, and the distribution of the grayscale value of each pixel in each window are used to obtain the watermark perception index of each window in each representative video frame. The specific calculation formula is as follows:
[0076] ;
[0077] In the formula, Indicates represents the first The watermark perception index of the window is Indicates The number of pixels contained in a window, Indicates represents the first In the window The gray value of a pixel, Indicates represents the first In the window Pixels Channel value, Indicates The Euclidean distance between the central pixel point in the window and the central pixel point representing the video frame is Indicates represents the first The mean grayscale value of the pixels in the window is Indicates represents the first The variance of the grayscale value of the pixel in the window is Indicates represents the first The mean value of the gradient of the pixels in the window.
[0078] It should be noted that Indicates represents the first In the window The green degree of a pixel point, the larger the value, the more sensitive the human eye is to the first pixel point. represents the first In the window The higher the sensitivity of each pixel; Indicates represents the first The brightness of the window is higher. The higher the value, the brighter the window is. represents the first The higher the visibility of the window, the higher the represents the first The more watermarks are in the first window, the easier it is for the human eye to see the second window. represents the first Watermark in each window; Indicates represents the first The texture information contained in the window, the larger the value, the more represents the first The more watermarks are in the first window, the harder it is for the human eye to see the second window. represents the first Watermark in each window; Indicates represents the first The larger the mean value, the richer the texture information in the area, and the stronger the degree of watermark concealment in this area.
[0079] At this point, the watermark perception index of each window in each video frame is obtained.
[0080] Step S004: Obtain a sampled image of each representative video frame after each downsampling by using an image pyramid algorithm and an interpolation algorithm; obtain the visual blur degree of each window in each representative video frame according to the difference in gradient values and grayscale distribution of pixels in each window in the representative video frame and its sampled image after each downsampling.
[0081] It should be noted that when people watch media videos through the screen, if the human eye is too far away from the screen, due to the limitation of the human eye resolution, the tiny pixels will exceed the resolution ability of the eyes, causing the video to look more blurred. In addition, the distribution of the grayscale values of the pixels in each area may be different from the distribution of the grayscale values of the pixels in other areas, resulting in different blur levels in different areas when the human eye is too far away from the screen. Therefore, the blur level of each window in each representative video frame is calculated, and the watermark insertion position of each window is obtained according to the blur level of each window in each representative video frame. When the distance between the human eye and the screen gradually increases, the screen in the human eye gradually becomes smaller; downsampling the image also makes the image smaller. Therefore, by downsampling the image, the distance between the human eye and the screen is simulated. When different people watch media videos, the distance between the human eye and the screen may be different, so that the screen size in different people's eyes may be different. Therefore, the representative video frame is downsampled multiple times to simulate different distances between the human eye and the screen.
[0082] It should be further explained that the blur degree of each window in the representative video frame refers to the degree of texture change of the pixels in each window before and after downsampling. Because the size of the downsampled image is different from the size of the original image. Therefore, the downsampled image is preprocessed so that the downsampled image has the same size as the image of the representative video frame, and the visual blur degree of each window is obtained according to the degree of texture change of the same window in the same representative video frame before and after downsampling.
[0083] Specifically, the preset downsampling scale is , the preset downsampling times are , through the image pyramid algorithm, each representative video frame is subjected to multiple downsampling processes to obtain an image pyramid for each representative video frame. The downsampling scale preset in this embodiment is , the preset number of downsampling times , this is used as an example for description, and other values may be set in other implementation modes.
[0084] Further, the image of each representative video frame after each downsampling is interpolated to obtain a sampled image of each representative video frame after each downsampling, and the sampled image of each representative video frame after each downsampling is made to have the same size as the image of each representative video frame. The interpolation algorithm is a well-known technique and is not described in detail in this embodiment. The gradient value of each pixel in the sampled image of each representative video frame after each downsampling is obtained by using the Sobel operator. The Sobel operator is a well-known technique and is not described in detail in this embodiment.
[0085] No. represents the first The window in The blur level during the downsampling process is , the specific calculation formula is as follows:
[0086] ;
[0087] No. represents the first The visual blur level of the window is , the specific calculation formula is as follows:
[0088] ;
[0089] In the formula, Indicates represents the first The degree of visual blur of each window, Indicates represents the first The window in The degree of blur during the downsampling process, Indicates The number of pixels contained in a window, Indicates represents the first In the window The gray value of a pixel, Indicates represents the video frame in After the downsampling, the sampled image In the window The gray value of a pixel, Indicates represents the video frame in After the downsampling, the sampled image The mean gradient of the pixels in the window is represents the first The absolute value of the difference in the mean gradient of the pixels in the window, Indicates represents the video frame in After the downsampling, the sampled image The mean gradient of the pixels in the window is Indicates represents the video frame in After the downsampling, the sampled image The window and represents the first The structural similarity index of the windows, Indicates the preset number of downsampling times.
[0090] It should be noted that The larger the value, the represents the first The greater the visual blur of the window, the represents the first The more blurriness the watermark is inserted into each window.
[0091] Thus, the visual blur level of each window in each representative video frame is obtained.
[0092] Step S005: According to the visual blur level and watermark perception index of each window in each representative video frame, the watermark insertion preference of each window in each representative video frame is obtained, and then the watermark insertion position of each video frame is obtained.
[0093] Specifically, according to the visual blur degree and watermark perception index of each window in each representative video frame, the watermark insertion preference of each window in each representative video frame is obtained, and the specific calculation formula is as follows:
[0094] ;
[0095] In the formula, Indicates represents the first The watermark insertion preference of each window, Indicates represents the first The watermark perception index of the window is Indicates represents the first The degree of visual blur of each window, Represents a linear normalization function, and the normalized object is the represents each window in the video frame .
[0096] It should be noted that When the watermark insertion preference of different regions in the video frame is analyzed, represents the first The lower the watermark perception index of a window and the higher the blurriness of the area, the smaller the impact on the audience's viewing experience when the watermark is inserted into the area and the higher the security of the media video.
[0097] Further, get the represents the watermark insertion preference of each window in the video frame. The area corresponding to the window with the highest watermark insertion preference in the video frame is represented by represents the watermark insertion position in the video frame. The watermark insertion position of each video frame in the cluster representing the video frame is set to represents the watermark insertion position of the video frame, and gets represents the watermark insertion position of each video frame in the cluster where the video frame belongs.
[0098] At this point, the watermark insertion position of each video frame in each cluster is obtained.
[0099] According to the watermark insertion position of each video frame, the creator information of the current video is inserted into it. After the watermark is inserted into the video frame, the size and transparency of the watermark are adjusted according to the grayscale information of the watermark position. Finally, the processed video frame and the separate video frame are re-encoded into a video file to complete the insertion of the watermark in the video.
[0100] Test the watermarked video to ensure that the watermark can be displayed correctly in different playback environments and devices, and store the processed video file or its hash value in the blockchain to achieve copyright certification and verification, completing blockchain-based media data security protection.
[0101] At this point, this embodiment is completed.
[0102] The present invention also provides a blockchain-based media data security protection system, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the aforementioned blockchain-based media data security protection method.
[0103] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A media data security protection method based on blockchain, characterized in that: The method comprises the following steps: Acquire a media video to be protected and obtain a video frame data set including a plurality of video frames; Preset multiple scales, and divide each video frame into multiple local ranges at each scale; obtain the content similarity between any two video frames according to the distribution of pixel gray values in the local ranges at different scales in each video frame; cluster the video frames in the video frame data set according to the content similarity between any two video frames to obtain multiple clusters and multiple representative video frames; The window size is preset to divide the representative video frame into multiple windows; according to the grayscale value and The difference and distribution of channel values, as well as the gradient values of pixels, are used to obtain the watermark perception index for each window in each representative video frame; Through the image pyramid algorithm and the interpolation algorithm, the sampled image of each representative video frame after each downsampling is obtained; in the representative video frame and the sampled image after each downsampling, the visual blur degree of each window in each representative video frame is obtained according to the difference in the gradient value and grayscale distribution of the pixel points in each window; According to the visual blur degree and watermark perception index of each window in each representative video frame, the watermark insertion preference of each window in each representative video frame is obtained, and then the watermark insertion position of each video frame is obtained; The grayscale value of each pixel point in each window in each representative video frame and The difference and distribution of channel values and the gradient value of pixel points are used to obtain the watermark perception index of each window in each video frame, including the following specific steps: Get the gradient value of each pixel in each representative video frame; According to the gray value of each pixel in each window in each representative video frame, The channel value, gradient value, the position of each window in each representative video frame, and the distribution of the grayscale value of each pixel in each window are used to obtain the watermark perception index of each window in each representative video frame. The specific calculation formula is as follows: ; In the formula, Indicates represents the first The watermark perception index of the window is Indicates The number of pixels contained in a window, Indicates represents the first In the window The gray value of a pixel, Indicates represents the first In the window Pixels Channel value, Indicates The Euclidean distance between the central pixel point in the window and the central pixel point representing the video frame is Indicates represents the first The mean grayscale value of the pixels in the window is Indicates represents the first The variance of the grayscale value of the pixel in the window is Indicates represents the first The mean value of the gradient of the pixels in the window.
2. The method for protecting media data security based on blockchain according to claim 1 is characterized in that: The step of obtaining the media video to be protected and obtaining a video frame data set including a plurality of video frames includes the following specific steps: Obtain the media video to be protected, use a video decoder to read the media video to be protected, and restore the media video to be protected to the original frame; convert the original frame into multiple individual video frames to obtain an initial data set consisting of multiple individual video frames; A sampling interval is preset, and individual video frames are sampled from the initial data set to obtain a number of sampled individual video frames; the sampled individual video frames are recorded as video frames to obtain a video frame data set.
3. According to the blockchain-based media data security protection method of claim 1, it is characterized in that: The specific steps of obtaining the content similarity of any two video frames according to the distribution of the grayscale values of the pixels in the local range at different scales in each video frame are as follows: Obtaining the structural similarity index between each local range of each video frame and each local range of other video frames at the same scale; According to the structural similarity index between the local range of each video frame and the local range of other video frames at each scale, the content similarity between any two video frames is obtained. The specific calculation formula is as follows: ; In the formula, Indicates The video frame and The similarity of the content of the video frames Indicates that each video frame is The number of local ranges contained in each scale, Indicates The scale The first video frame The local scope and The first video frame A local structural similarity index, Indicates the number of preset scales, Represents the normalization function.
4. According to the blockchain-based media data security protection method of claim 3, it is characterized in that: The method of clustering the video frames in the video frame data set according to the similarity of the contents of any two video frames to obtain multiple clusters and multiple representative video frames includes the following specific steps: The similarity of the contents of any two video frames is used as a distance metric; The video frames in the video frame dataset are clustered into multiple clusters using the DBSCAN clustering algorithm; The average of the similarities between any video frame and other video frames in the same cluster is recorded as the possibility that the video frame is a representative video frame; the video frame with the greatest possibility of being a representative video frame in any cluster is recorded as the representative video frame of the cluster.
5. According to the blockchain-based media data security protection method of claim 1, it is characterized in that: The preset window size divides the representative video frame into multiple windows, and the specific steps include the following: Through the size of Each representative video frame is divided into multiple windows. Indicates the preset window side length.
6. The method for protecting media data security based on blockchain according to claim 1 is characterized in that: The method of obtaining a sampled image of each representative video frame after each downsampling by using an image pyramid algorithm and an interpolation algorithm includes the following specific steps: The default downsampling scale is , the preset downsampling times is , using the preset downsampling scale and downsampling times, using the image pyramid algorithm, downsampling each representative video frame to obtain an image pyramid for each representative video frame; An interpolation process is performed on the image of each representative video frame after each downsampling to obtain a sampled image of each representative video frame after each downsampling, wherein the sampled image of each representative video frame after each downsampling has the same size as the image of each representative video frame.
7. The method for protecting media data security based on blockchain according to claim 1 is characterized in that: The visual blur degree of each window in each representative video frame is obtained according to the difference in gradient value and grayscale distribution of pixel points in each window in the representative video frame and the sampled image after each downsampling, and the specific steps include the following: Obtaining the gradient value of each pixel in the sampled image of each representative video frame after each downsampling; In each representative video frame and its sampled image after each downsampling, the visual blur degree of each window in each representative video frame is obtained according to the gray value, gradient value of the pixel point in each window and the structural similarity index between the representative video frame and the same window of its sampled image. The specific calculation formula is as follows: ; ; In the formula, Indicates represents the first The degree of visual blur of each window, Indicates represents the first The window in The degree of blur during the downsampling process, Indicates represents the first In the window The gray value of a pixel, Indicates represents the video frame in After the downsampling, the sampled image In the window The gray value of a pixel, Indicates represents the video frame in After the downsampling, the sampled image The mean gradient of the pixels in the window is represents the first The absolute value of the difference in the mean gradient of the pixels in the window, Indicates represents the video frame in After the downsampling, the sampled image The mean gradient of the pixels in the window is Indicates represents the video frame in After the downsampling, the sampled image The window and represents the first The structural similarity index of the windows, Indicates the preset number of downsampling times.
8. The method for protecting media data security based on blockchain according to claim 1 is characterized in that: The method of obtaining the watermark insertion preference of each window in each representative video frame according to the visual blur degree of each window in each representative video frame and the watermark perception index, and then obtaining the watermark insertion position of each video frame, includes the following specific steps: ; In the formula, Indicates represents the first The watermark insertion preference of each window, Indicates represents the first The degree of visual blur of each window, represents the normalization function; The first The area corresponding to the window with the highest watermark insertion preference in the video frame is represented by represents the watermark insertion position within the video frame; The first The watermark insertion position of each video frame in the cluster representing the video frame is set to represents the watermark insertion position of the video frame, and gets represents the watermark insertion position of each video frame in the cluster where the video frame belongs.
9. A media data security protection system based on blockchain, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the computer program is executed by the processor, the steps of the blockchain-based media data security protection method as described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Video watermarking method based on visual attention mechanism
CN104168484A
Digital watermark video copyright protection system based on property invariant feature
CN117579836A
