Disclosure of Invention
In order to solve the above technical problems, an object of the present invention is to provide a video link anti-theft method, system, device and storage medium with better security.
The technical scheme adopted by the invention is as follows:
a video link anti-theft method comprises the following steps:
carrying out fragment processing on the video file to obtain a plurality of first fragment files;
performing interference processing on each first fragmented file to obtain a processed second fragmented file;
receiving a file access request, judging and detecting an access object in the file access request, and not processing the file access request when the access object is determined to be the whole video file; when the access object is determined to be the second fragment file, sending out the corresponding second fragment file in the access object;
decoding the obtained second fragment file to obtain a third fragment file;
and splicing the third fragment files according to the standard format of the video file to obtain a spliced video file.
As a further improvement of the video link anti-theft method, the step of performing fragment processing on the video file to obtain a plurality of first fragment files specifically includes:
and dividing the video file into a plurality of first fragment files according to the preset time length.
As a further improvement of the video link anti-theft method, the step of performing interference processing on each first fragmented file to obtain a processed second fragmented file specifically includes:
randomly generating an interference code;
and according to the interference codes, carrying out XOR processing on the preset file positions in the first fragmented files to obtain second fragmented files.
As a further improvement of the video link anti-theft method, the decoding processing is performed on the obtained second fragment file to obtain a third fragment file, and the step specifically includes:
and performing XOR processing on the preset file position in the second fragment file according to the interference code to obtain a third fragment file.
As a further improvement of the video link anti-theft method, the step of performing interference processing on each first fragmented file to obtain a processed second fragmented file specifically includes:
randomly generating a secret key;
and encrypting the first fragmented file by using a preset encryption algorithm according to the secret key to obtain a second fragmented file.
As a further improvement of the video link anti-theft method, the decoding processing is performed on the obtained second fragment file to obtain a third fragment file, and the step specifically includes:
and decoding the second fragment file according to the secret key and a preset decryption algorithm to obtain a third fragment file.
As a further improvement of the video link anti-theft method, the third split files are spliced according to a standard format of the video file to obtain a spliced video file, and the step specifically includes:
acquiring index information in each third fragment file;
and splicing the third fragment files according to the standard format of the video file according to the index information to obtain a spliced video file.
The invention adopts another technical scheme that:
a video linking theft prevention system comprising:
the device comprises a segmentation unit, a storage unit and a processing unit, wherein the segmentation unit is used for carrying out fragmentation processing on a video file to obtain a plurality of first fragment files;
the interference processing unit is used for carrying out interference processing on each first fragment file to obtain a processed second fragment file;
the detection unit is used for receiving the file access request, judging and detecting an access object in the file access request, and not processing the file access request when the access object is determined to be the whole video file; when the access object is determined to be the second fragment file, sending out the corresponding second fragment file in the access object;
the decoding unit is used for decoding the obtained second fragment file to obtain a third fragment file;
and the splicing unit is used for splicing the third split files according to the standard format of the video file to obtain a spliced video file.
The invention adopts another technical scheme that:
a video linking anti-theft device, comprising:
a memory for storing a program;
a processor for executing the program, the program causing the processor to execute the video link anti-theft method.
The invention adopts another technical scheme that:
a computer-readable storage medium comprising a computer program which, when run on a computer, causes the video link anti-theft method to be performed.
The invention has the beneficial effects that:
the video link anti-theft method, the system, the device and the storage medium provided by the invention have the advantages that the video file is segmented and subjected to interference processing, the access to the whole video file is refused, the condition that a chain thief acquires the whole file or acquires a plurality of files in batches and synthesizes the files is effectively avoided, and the safety is greatly improved.
Detailed Description
The following further describes embodiments of the present invention with reference to the accompanying drawings:
referring to fig. 1, the present embodiment provides a video link anti-theft method, including the following steps:
s1, carrying out fragment processing on the video file to obtain a plurality of first fragment files;
the video file in the invention can be in MP4 format, AVI format, rm format, rmvb format, mov format, mtv format, wmv format, flv format and the like. The fragmentation in this embodiment may be set according to a preset time length or a preset fragmentation file size.
S2, carrying out interference processing on each first fragment file to obtain a processed second fragment file;
interference processing in the embodiment can be realized by generating the interference code and then performing interference processing on the first fragment file according to a preset algorithm through the interference code, so that the first fragment file is converted into the second fragment file, even if a chain stealing person can obtain a plurality of second fragment files in batches, the second fragment files cannot be restored and synthesized into the original video file under the condition that the interference code and the algorithm are unknown, and the chain stealing behavior is effectively avoided.
S3, receiving a file access request, judging and detecting an access object in the file access request, and not processing the file access request when determining that the access object is the whole video file; when the access object is determined to be the second fragment file, sending out the corresponding second fragment file in the access object;
in the embodiment, all file access requests are judged and detected, if the access object is the whole video file, the link stealing behavior is determined by default, and the file access request is rejected; and only when the access object is detected to be the second fragment file, the corresponding second fragment file in the access object is sent out.
S4, decoding the obtained second fragment file to obtain a third fragment file;
in this step, the second fragmented file may be decoded according to the interference code and then according to a decoding algorithm corresponding to the interference algorithm, so as to obtain a restored third fragmented file.
And S5, splicing the third split files according to the standard format of the video file to obtain a spliced video file.
In this step, the third fragment file is obtained and then can be played by a player after being spliced at the front end according to the standard format of the original video file. According to the embodiment, the video file is segmented and subjected to interference processing, and the access to the whole video file is refused, so that the situation that a stealer obtains the whole file or obtains a plurality of files in batches and synthesizes the files is effectively avoided, and the safety is greatly improved.
Further as a preferred embodiment, the performing slicing processing on the video file to obtain a plurality of first sliced files in this embodiment specifically includes:
and dividing the video file into a plurality of first fragment files according to the preset time length.
As a further preferred embodiment, in the present embodiment, the interference processing is performed by using an interference scrambling code, and the step of performing interference processing on each first fragmented file to obtain a processed second fragmented file specifically includes: firstly, randomly generating an interference code, and then carrying out XOR processing on the first 1 byte in the first fragment file by using the interference code to obtain a second fragment file. In this embodiment, the decoding process is performed on the obtained second fragmented file to obtain a third fragmented file, and the step specifically includes: and performing XOR processing on the first 1 byte in the second fragment file according to the interference code to obtain a restored third fragment file. In the embodiment, a header file is not required, the operation is convenient and simple, and other simple logic algorithms can be used for implementation besides the exclusive-or operation.
Further as a preferred embodiment, in another embodiment, the interference processing is performed by using an encryption algorithm, and the step of performing interference processing on each first fragmented file to obtain a processed second fragmented file specifically includes: firstly, a secret key is randomly generated, and then the whole first fragment file or a plurality of bytes are encrypted by using a preset encryption algorithm according to the secret key to obtain a second fragment file. In this embodiment, the decoding process is performed on the obtained second fragmented file to obtain a third fragmented file, and the step specifically includes: and decoding the whole second fragment file or the encrypted data of the first plurality of bytes according to the secret key and a preset decryption algorithm to obtain a restored third fragment file.
Further as a preferred embodiment, the splicing each third tile file according to the standard format of the video file to obtain a spliced video file specifically includes:
s51, acquiring index information in each third fragment file;
and S52, splicing the third fragment files according to the standard format of the video file according to the index information to obtain a spliced video file.
Referring to fig. 2, the present embodiment provides a video link anti-theft system, including:
the device comprises a segmentation unit, a storage unit and a processing unit, wherein the segmentation unit is used for carrying out fragmentation processing on a video file to obtain a plurality of first fragment files;
the interference processing unit is used for carrying out interference processing on each first fragment file to obtain a processed second fragment file;
the detection unit is used for receiving the file access request, judging and detecting an access object in the file access request, and not processing the file access request when the access object is determined to be the whole video file; when the access object is determined to be the second fragment file, sending out the corresponding second fragment file in the access object;
the decoding unit is used for decoding the obtained second fragment file to obtain a third fragment file;
and the splicing unit is used for splicing the third split files according to the standard format of the video file to obtain a spliced video file.
The contents in the above method embodiments are all applicable to the present system embodiment, the functions specifically implemented by the present system embodiment are the same as those in the above method embodiment, and the beneficial effects achieved by the present system embodiment are also the same as those achieved by the above method embodiment.
This embodiment also provides a video interlinkage anti-theft device, includes:
a memory for storing a program;
a processor for executing the program, the program causing the processor to execute the video link anti-theft method.
The contents in the above method embodiments are all applicable to the present apparatus embodiment, the functions specifically implemented by the present apparatus embodiment are the same as those in the above method embodiments, and the advantageous effects achieved by the present apparatus embodiment are also the same as those achieved by the above method embodiments.
The present embodiment provides a computer-readable storage medium including a computer program that, when run on a computer, causes the video link anti-theft method to be performed.
The contents in the above method embodiments are all applicable to the present storage medium embodiment, the functions specifically implemented by the present storage medium embodiment are the same as those in the above method embodiments, and the advantageous effects achieved by the present storage medium embodiment are also the same as those achieved by the above method embodiments.
According to the method and the device, the video file is segmented and subjected to interference processing, and the access to the whole video file is refused, so that the situation that a pirate acquires the whole file or acquires a plurality of files in batches and synthesizes the files is effectively avoided, and the safety is greatly improved.
While the preferred embodiments of the present invention have been illustrated and described, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.