CN114301602B - Video protection method and device based on block chain - Google Patents

Video protection method and device based on block chain Download PDF

Info

Publication number
CN114301602B
CN114301602B CN202111631141.XA CN202111631141A CN114301602B CN 114301602 B CN114301602 B CN 114301602B CN 202111631141 A CN202111631141 A CN 202111631141A CN 114301602 B CN114301602 B CN 114301602B
Authority
CN
China
Prior art keywords
index file
hash value
block
media
level
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111631141.XA
Other languages
Chinese (zh)
Other versions
CN114301602A (en
Inventor
袁戎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202111631141.XA priority Critical patent/CN114301602B/en
Publication of CN114301602A publication Critical patent/CN114301602A/en
Application granted granted Critical
Publication of CN114301602B publication Critical patent/CN114301602B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The invention provides a video protection method and a device based on a block chain, which belong to the technical field of video protection, and the method comprises the following steps: slicing the video to generate media slices and index files; recording an address of a first block of the blockchain in a first-level index file, calculating a hash value of the first-level index file, and storing the hash value of the first-level index file on the first block of the blockchain; recording the hash value of each media fragment and the address of the second block of the blockchain in a secondary index file, and storing the hash value of the secondary index file on the second block of the blockchain; and the user sends a video request to the server through the client, verifies the hash values of the media fragments after verifying that the hash values of the primary index file and the secondary index file pass, and sequentially plays the media fragments with the hash values verified. The invention saves the video index file through the block chain, realizes the lightweight protection of the video, verifies the hash value of the media fragment and ensures the safety of playing the video.

Description

Video protection method and device based on block chain
Technical Field
The invention belongs to the technical field of video protection, and particularly relates to a video protection method and device based on a block chain.
Background
Because of the recent explosive development of network related applications, various graphic images can be rapidly acquired and transmitted through the network, and the aim of preventing information from being tampered can be achieved by combining a blockchain technology, but the data carried by each block in the blockchain is very limited, and the complexity of the block can cause that continuous images are not easy to be rapidly updated and transmitted on the basis of the blockchain.
The block chain decentralizing operation mode calculates the unique hash value of the important information, and then achieves multiparty authentication and storage through a distributed account book mechanism, wherein the important information is public, traceable and non-tamperable.
In patent document CN113411614a, a video protection system and a computer storage medium based on the blockchain technique, the following techniques are described: each frame data of the video is packed into a block by the video encryption module, each block forms a block chain according to the sequence of frames, and the original frame data is stored in the block body; the monitoring module calls the hash function to calculate a certain block, if the difference exists, the frame data in the block is tampered, in addition, the frame data is compared with the data of the next block, and if the difference exists, the second block is tampered or the block data is lost between the two blocks. In the method of tamper-proof, loss-proof and recovery of video content based on the blockchain technique of patent document CN 110650321B, the following techniques are described: establishing a video block chain, wherein the video block chain is formed by expanding an originating block to form a chain composed of a plurality of video camera IP video chains; using the IP of the video camera as a basis for judging whether the video is legal or not and verifying whether the data on the chain is tampered or not; the video node obtains the accounting right through a PoW mechanism. In the patent document CN 110366049A, a streaming video integrity protection method, the following techniques are described, wherein integrity description data is generated, an additional real-time integrity ES stream is defined in a TS stream, and the ES stream performs integrity protection on the data ES stream in the TS stream; the receiving end analyzes the corresponding real-time integrity ES stream in the TS stream, if the Hash values are consistent, the data are considered to be complete, otherwise, the video is considered to be tampered; the method does not increase play delay, provides frame-level audio and video protection, and is suitable for TCP and UDP transmission.
The patent technology of patent document CN113411614a transmits all data frames to the blockchain for protection, and since the data that each blockbody on the blockchain can carry is very small, hundreds of MB or GB video will occupy a large number of blocks on the main chain; because the hash value of each frame and the next frame needs to be calculated when playing the video, if the data is lost due to the network environment, the hash value is compared at the moment, so that the video is easily falsified, the next block data cannot be obtained by the client when the network data is lost, retransmission is necessary, and the delay is caused, so that the experience is influenced. Patent document CN110650321B also protects the entire data frame from being uploaded to the blockchain, and, although the purpose is to prevent falsification, the same efficiency problem as patent document CN113411614a is faced in acquiring video. Patent document CN110366049a uses a light-weight method to verify the integrity of a video, and uses a TS stream to match with an ES stream to achieve a fast and real-time verification method, but due to the lack of other verification mechanisms, when a client acquires a video, it cannot be confirmed whether the video is original or has been altered.
This is a deficiency of the prior art, and therefore, it is necessary to provide a video protection method and apparatus based on blockchain in view of the above-mentioned drawbacks of the prior art.
Disclosure of Invention
Aiming at the defects that in the prior art, all videos are placed on a main chain of a block in a manner of protecting the videos through a block chain, the data volume is large, the loss is easy, the transmission of the next block is influenced when the data is lost, retransmission is needed, a lightweight transmission manner is adopted, and a verification mechanism is still lacking, the invention provides a video protection method and a video protection device based on the block chain, and aims to solve the technical problems.
In a first aspect, the present invention provides a video protection method based on a blockchain, including the steps of:
s1, slicing a video to generate media slices and index files; the index file comprises a primary index file and a secondary index file;
s2, recording an address of a first block of the block chain in a first-level index file, calculating a hash value of the first-level index file, and storing the hash value of the first-level index file on the first block of the block chain;
s3, calculating hash values of all media fragments, recording the hash values of all media fragments and addresses of second blocks of the block chain in a secondary index file, calculating hash values of the secondary index file, and storing the hash values of the secondary index file on the second blocks of the block chain;
S4, the user sends a video request to the server through the client, receives the primary index file returned by the server, requests the secondary index file from the server after verifying that the hash value of the primary index file passes, downloads each media fragment according to the secondary index file after verifying that the hash value of the secondary index file passes, verifies the hash value of each media fragment, and plays the media fragments with the hash value verified.
Further, the specific steps of step S1 are as follows:
s11, performing HLS slicing on the video to generate media slicing;
s12, creating a primary index file and a secondary index file for the media fragments. The media slicing is a segmented video file, the index file stores information of the video, the first index file stores an address of a first block in a block chain, and important information related to the video, such as copyright information, is also stored; the secondary index file stores addresses of the second block and subsequent blocks, and also stores corresponding media fragment hash values.
Further, the specific steps of step S2 are as follows:
s21, recording an address of a first block of the block chain in a first-level index file;
s22, calculating a hash value of the primary index file, and storing the hash value of the primary index file on the first block. The first block of the block chain stores the hash value of the first-level index file and the important information of the video file, and the content of the first block is obtained and used for first verification of the video file and verification of the hash value of the first-level index file.
Further, the specific steps of step S3 are as follows:
s31, determining the number of second index files and the number of blocks in the block chain according to the number of media fragments;
s32, calculating hash values of all media fragments;
s33, recording the media fragment hash value required to be stored in the second block and the address of the second block in a first-level secondary index file;
s34, calculating a hash value of the first secondary index file, and storing the hash value of the first secondary index file on the second block;
s35, judging whether all the media fragment hash values are stored completely;
if yes, go to step S4;
if not, go to step S36;
s36, recording the media fragment hash value required to be stored in the third block and the address of the third block in a second-level index file;
s37, calculating a hash value of the second-level index file, storing the hash value of the second-level index file on a third block, and repeating the step S35 until all the media fragment hash values are stored. The second block is a block immediately following the first block in the block chain, the third block is a block immediately following the second block, the subsequent blocks started by the second block store hash values of the secondary index file, the number of the subsequent blocks started by the second block is set according to the number of the media fragments, and the second block and the subsequent blocks store hash values of the secondary index file and the media fragment hash values for subsequent verification of the video to be played.
Further, the specific steps of step S4 are as follows:
s41, a user sends a video request to a server through a client;
s42, the server returns a first-level index file to the client;
s43, after calculating the hash value of the first-level index file, the client judges whether the hash value of the first-level index file stored in the first block is consistent with the hash value of the first-level index file;
if the two types of data are inconsistent, returning an error and ending;
if so, go to step S44;
s44, the client requests a first-level and second-level index file from the server;
s45, the server returns a first-level secondary index file to the client;
s46, the client calculates a hash value of the first secondary index file and judges whether the hash value of the first secondary index file is consistent with the hash value of the first secondary index file stored on the second block;
if not, discarding the media fragment corresponding to the index file on the block, and entering step S49;
if yes, go to step S47;
s47, the client downloads each media fragment corresponding to the first index file of the second block;
s48, the client calculates hash values of the media fragments corresponding to the first second index file, and judges whether the hash values of the media fragments stored in the first second index file are consistent with the hash values of the media fragments stored in the first second index file;
if the media clips are consistent, playing each media clip corresponding to the first index file of the second block, and entering step S49;
If not, processing the media fragments with inconsistent hash values, and entering step S49;
s49, judging whether all the media fragment hash values are compared;
if yes, ending;
if not, repeating the steps S44-S48 until the media fragment hash value on the last block is compared. When the video request is to play the video on demand, the index file firmware is unchanged, and according to the steps of the invention, if the video request is to play the live video, the index file is updated continuously, the client needs to send the video request according to the video update frequency, and meanwhile, the hash value of the index file needs to be updated to the block corresponding to the block chain in advance, and the block chain with the processing speed larger than the threshold value needs to be selected.
Further, the specific steps of step S43 are as follows:
s431, the client searches the first block address from the primary index file and is connected with the first block;
s432, the client acquires a first-level index file hash value from the first block and sets the first-level index file hash value as a first hash value;
s433, the client calculates a hash value according to the first-level index file returned by the server and sets the hash value as a second hash value;
s434, comparing whether the first hash value is consistent with the second hash value;
If the two types of data are inconsistent, returning an error and ending;
if so, the process proceeds to step S44. The first-level index file hash value verification is the first verification of video playing, and if the verification is not passed, important information of the video may be tampered and video playing cannot be performed.
Further, the specific steps of step S46 are as follows:
s461, the client searches the address of the second block from the first-level second-level index file and is connected with the second block;
s462, the client acquires a first-level second-level index file hash value from the second block and sets a third hash value;
s463, the client calculates a hash value according to the first-level second-level index file returned by the server, and sets the hash value as a fourth hash value;
s464, comparing whether the third hash value is consistent with the fourth hash value;
if not, discarding the media fragment corresponding to the index file on the block, and entering step S49;
if so, the process proceeds to step S47. The hash value of the secondary index file is the verification of the address of the second block, the verification is not passed, and the whole media fragment corresponding to the secondary index file cannot be played.
Further, the specific steps of step S48 are as follows:
s481, the client searches the hash value of the media fragment from the first-level second-level index file returned by the server and sets the hash value as a fifth hash value;
S482, the client calculates a hash value according to each media fragment corresponding to the first index file of the downloaded second block, and sets the hash value as a sixth hash value;
s483, comparing whether the fifth hash value is consistent with the sixth hash value;
if yes, go to step S484;
if not, go to step S485;
s484, playing each media fragment corresponding to the first index file of the second block, and entering step S49;
s485, acquiring media fragments with inconsistent hash values, and setting the media fragments as error media fragments;
s486, discarding the error media fragments, requesting retransmission of the error media fragments, setting a comparison threshold for the error media fragments, and stopping playing the error media fragments when the comparison times exceed the comparison threshold, and then entering step S49. The verification of the hash value of the media fragment is specific to the verification of a certain media fragment, and the verification is not passed, but the media fragment cannot be played.
In a second aspect, the present invention provides a blockchain-based video protection device, comprising:
the video slicing module is used for slicing the video to generate media slicing and index files; the index file comprises a primary index file and a secondary index file;
the first-level index file recording and first block storage module is used for recording the address of the first block of the block chain in the first-level index file, calculating a hash value of the first-level index file and storing the hash value of the first-level index file on the first block of the block chain;
The second-level index file recording and second block storage module is used for calculating the hash value of each media fragment, recording the hash value of each media fragment and the address of the second block of the block chain in the second-level index file, calculating the hash value of the second-level index file, and storing the hash value of the second-level index file on the second block of the block chain;
the video verification module is used for sending a video request to the server through the client, receiving the primary index file returned by the server, requesting the secondary index file from the server after the hash value of the primary index file passes verification, downloading each media fragment according to the secondary index file after the hash value of the secondary index file passes verification, verifying the hash value of each media fragment, and sequentially playing the media fragments with the hash value verified.
Further, the video slicing module includes:
the media slicing generation unit is used for performing HLS slicing on the video to generate media slicing;
the index file generation unit is used for creating a primary index file and a secondary index file for the media fragments;
the first-level index file record and the first block storage module comprise:
the first block address storage unit is used for recording the address of a first block of the block chain in a first-level index file;
The first-level index file hash value storage unit is used for calculating a first-level index file hash value and storing the first-level index file hash value on the first block;
the second-level index file record and the second block storage module comprise:
the second index file and block number determining unit is used for determining the number of the second index files and the number of blocks in the block chain according to the number of the media fragments;
the media fragment hash value calculation unit is used for calculating each media fragment hash value;
the media fragment hash value and second block address recording unit is used for recording the media fragment hash value and the address of the second block which are required to be stored in the second block in the first-level second-level index file;
the first secondary index file hash value recording unit is used for calculating a first secondary index file hash value and storing the first secondary index file hash value on the second block;
the media fragment hash value storage judging unit is used for judging whether all media fragment hash values are stored completely;
the media fragment address and third block address recording unit is used for recording the media fragment hash value and the address of the third block which are required to be stored in the third block in the second-level index file when the media fragment hash value is not stored;
The second-level index file hash value recording unit is used for calculating a second-level index file hash value, storing the second-level index file hash value on a third block, and repeating the operation of the media fragment hash value storage judging unit until all the media fragment hash values are stored;
the video verification module comprises:
the video request unit is used for sending a video request to the server through the client by a user;
the server side returns the first-level index file to the client side;
the first-level index file hash value judging unit is used for judging whether the first-level index file hash value is consistent with the first-level index file hash value stored in the first block after the client calculates the first-level index file hash value;
the first-level and second-level index file request unit is used for requesting the first-level and second-level index file from the server side by the client side when the hash values of the first-level index file are consistent;
the first secondary index file returning unit is used for returning the first secondary index file to the client by the server;
the first secondary index file hash value judging unit is used for calculating a first secondary index file hash value by the client and judging whether the first secondary index file hash value is consistent with the first secondary index file hash value stored on the second block;
The media fragment discarding unit is used for discarding the media fragment corresponding to the index file on the block when the hash values of the first-level index file and the second-level index file are inconsistent;
the media fragment downloading unit is used for downloading each media fragment corresponding to the first index file of the second block by the client when the hash values of the first and second index files are consistent;
the media fragment hash value judging unit is used for calculating the hash value of each media fragment corresponding to the first second index file by the client and judging whether the hash value of each media fragment stored in the first second index file is consistent with the hash value of each corresponding media fragment stored in the first second index file;
the media slice playing unit is used for playing each media slice corresponding to the first index file of the second block when the hash values of the media slices are consistent;
the media slicing processing unit is used for processing the media slices with inconsistent hash values when the hash values of the media slices are inconsistent;
the media fragment hash value comparison completion judging unit is used for judging whether all media fragment hash values are compared;
and the media fragment hash value continuous comparison unit is used for repeatedly comparing the media fragments of the subsequent blocks until the media fragment hash value on the last block is compared when the media fragment hash value is not compared.
The invention has the advantages that,
according to the video protection method and device based on the block chain, the index file of the video is protected through the block chain, the video is not required to be stored, the information stored on the block chain is less, the lightweight video protection is realized, meanwhile, the hash value of the media fragment is verified, the played video is prevented from being changed, and the video safety is ensured.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
It can be seen that the present invention has outstanding substantial features and significant advances over the prior art, as well as the benefits of its implementation.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
Fig. 1 is a flowchart of an embodiment 1 of a video protection method based on blockchain in accordance with the present invention.
Fig. 2 is a flowchart of an embodiment 2 of a video protection method based on blockchain of the present invention.
Fig. 3 is a flowchart illustrating a step S4 of the video protection method based on blockchain according to the present invention.
Fig. 4 is a schematic diagram of a video protection device based on a blockchain in accordance with the present invention.
In the figure, a 1-video slicing module; 1.1-a media slice generation unit; 1.2-an index file generation unit; 2-first-level index file recording and a first block storage module; 2.1-a first block address storage unit; 2.2-a primary index file hash value storage unit; 3-second-level index file record and second block storage module; 3.1-a second index file and block number determining unit; 3.2-media fragment hash value calculation unit; 3.3-media fragment hash value and second block address recording unit; 3.4-a first-level second-level index file hash value recording unit; 3.5-a media fragment hash value storage judging unit; 3.6-a media slice address and a third block address recording unit; 3.7-second level index file hash value recording unit; 4-a video verification module; 4.1-a video request unit; 4.2-a first level index file return unit; 4.3-a first-level index file hash value judging unit; 4.4-a secondary index file request unit; 4.5-a second level index file return unit; 4.6-a first-level second-level index file hash value judging unit; 4.7-media slice discard unit; 4.8-media slice download unit; 4.9-a media fragment hash value judging unit; 4.10-a media slice playing unit; 4.11-a media slice processing unit; 4.12-a media fragment hash value comparison completion judging unit; 4.13-media fragment hash value continue to compare units.
Detailed Description
In order to make the technical solution of the present invention better understood by those skilled in the art, the technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
The following explains key terms appearing in the present invention.
The ES, which is a short name of Elementary Stream, is also called a basic code stream, and includes a continuous code stream of video, audio, or data.
TS, which is a short name of Transport Stream, is also called Transport Stream, i.e., in MPEG-2 system, a standard information Stream for actual transmission generated by multiplexing ES streams of video and audio and auxiliary data is called MPEG-2 Transport Stream. The TS stream is composed of packets of a fixed length of 188 bytes, and contains one or more programs of independent time base, one of which may contain multiple ES streams of video, audio, and text information.
HLS, which is a short term of HTTP Live Streaming, mainly defines the file format of data and the corresponding behavior that the server and the client should have, and is the currently mainstream video playing format, so that continuous or long-period movies can be pushed.
Example 1:
as shown in fig. 1, the present invention provides a video protection method based on a blockchain, comprising the following steps:
s1, slicing a video to generate media slices and index files; the index file comprises a primary index file and a secondary index file;
s2, recording an address of a first block of the block chain in a first-level index file, calculating a hash value of the first-level index file, and storing the hash value of the first-level index file on the first block of the block chain;
s3, calculating hash values of all media fragments, recording the hash values of all media fragments and addresses of second blocks of the block chain in a secondary index file, calculating hash values of the secondary index file, and storing the hash values of the secondary index file on the second blocks of the block chain;
s4, the user sends a video request to the server through the client, receives the primary index file returned by the server, requests the secondary index file from the server after verifying that the hash value of the primary index file passes, downloads each media fragment according to the secondary index file after verifying that the hash value of the secondary index file passes, verifies the hash value of each media fragment, and plays the media fragments with the hash value verified.
Example 2:
as shown in fig. 2 and 3, the present invention provides a video protection method based on a blockchain, comprising the following steps:
s1, slicing a video to generate media slices and index files; the index file comprises a primary index file and a secondary index file; the method comprises the following specific steps:
s11, performing HLS slicing on the video to generate media slicing;
s12, creating a primary index file and a secondary index file for the media fragments;
s2, recording an address of a first block of the block chain in a first-level index file, calculating a hash value of the first-level index file, and storing the hash value of the first-level index file on the first block of the block chain; the method comprises the following specific steps:
s21, recording an address of a first block of the block chain in a first-level index file;
s22, calculating a hash value of the primary index file, and storing the hash value of the primary index file on the first block;
s3, calculating hash values of all media fragments, recording the hash values of all media fragments and addresses of second blocks of the block chain in a secondary index file, calculating hash values of the secondary index file, and storing the hash values of the secondary index file on the second blocks of the block chain; the method comprises the following specific steps:
s31, determining the number of second index files and the number of blocks in the block chain according to the number of media fragments;
S32, calculating hash values of all media fragments;
s33, recording the media fragment hash value required to be stored in the second block and the address of the second block in a first-level secondary index file;
s34, calculating a hash value of the first secondary index file, and storing the hash value of the first secondary index file on the second block;
s35, judging whether all the media fragment hash values are stored completely;
if yes, go to step S4;
if not, go to step S36;
s36, recording the media fragment hash value required to be stored in the third block and the address of the third block in a second-level index file;
s37, calculating a hash value of the second-level index file, storing the hash value of the second-level index file on a third block, and repeating the step S35 until all the media fragment hash values are stored;
s4, the user sends a video request to the server through the client, receives a first-level index file returned by the server, requests a second-level index file from the server after verifying that the hash value of the first-level index file passes, downloads each media fragment according to the second-level index file after verifying that the hash value of the second-level index file passes, verifies the hash value of each media fragment, and plays the media fragments with the hash value verified; the method comprises the following specific steps:
S41, a user sends a video request to a server through a client;
s42, the server returns a first-level index file to the client;
s43, after the client calculates the hash value of the first-level index file, judging whether the first-level index file is stored in the first block
The hash values of the index files at the previous stage are consistent;
if the two types of data are inconsistent, returning an error and ending;
if so, go to step S44;
s44, the client requests a first-level and second-level index file from the server;
s45, the server returns a first-level secondary index file to the client;
s46, the client calculates a hash value of the first-level and second-level index file, and judges and stores the hash value in the second block
Whether the hash values of the first-level and second-level index files are consistent or not;
if not, discarding the media fragment corresponding to the index file on the block, and entering step S49;
if yes, go to step S47;
s47, the client downloads each media fragment corresponding to the first index file of the second block;
s48, the client calculates hash values of the media fragments corresponding to the first index file and judges
Whether the hash values of the corresponding media fragments stored in the first-level secondary index file are consistent with each other or not;
if the media fragments are consistent, playing each media fragment corresponding to the first index file of the second block, and entering
Step S49;
if not, processing the media fragments with inconsistent hash values, and entering step S49;
s49, judging whether all the media fragment hash values are compared;
if yes, ending;
if not, repeating the steps S44-S48 until the media fragment hash value on the last block is compared.
In the above embodiment 2, the specific steps of step S43 are as follows:
s431, the client searches the first block address from the primary index file and is connected with the first block;
s432, the client acquires a first-level index file hash value from the first block and sets the first-level index file hash value as a first hash value;
s433, the client calculates a hash value according to the first-level index file returned by the server and sets the hash value as a second hash value;
s434, comparing whether the first hash value is consistent with the second hash value;
if the two types of data are inconsistent, returning an error and ending;
if so, go to step S44;
the specific steps of step S46 are as follows:
s461, the client searches the address of the second block from the first-level second-level index file and is connected with the second block;
s462, the client acquires a first-level second-level index file hash value from the second block and sets a third hash value;
s463, the client calculates a hash value according to the first-level second-level index file returned by the server, and sets the hash value as a fourth hash value;
S464, comparing whether the third hash value is consistent with the fourth hash value;
if not, discarding the media fragment corresponding to the index file on the block, and entering step S49;
if so, go to step S47;
the specific steps of step S48 are as follows:
s481, the client searches the hash value of the media fragment from the first-level second-level index file returned by the server and sets the hash value as a fifth hash value;
s482, the client calculates a hash value according to each media fragment corresponding to the first index file of the downloaded second block, and sets the hash value as a sixth hash value;
s483, comparing whether the fifth hash value is consistent with the sixth hash value;
if yes, go to step S484;
if not, go to step S485;
s484, playing each media fragment corresponding to the first index file of the second block, and entering step S49;
s485, acquiring media fragments with inconsistent hash values, and setting the media fragments as error media fragments;
s486, discarding the error media fragments, requesting retransmission of the error media fragments, setting a comparison threshold for the error media fragments, and stopping playing the error media fragments when the comparison times exceed the comparison threshold, and then entering step S49.
In the above embodiment 2, the calculation and verification of the hash value may be performed by using an MD5 algorithm or an SHA-1 algorithm, the MD5 algorithm may generate a 128-bit hash value, and the SHA-1 algorithm may generate a 160-bit hash value;
When the requested video is a live video, the index file needs to be changed according to the video update frequency, and the newly generated hash value of the index file needs to be uploaded to the block chain in time and then provided for a client, and the block chain with the transaction speed larger than a threshold value is needed to process; the hash value and important information of the index file are transmitted to a block chain through a computer network, and the block chain synchronizes the information to other block nodes according to the specifications and formulated algorithm programs of the block chain; each block computes a hash value stored onto the block via a complex algorithm, the hash value having uniqueness in the blockchain.
Example 3:
as shown in fig. 4, the present invention provides a video protection device based on a blockchain, comprising:
the video slicing module 1 is used for slicing the video to generate media slicing and index files; the index file comprises a primary index file and a secondary index file; the video slicing module 1 includes:
the media slicing generation unit 1.1 is used for performing HLS slicing on the video to generate media slicing;
an index file generating unit 1.2, configured to create a primary index file and a secondary index file for the media fragment;
The first-level index file recording and first block storage module 2 is used for recording the address of the first block of the block chain in the first-level index file, calculating the hash value of the first-level index file and storing the hash value of the first-level index file on the first block of the block chain; the primary index file record and the first block storage module 2 include:
a first block address storage unit 2.1 for recording an address of a first block of the blockchain in a primary index file;
the primary index file hash value storage unit 2.2 is used for calculating a primary index file hash value and storing the primary index file hash value on the first block;
the second-level index file recording and second block storage module 3 is used for calculating the hash value of each media fragment, recording the hash value of each media fragment and the address of the second block of the block chain in the second-level index file, calculating the hash value of the second-level index file, and storing the hash value of the second-level index file on the second block of the block chain; the secondary index file record and the second block storage module 3 include:
a second index file and block number determining unit 3.1 for determining the first index file according to the number of media slices
The number of index files and the number of blocks in the block chain;
A media fragment hash value calculating unit 3.2 for calculating each media fragment hash value;
a media fragment hash value and second block address recording unit 3.3 for recording the media fragment hash value and the address of the second block to be stored in the second-level index file;
a first secondary index file hash value recording unit 3.4, configured to calculate a first secondary index file hash value, and store the first secondary index file hash value on the second block;
a media fragment hash value storage judging unit 3.5 for judging whether all media fragment hash values are stored;
a media fragment address and third block address recording unit 3.6, configured to record the media fragment hash value and the address of the third block to be stored in the second-level index file when the media fragment hash value is not stored;
a second-level index file hash value recording unit 3.7, configured to calculate a second-level index file hash value, store the second-level index file hash value on the third block, and repeat the operation of the media fragment hash value storage judging unit 3.5 until all the media fragment hash values are stored;
The video verification module 4 is configured to send a video request to the server through the client, receive a primary index file returned by the server, request a secondary index file from the server after verifying that the hash value of the primary index file passes, download each media fragment according to the secondary index file after verifying that the hash value of the secondary index file passes, verify the hash value of each media fragment, and play the media fragments with the hash value verified; the video verification module 4 includes:
the video request unit 4.1 is used for sending a video request to the server through the client by a user;
the primary index file returning unit 4.2, the server returns the primary index file to the client;
the primary index file hash value judging unit 4.3 is used for judging whether the primary index file hash value is consistent with the primary index file hash value stored in the first block after the client calculates the primary index file hash value;
the first-level second-level index file request unit 4.4 is used for requesting the first-level second-level index file from the server side by the client side when the hash values of the first-level index files are consistent;
a first secondary index file return unit 4.5, configured to return a first secondary index file to the client by the server;
The first secondary index file hash value judging unit 4.6 is used for calculating a first secondary index file hash value by the client and judging whether the first secondary index file hash value is consistent with the first secondary index file hash value stored on the second block;
the media fragment discarding unit 4.7 is configured to discard the media fragment corresponding to the index file on the block when the hash values of the first-level second-level index file are inconsistent;
the media fragment downloading unit 4.8 is configured to, when the hash values of the first-level second index files are consistent, download each media fragment corresponding to the first-level second index file of the second block by the client;
the media fragment hash value judging unit 4.9 is used for calculating the hash value of each media fragment corresponding to the first second index file by the client and judging whether the hash value of each media fragment stored in the first second index file is consistent with the hash value of each corresponding media fragment stored in the first second index file;
the media slice playing unit 4.10 is used for playing each media slice corresponding to the first index file of the second block when the hash values of the media slices are consistent;
the media slicing processing unit 4.11 is used for processing the media slices with inconsistent hash values when the hash values of the media slices are inconsistent;
a media fragment hash value comparison completion judging unit 4.12, configured to judge whether all media fragment hash values are compared;
And the media fragment hash value continuous comparison unit 4.13 is used for repeatedly comparing the media fragments of the subsequent blocks until the media fragment hash value on the last block is compared when the media fragment hash value is not compared.
Although the present invention has been described in detail by way of preferred embodiments with reference to the accompanying drawings, the present invention is not limited thereto. Various equivalent modifications and substitutions may be made in the embodiments of the present invention by those skilled in the art without departing from the spirit and scope of the present invention, and it is intended that all such modifications and substitutions be within the scope of the present invention/be within the scope of the present invention as defined by the appended claims. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (9)

1. A video protection method based on a blockchain, comprising the steps of:
s1, slicing a video to generate media slices and index files; the index file comprises a primary index file and a secondary index file;
s2, recording an address of a first block of the block chain in a first-level index file, calculating a hash value of the first-level index file, and storing the hash value of the first-level index file on the first block of the block chain;
S3, calculating hash values of all media fragments, recording the hash values of all media fragments and addresses of second blocks of the block chain in a secondary index file, calculating hash values of the secondary index file, and storing the hash values of the secondary index file on the second blocks of the block chain;
s4, the user sends a video request to the server through the client, receives the primary index file returned by the server, requests the secondary index file from the server after verifying that the hash value of the primary index file passes, downloads each media fragment according to the secondary index file after verifying that the hash value of the secondary index file passes, verifies the hash value of each media fragment, and plays the media fragments with the hash value verified.
2. The blockchain-based video protection method of claim 1, wherein step S1 comprises the following specific steps:
s11, performing HLS slicing on the video to generate media slicing;
s12, creating a primary index file and a secondary index file for the media fragments.
3. The blockchain-based video protection method of claim 1, wherein step S3 comprises the following specific steps:
s31, determining the number of secondary index files and the number of blocks in a block chain according to the number of media fragments;
S32, calculating hash values of all media fragments;
s33, recording the media fragment hash value required to be stored in the second block and the address of the second block in a first-level secondary index file;
s34, calculating a hash value of the first secondary index file, and storing the hash value of the first secondary index file on the second block;
s35, judging whether all the media fragment hash values are stored completely;
if yes, go to step S4;
if not, go to step S36;
s36, recording the media fragment hash value required to be stored in the third block and the address of the third block in a second-level index file;
s37, calculating a hash value of the second-level index file, storing the hash value of the second-level index file on a third block, and repeating the step S35 until all the media fragment hash values are stored.
4. The blockchain-based video protection method of claim 3, wherein step S4 comprises the following specific steps:
s41, a user sends a video request to a server through a client;
s42, the server returns a first-level index file to the client;
s43, after calculating the hash value of the first-level index file, the client judges whether the hash value of the first-level index file stored in the first block is consistent with the hash value of the first-level index file;
If the two types of data are inconsistent, returning an error and ending;
if so, go to step S44;
s44, the client requests a first-level and second-level index file from the server;
s45, the server returns a first-level secondary index file to the client;
s46, the client calculates a hash value of the first secondary index file and judges whether the hash value of the first secondary index file is consistent with the hash value of the first secondary index file stored on the second block;
if not, discarding the media fragment corresponding to the index file on the block, and entering step S49;
if yes, go to step S47;
s47, the client downloads each media fragment corresponding to the first-level second-level index file of the second block;
s48, the client calculates hash values of the media fragments corresponding to the first-level second-level index file, and judges whether the hash values of the media fragments stored in the first-level second-level index file are consistent with the hash values of the media fragments stored in the first-level second-level index file;
if the media clips are consistent, playing each media clip corresponding to the first-level second-level index file of the second block, and entering step S49;
if not, processing the media fragments with inconsistent hash values, and entering step S49;
s49, judging whether all the media fragment hash values are compared;
if yes, ending;
if not, repeating the steps S44-S48 until the media fragment hash value on the last block is compared.
5. The video protection method based on blockchain as in claim 4, wherein step S43 comprises the following specific steps:
s431, the client searches the first block address from the primary index file and is connected with the first block;
s432, the client acquires a first-level index file hash value from the first block and sets the first-level index file hash value as a first hash value;
s433, the client calculates a hash value according to the first-level index file returned by the server and sets the hash value as a second hash value;
s434, comparing whether the first hash value is consistent with the second hash value;
if the two types of data are inconsistent, returning an error and ending;
if so, the process proceeds to step S44.
6. The blockchain-based video protection method of claim 4, wherein step S46 comprises the specific steps of:
s461, the client searches the address of the second block from the first-level second-level index file and is connected with the second block;
s462, the client acquires a first-level second-level index file hash value from the second block and sets the first-level second-level index file hash value as a third hash value;
s463, the client calculates a hash value according to the first-level second-level index file returned by the server, and sets the hash value as a fourth hash value;
s464, comparing whether the third hash value is consistent with the fourth hash value;
if not, discarding the media fragment corresponding to the index file on the block, and entering step S49;
If so, the process proceeds to step S47.
7. The blockchain-based video protection method of claim 6, wherein step S48 comprises the specific steps of:
s481, the client searches the hash value of the media fragment from the first-level second-level index file returned by the server and sets the hash value as a fifth hash value;
s482, the client calculates a hash value according to each media fragment corresponding to the downloaded first-level second-level index file of the second block, and sets the hash value as a sixth hash value;
s483, comparing whether the fifth hash value is consistent with the sixth hash value;
if yes, go to step S484;
if not, go to step S485;
s484, playing each media fragment corresponding to the first-level second-level index file of the second block, and entering step S49;
s485, acquiring media fragments with inconsistent hash values, and setting the media fragments as error media fragments;
s486, discarding the error media fragments, requesting retransmission of the error media fragments, setting a comparison threshold for the error media fragments, and stopping playing the error media fragments when the comparison times exceed the comparison threshold, and then entering step S49.
8. A blockchain-based video protection device, comprising:
the video slicing module (1) is used for slicing the video to generate media slicing and index files; the index file comprises a primary index file and a secondary index file;
The first-level index file recording and first block storage module (2) is used for recording the address of the first block of the block chain in the first-level index file, calculating a hash value of the first-level index file and storing the hash value of the first-level index file on the first block of the block chain;
the second-level index file recording and second block storage module (3) is used for calculating the hash value of each media fragment, recording the hash value of each media fragment and the address of the second block of the block chain in the second-level index file, calculating the hash value of the second-level index file, and storing the hash value of the second-level index file on the second block of the block chain;
and the video verification module (4) is used for sending a video request to the server through the client, receiving the primary index file returned by the server, requesting the secondary index file from the server after the hash value of the primary index file passes, downloading each media fragment according to the secondary index file after the hash value of the secondary index file passes, verifying the hash value of each media fragment, and sequentially playing the media fragments with the hash value passed by verification.
9. The blockchain-based video protection device of claim 8, wherein the video slicing module (1) comprises:
A media slicing generation unit (1.1) for performing HLS slicing on the video to generate media slicing;
an index file generation unit (1.2) for creating a primary index file and a secondary index file for a media slice;
the first-level index file recording and first block storage module (2) comprises:
a first block address storage unit (2.1) for recording an address of a first block of the blockchain in a primary index file;
the primary index file hash value storage unit (2.2) is used for calculating a primary index file hash value and storing the primary index file hash value on the first block;
the second-level index file record and the second block storage module (3) comprise:
a second index file and block number determining unit (3.1) for determining the number of second index files and the number of blocks in the blockchain according to the number of media slices;
a media fragment hash value calculation unit (3.2) for calculating each media fragment hash value;
a media fragment hash value and second block address recording unit (3.3) for recording the media fragment hash value and the address of the second block to be stored in the second block in the first secondary index file;
A first secondary index file hash value recording unit (3.4) for calculating a first secondary index file hash value and storing the first secondary index file hash value on the second block;
a media fragment hash value storage judging unit (3.5) for judging whether all media fragment hash values are stored completely;
a recording unit (3.6) for recording the media fragment address and the third block address in the second level index file when the media fragment hash value is not stored;
a second-level index file hash value recording unit (3.7) for calculating a second-level index file hash value, storing the second-level index file hash value on a third block, and repeating the operation of the media fragment hash value storage judging unit (3.5) until all the media fragment hash values are stored;
the video verification module (4) comprises:
the video request unit (4.1) is used for sending a video request to the server through the client by a user;
a primary index file return unit (4.2), wherein the server returns the primary index file to the client;
the first-level index file hash value judging unit (4.3) is used for judging whether the first-level index file hash value is consistent with the first-level index file hash value stored in the first block after the client calculates the first-level index file hash value;
A first secondary index file request unit (4.4) for requesting the first secondary index file from the server by the client when the hash values of the first secondary index file are consistent;
a first secondary index file return unit (4.5) for the server to return the first secondary index file to the client;
a first secondary index file hash value judging unit (4.6) for the client to calculate a first secondary index file hash value and judge whether the first secondary index file hash value is consistent with the first secondary index file hash value stored on the second block;
the media fragment discarding unit (4.7) is used for discarding the media fragment corresponding to the index file on the block when the hash values of the first-level index file and the second-level index file are inconsistent;
the media fragment downloading unit (4.8) is used for downloading each media fragment corresponding to the first-level second-level index file of the second block by the client when the hash values of the first-level second-level index files are consistent;
the media fragment hash value judging unit (4.9) is used for calculating the hash value of each media fragment corresponding to the first-level second-level index file by the client and judging whether the hash value of each media fragment stored in the first-level second-level index file is consistent with the hash value of each corresponding media fragment stored in the first-level second-level index file;
the media slice playing unit (4.10) is used for playing each media slice corresponding to the first-level second-level index file of the second block when the hash values of the media slices are consistent;
The media slice processing unit (4.11) is used for processing the media slices with inconsistent hash values when the hash values of the media slices are inconsistent;
a media fragment hash value comparison completion judging unit (4.12) for judging whether all media fragment hash values are compared;
and the media fragment hash value continuous comparison unit (4.13) is used for repeatedly comparing the media fragments of the subsequent blocks until the media fragment hash value on the last block is compared when the media fragment hash value is not compared.
CN202111631141.XA 2021-12-28 2021-12-28 Video protection method and device based on block chain Active CN114301602B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111631141.XA CN114301602B (en) 2021-12-28 2021-12-28 Video protection method and device based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111631141.XA CN114301602B (en) 2021-12-28 2021-12-28 Video protection method and device based on block chain

Publications (2)

Publication Number Publication Date
CN114301602A CN114301602A (en) 2022-04-08
CN114301602B true CN114301602B (en) 2023-08-15

Family

ID=80972332

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111631141.XA Active CN114301602B (en) 2021-12-28 2021-12-28 Video protection method and device based on block chain

Country Status (1)

Country Link
CN (1) CN114301602B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115017103B (en) * 2022-08-08 2022-10-25 平安银行股份有限公司 Financial business image information acquisition method and device, electronic equipment and storage medium
CN115499138B (en) * 2022-11-16 2023-03-24 成都同步新创科技股份有限公司 High-performance storage tamper-proof verification method and storage system combined with block chain
CN116132199B (en) * 2023-04-17 2023-06-30 丹氏生物科技成都有限公司 Method for processing liquid nitrogen tank monitoring data based on blockchain

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111181989A (en) * 2020-01-02 2020-05-19 烽火通信科技股份有限公司 Method and system for realizing HLS distribution tamper resistance
CN111460526A (en) * 2020-04-17 2020-07-28 支付宝(杭州)信息技术有限公司 Image data recording, acquiring and verifying method and device based on block chain
CN113196702A (en) * 2018-11-16 2021-07-30 先进信息技术公司 System and method for distributed data storage and transfer using blockchains

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113196702A (en) * 2018-11-16 2021-07-30 先进信息技术公司 System and method for distributed data storage and transfer using blockchains
CN111181989A (en) * 2020-01-02 2020-05-19 烽火通信科技股份有限公司 Method and system for realizing HLS distribution tamper resistance
CN111460526A (en) * 2020-04-17 2020-07-28 支付宝(杭州)信息技术有限公司 Image data recording, acquiring and verifying method and device based on block chain

Also Published As

Publication number Publication date
CN114301602A (en) 2022-04-08

Similar Documents

Publication Publication Date Title
CN114301602B (en) Video protection method and device based on block chain
CN110598448B (en) Method, device, equipment and storage medium for processing operation data based on block chain
CN107403303B (en) Signing method of electronic contract system based on block chain deposit certificate
CN108648084B (en) Data processing method, device and equipment of block chain network and storage medium
US7958361B2 (en) Information processing apparatus and method
WO2019218717A1 (en) Distributed storage method and apparatus, computer device, and storage medium
CN104255009B (en) System and method for the fragment integrity and authenticity of adaptive stream media
CN109543065B (en) Video active identification method combined with block chain
US20180249190A1 (en) Method and apparatus for cloud storage and cloud download of multimedia data
US20160197939A1 (en) Segment Authentication for Dynamic Adaptive Streaming
US20100008509A1 (en) Communication apparatus, key server, and management server
JP6495346B2 (en) Information processing system
CN111047324A (en) Method and apparatus for updating a set of public keys at a blockchain node
EP3659311B1 (en) Data stream integrity
CN110309197B (en) Project data verification method and device
CN109656882A (en) Data record method, extracting method and device, storage medium, terminal
CN107483407B (en) Method and system for preventing hotlinking
EP2974287A2 (en) Advertising download verification
TW201325179A (en) Method and system for proving a digital file
CN108667827A (en) Cloud distribution network cache contents method of calibration, device, network, storage medium and computing device
CN113536956B (en) Method for detecting multimedia data tampering
US7881342B2 (en) Dynamically and on-demand selected ancillary data over compressed multimedia packets without bandwidth expansion
CN112182009B (en) Block chain data updating method and device and readable storage medium
CN112699406A (en) Block chain-based medical image data security management method and system
Aturban et al. Difficulties of timestamping archived web pages

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant