CN111669650A - Video processing method and device, electronic equipment and storage medium - Google Patents

Video processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111669650A
CN111669650A CN202010525268.2A CN202010525268A CN111669650A CN 111669650 A CN111669650 A CN 111669650A CN 202010525268 A CN202010525268 A CN 202010525268A CN 111669650 A CN111669650 A CN 111669650A
Authority
CN
China
Prior art keywords
encrypted
video
frame
data
original video
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.)
Pending
Application number
CN202010525268.2A
Other languages
Chinese (zh)
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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202010525268.2A priority Critical patent/CN111669650A/en
Publication of CN111669650A publication Critical patent/CN111669650A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4405Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving video stream decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/2347Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving video stream encryption

Abstract

The embodiment of the invention provides a video processing method and device, electronic equipment and a storage medium. Verifying the original video based on a preset verification algorithm to obtain first verification data; encrypting a key frame in an original video to obtain a first encrypted frame; acquiring an intermediate video corresponding to the original video according to the non-key frame, the first encrypted frame and the first verification data in the original video; checking the intermediate video based on a preset checking algorithm to obtain second checking data; and acquiring the encrypted video corresponding to the original video according to the second check data and the intermediate video. In this way, when the original video needs to be restored later, whether the intermediate video is valid or not can be determined based on the second check data, and whether the restored original video is valid or not can be determined based on the first check data. The invention can reduce the time consumed in the process of encrypting the original video on the premise of ensuring the safety of the original video, thereby improving the encryption efficiency of the original video.

Description

Video processing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a video processing method and apparatus, an electronic device, and a storage medium.
Background
Currently, videos on a network are more and more, many users select to watch the videos on the network on a client, for example, the users can control the client to send a request for obtaining the videos to a video server on the network, then the video server sends the videos to the client according to the request, and then the client can play the videos for the users to watch.
In order to improve the security of the video in the transmission process, the video server may encrypt the original video and then send the encrypted video to the client. Therefore, the client receives the encrypted video, and then the encrypted video can be decrypted to obtain the original video, and then the original video can be played.
When the video server encrypts the original video, the original video is integrally encrypted, and then the client needs to integrally decrypt the encrypted video.
However, the inventor found that the above-mentioned process of encrypting the original video and the process of decrypting the encrypted video take a long time, resulting in low encryption efficiency and decryption efficiency.
In addition, the client cannot know whether the received encrypted video is valid or not and whether the restored original video is valid or not.
Disclosure of Invention
Embodiments of the present invention provide a video processing method, a video processing apparatus, an electronic device, and a storage medium, so as to improve encryption efficiency and decryption efficiency. The specific technical scheme is as follows:
in a first aspect of the present invention, there is provided a video processing method, including:
verifying the original video based on a preset verification algorithm to obtain first verification data;
encrypting the key frame in the original video to obtain a first encrypted frame;
acquiring an intermediate video corresponding to the original video according to the non-key frame, the first encrypted frame and the first verification data in the original video;
verifying the intermediate video based on a preset verification algorithm to obtain second verification data;
and acquiring an encrypted video corresponding to the original video according to the second check data and the intermediate video.
In a second aspect of the present invention, there is provided a video processing method, including:
acquiring an encrypted video, wherein the encrypted video is acquired according to second check data and an intermediate video, the second check data is acquired by checking the intermediate video based on a preset check algorithm, the intermediate video is acquired according to a non-key frame, a first encrypted frame and first check data in an original video, the first check data is acquired by checking the original video based on the preset check algorithm, and the first encrypted frame is acquired by encrypting a key frame in the original video;
acquiring the second check-up data and the intermediate video according to the encrypted video;
verifying the intermediate video based on the preset verification algorithm to obtain third verification data;
under the condition that the second check data is the same as the third check data, acquiring the non-key frame, the first encrypted frame and the first check data according to the intermediate video;
decrypting the first encrypted frame to obtain the key frame;
acquiring a video to be verified according to the key frame and the non-key frame;
verifying the video to be verified based on the preset verification algorithm to obtain fourth verification data;
and under the condition that the fourth verification data is the same as the first verification data, determining the video to be verified as the original video.
In a third aspect of the present invention, there is provided a video processing apparatus comprising:
the first checking module is used for checking the original video based on a preset checking algorithm to obtain first checking data;
the encryption module is used for encrypting the key frame in the original video to obtain a first encrypted frame;
a first obtaining module, configured to obtain an intermediate video corresponding to the original video according to a non-key frame in the original video, the first encrypted frame, and the first verification data;
the second checking module is used for checking the intermediate video based on a preset checking algorithm to obtain second checking data;
and the second acquisition module is used for acquiring the encrypted video corresponding to the original video according to the second check data and the intermediate video.
In an optional implementation manner, the first obtaining module includes:
the first encryption unit is used for encrypting the non-key frames by using an encryption algorithm with first encryption strength to obtain second encrypted frames;
the second encryption unit is used for encrypting the first verification data by using an encryption algorithm with first encryption strength to obtain encrypted data;
a first obtaining unit configured to obtain the intermediate video according to the first encrypted frame, the second encrypted frame, and the encrypted data;
wherein the first encryption strength is lower than a second encryption strength of an encryption algorithm used to encrypt the key frame.
In a fourth aspect of the present invention, there is provided a video processing apparatus comprising:
a third obtaining module, configured to obtain an encrypted video, where the encrypted video is obtained according to second check data and an intermediate video, the second check data is obtained by checking the intermediate video based on a preset check algorithm, the intermediate video is obtained according to a non-key frame, a first encrypted frame, and first check data in an original video, the first check data is obtained by checking the original video based on the preset check algorithm, and the first encrypted frame is obtained by encrypting a key frame in the original video;
a fourth obtaining module, configured to obtain the second check data and the intermediate video according to the encrypted video;
the third checking module is used for checking the intermediate video based on the preset checking algorithm to obtain third checking data;
a fifth obtaining module, configured to obtain the non-key frame, the first encrypted frame, and the first verification data according to the intermediate video when the second verification data is the same as the third verification data;
the decryption module is used for decrypting the first encrypted frame to obtain the key frame;
a sixth obtaining module, configured to obtain a video to be verified according to the key frame and the non-key frame;
the fourth verification module is used for verifying the video to be verified based on the preset verification algorithm to obtain fourth verification data;
a determining module, configured to determine the video to be verified as the original video under the condition that the fourth verification data is the same as the first verification data.
In a fifth aspect implemented by the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the video processing method of the first aspect described above.
In a sixth aspect implemented by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the video processing method according to the first aspect.
In a seventh aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the video processing method according to the above second aspect.
In an eighth aspect implemented by the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the video processing method according to the second aspect.
The beneficial effects of the first, third, fifth and sixth aspects of the embodiments of the present invention include:
in the invention, an original video is verified based on a preset verification algorithm to obtain first verification data; encrypting a key frame in an original video to obtain a first encrypted frame; acquiring an intermediate video corresponding to the original video according to the non-key frame, the first encrypted frame and the first verification data in the original video; checking the intermediate video based on a preset checking algorithm to obtain second checking data; and acquiring the encrypted video corresponding to the original video according to the second check data and the intermediate video.
In this way, when the original video needs to be restored later, whether the intermediate video is valid or not can be determined based on the second check data, and whether the restored original video is valid or not can be determined based on the first check data.
In addition, even if a lawbreaker obtains a non-key frame in the original video, as long as the lawbreaker does not crack the key frame in the original video, the lawbreaker can hardly restore the original video, so that when the original video is encrypted, the original video can be encrypted without encrypting the whole original video, and the key frame in the original video can be encrypted to obtain a first encrypted frame; and then, acquiring an encrypted video corresponding to the original video according to the non-key frame and the first encrypted frame in the original video, so that a lawbreaker can hardly restore the original video because the key frame in the original video is encrypted, the security of the original video is ensured, and in addition, the non-key frame in the original video can not be encrypted, thereby improving the encryption efficiency of the original video. Therefore, the invention can reduce the time consumed in the process of encrypting the original video on the premise of ensuring the safety of the original video, thereby improving the encryption efficiency of the original video.
The second, fourth, seventh and eighth aspects of the embodiments of the present invention have the following advantageous effects:
by the method, whether the intermediate video is valid or not can be determined based on the second check data, and whether the restored original video is valid or not can be determined based on the first check data. Secondly, even if the lawbreaker obtains the non-key frames in the original video, the lawbreaker can hardly restore the original video as long as the lawbreaker does not crack the key frames in the original video. The method for decrypting the encrypted video supports that when the original video is encrypted, the whole original video is not encrypted, but the key frame in the original video is encrypted to obtain a first encrypted frame; and then, acquiring an encrypted video corresponding to the original video according to the non-key frame and the first encrypted frame in the original video, so that a lawbreaker can hardly restore the original video because the key frame in the original video is encrypted, the security of the original video is ensured, and in addition, the non-key frame in the original video can not be encrypted, thereby improving the encryption efficiency of the original video. Therefore, the invention can reduce the time consumed in the process of encrypting the original video on the premise of ensuring the safety of the original video, thereby improving the encryption efficiency of the original video.
In addition, when the encrypted video is decrypted, only the first encrypted frame in the encrypted video needs to be decrypted, and other frames do not need to be decrypted, so that the time consumed in the process of decrypting the encrypted video can be reduced, and the decryption efficiency of the encrypted video is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart illustrating steps of a video processing method according to an embodiment of the present invention.
Fig. 2 is a flowchart illustrating steps of a video processing method according to an embodiment of the present invention.
Fig. 3 is a block diagram of a video processing apparatus according to an embodiment of the present invention.
Fig. 4 is a block diagram of a video processing apparatus according to an embodiment of the present invention.
Fig. 5 is a block diagram of an electronic device in an embodiment of the present invention.
Fig. 6 is a block diagram of an electronic device in an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
Referring to fig. 1, a flow chart of steps of a video processing method of the present invention is shown, and the method may specifically include the following steps:
in step S101, checking the original video based on a preset checking algorithm to obtain first checking data;
in one scene, a client can acquire an original video from a server and play the original video, in order to improve the security of the original video, the server can encrypt the original video to obtain an encrypted video and then send the encrypted video to the client, and the client can receive the encrypted video sent by the server, then decrypt the encrypted video to obtain the original video and then play the original video.
In the above scenario, the original video is not exposed on the transmission path between the server and the client, and the encrypted video is exposed on the transmission path between the server and the client, so that the security of the video can be improved.
However, in the above scenario, the client cannot know whether the received encrypted video is the same as the encrypted video sent to the client by the server, and whether the original video restored by the client is the same as the original video before being encrypted by the server, and if not, it indicates that the original video is invalid, so that the client cannot know whether the received encrypted video is valid and whether the restored original video is valid.
In order to enable the client to know whether the received encrypted video is valid or not and whether the restored original video is valid or not, in the invention, before the server encrypts the original video, the server can Check the original video based on a preset Check algorithm to obtain first Check data, wherein the preset Check algorithm comprises a Cyclic Redundancy Check (CRC) algorithm and the like.
In step S102, encrypting a key frame in an original video to obtain a first encrypted frame;
in the above scenario, when the original video is encrypted by the server, the original video is often encrypted in its entirety, and the number of frames included in the original video is large, so that the process of encrypting the original video in its entirety takes a long time, resulting in low encryption efficiency.
Therefore, in order to reduce the time consumption for encrypting the original video and further improve the encryption efficiency, in the present invention, the inventors conducted intensive research on the original video, and after the intensive research on the original video, found that: the original video includes key frames, which may include I frames (I frames) and the like, and non-key frames, which may include P frames (Pframe) and B frames (B frames) and the like.
Wherein, the I frame is also called intra picture (intra picture), which is a coded frame of full frame compression; generally, a video compression technology is used to compress a video to obtain a first frame which is an I-frame and can be a reference point of random access, the first frame can be used as an image, after the video is compressed, a picture of the I-frame is completely reserved, and when the video is decompressed, the complete image can be reconstructed only by using the frame data without referring to images of other frames.
A P frame is predicted from a P frame or an I frame preceding it, and it is compared with the same information or data between P frames or I frames preceding it, i.e., inter-frame compression is performed in consideration of the characteristics of motion. The P frame represents the difference between the frame and a previous I frame or P frame, and the difference between the previous I frame or P frame and the current frame needs to be superimposed by the previously buffered I frame or P frame during decompression to generate a final image. P-frames, also called difference frames, have no complete picture data, only difference data with the picture of the previous frame.
The B frame is a bidirectional difference frame, and the B frame records the difference between the current frame and the previous and subsequent frames, in other words, to decompress the B frame, not only the image before the buffered B frame but also the image after the B frame are obtained, and the final image is obtained by superimposing the previous and subsequent images on the current frame image.
In addition, after further intensive research on the original video, the inventors also found that: of the I, P, and B frames included in the original video, the I frame is the most important frame.
After all frames in the original video are encrypted, if P frames and/or B frames in the original video are cracked, but I frames are not cracked, it is usually difficult to restore the original video, so that the original video is not leaked.
If a lawbreaker cracks at least the I frame but does not crack the P and/or B frames, it is easy to recover part of the original video, which may cause the original video to leak.
Therefore, when the original video is encrypted, the purpose of preventing lawless persons from restoring the original video can be achieved after the I frame in the original video is encrypted.
Therefore, in order to take account of the security and the encryption efficiency of the original video, in the present invention, when the original video is encrypted, the key frame in the original video may be encrypted to obtain the first encrypted frame, and then step S102 is performed. Wherein, the key frame at least comprises an I frame in the original video and the like.
In step S103, an intermediate video corresponding to the original video is obtained according to the non-key frame, the first encrypted frame and the first verification data in the original video;
in the present invention, the non-key frames in the original video include P frames, B frames, and the like in the original video.
The non-key frame, the first encrypted frame and the first verification data in the original video can be combined to obtain the encrypted video corresponding to the original video. For example, a first encrypted frame is used to replace a key frame in the original video, and then first verification data is added after the original video replacing the key frame, resulting in an intermediate video.
In step S104, the intermediate video is verified based on a preset verification algorithm to obtain second verification data;
in step S105, an encrypted video corresponding to the original video is obtained according to the second check data and the intermediate video.
Wherein the second parity data may be added after the intermediate video resulting in the encrypted video.
In the invention, an original video is verified based on a preset verification algorithm to obtain first verification data; encrypting a key frame in an original video to obtain a first encrypted frame; acquiring an intermediate video corresponding to the original video according to the non-key frame, the first encrypted frame and the first verification data in the original video; checking the intermediate video based on a preset checking algorithm to obtain second checking data; and acquiring the encrypted video corresponding to the original video according to the second check data and the intermediate video.
In this way, when the original video needs to be restored later, whether the intermediate video is valid or not can be determined based on the second check data, and whether the restored original video is valid or not can be determined based on the first check data.
In addition, even if a lawbreaker obtains a non-key frame in the original video, as long as the lawbreaker does not crack the key frame in the original video, the lawbreaker can hardly restore the original video, so that when the original video is encrypted, the original video can be encrypted without encrypting the whole original video, and the key frame in the original video can be encrypted to obtain a first encrypted frame; and then, acquiring an encrypted video corresponding to the original video according to the non-key frame and the first encrypted frame in the original video, so that a lawbreaker can hardly restore the original video because the key frame in the original video is encrypted, the security of the original video is ensured, and in addition, the non-key frame in the original video can not be encrypted, thereby improving the encryption efficiency of the original video. Therefore, the invention can reduce the time consumed in the process of encrypting the original video on the premise of ensuring the safety of the original video, thereby improving the encryption efficiency of the original video.
In the present invention, in the foregoing embodiment, the key frames in the original video are encrypted, but the non-key frames in the original video are not encrypted, so that a lawless person can easily break the non-key frames, and then the lawless person can concentrate on breaking the key frames in the original video according to the first encrypted frame.
In order to increase the difficulty of a lawbreaker in breaking out the original video on the premise of reducing the time required for the encryption process to improve the encryption efficiency, in another embodiment of the present invention,
when an intermediate video corresponding to an original video is obtained according to a non-key frame, a first encryption frame and first verification data in the original video, the non-key frame can be encrypted by using an encryption algorithm with a first encryption intensity to obtain a second encryption frame; encrypting the first verification data by using an encryption algorithm with first encryption strength to obtain encrypted data; wherein the first encryption strength is lower than the second encryption strength of the encryption algorithm used for encrypting the key frames, and then the intermediate video is obtained according to the first encryption frame, the second encryption frame and the encrypted data.
The first encrypted frame, the second encrypted frame, and the encrypted data may be combined to obtain an intermediate video corresponding to the original video, for example, replacing a key frame in the original video with the first encrypted frame, and replacing a non-key frame in the original video with the second encrypted frame, and then adding the encrypted data after replacing the key frame and the non-key frame in the original video to obtain the encrypted video.
In the prior art, the original video is encrypted in its entirety by using an encryption algorithm with the second encryption strength, that is, in the prior art, each frame in the original video is encrypted by using an encryption algorithm with the second encryption strength. The second encryption strength is a higher encryption strength.
In the invention, in order to ensure that the key frames in the original video are not easy to crack, the key frames in the original video are obtained by encrypting with the encryption algorithm with the second encryption strength, the non-key frames in the original video are obtained by encrypting with the encryption algorithm with the first encryption strength, the first verification data are obtained by encrypting with the encryption algorithm with the first encryption strength, the first encryption strength is lower encryption strength, and the first encryption strength is lower than the second encryption strength.
The higher the encryption strength of an encryption algorithm is, the higher the complexity of the encryption algorithm is, the more time the encryption algorithm needs to consume in the process of encrypting data is, the higher the security of the data encrypted based on the encryption algorithm is, that is, the greater the difficulty of cracking the data encrypted based on the encryption algorithm is.
Accordingly, the lower the encryption strength of an encryption algorithm, the lower the complexity of the encryption algorithm, the less time the encryption algorithm needs to consume in the process of encrypting data, and the lower the security of data encrypted based on the encryption algorithm, that is, the less difficulty in cracking the data encrypted based on the encryption algorithm.
Therefore, according to the invention, when a lawbreaker wants to break an original video, the lawbreaker needs to break key frames in the original video according to the first encrypted frame, simultaneously needs to break non-key frames in the original video according to the second encrypted frame, and breaks first check data according to the encrypted data, and due to the interference of the second encrypted frame and the encrypted data, the lawbreaker cannot concentrate on breaking key frames in the original video according to the first encrypted frame, so that the difficulty of breaking the original video by the lawbreaker is increased on the premise of reducing the time needed by the encryption process to improve the encryption efficiency.
In an embodiment of the present invention, an original video sometimes includes multiple frames of key frames, and the present invention may encrypt at least two frames of key frames in the multiple frames of key frames, and in one mode, an encryption process for any one key frame has a relationship with a result of encrypting a key frame located before the key frame, for example, an initialization vector required to encrypt any one key frame is obtained at least according to a result of encrypting a key frame located before the key frame, so that after one key frame is encrypted, an initialization vector required to encrypt a next key frame can be obtained according to an encryption result, and then the next key frame can be kept secret.
Thus, in this method, at least two frames of key frames need to be encrypted in series, each frame of key frame needs to be encrypted for one period of encryption time, several key frames in the original video need to be encrypted for several periods of encryption time, and the process of encrypting at least two frames of key frames needs to be time-consuming, so that the encryption efficiency is low.
Therefore, in order to further improve the encryption efficiency, when encrypting the key frames in the original video, if at least two key frames in the original video need to be encrypted, at least two key frames can be respectively encrypted in parallel.
For example, at least two frames of key frames that need to be encrypted can be determined in the original video; then, for any one of at least two frames of key frames, an initialization vector corresponding to the key frame can be generated, then a cipher stream is generated according to a preset key and the initialization vector, and then the key frame is operated according to the cipher stream to obtain a first encrypted frame corresponding to the key frame. The same is true for each of the other at least two frames of key frames.
In the invention, the initialization vectors generated for different key frames can be different, and the initialization vector corresponding to any one key frame can be unrelated to the initialization vectors corresponding to other key frames and can be unrelated to intermediate results and final results generated in the encryption process of other key frames, or the initialization vectors of different key frames are independent or not influenced mutually. Therefore, the encryption process for at least two frames of key frames in the original video can be executed in parallel, so that the time consumed by the process for encrypting at least two frames of key frames can be reduced, for example, the time consumed by encrypting at least two frames of key frames is reduced to a period of encryption time, so that the encryption efficiency can be improved.
In one way, when encrypting the original video, the key and the original video may be subjected to an exclusive or operation to obtain the encrypted video, and in this way, the number of bits of the key needs to be the same as that of the original video.
In one example, the key is 8 bits and the original video is 8 bits. In this case, the 8-bit data of the original video may be subjected to an exclusive-or operation with the 8-bit key, resulting in an 8-bit exclusive-or result 1.
However, sometimes the number of bits of the key may be different from the number of bits of the original video, e.g., the number of bits of the key is larger than the number of bits of the original video.
In one example, the key is 8 bits and the original video is 1 bit. In this case, the number of bits is different between the original video of 1 bit and the key of 8 bits, and the two cannot be directly subjected to the exclusive or operation.
In this way, when performing an exclusive-or operation on the 1-bit original video and the 8-bit key, the bit numbers of the two are required to be the same, but the key is provided by a third-party algorithm, so that the key is a whole for the server, and only the whole key can be used together, and the key cannot be split for use.
Therefore, it is impossible to encrypt 1-bit original video using only data of a partial bit number of the key, and it is necessary to use the 8-bit key to participate in the encryption of the original video in its entirety.
In this way, only 1-bit original video can be complemented into 8-bit original video, for example, adding 7-bit data to the end of 1-bit original video to obtain 8-bit original video, and then performing xor operation on 8-bit original video and 8-bit key to obtain 8-bit encrypted video.
However, the bit number 8 of the encrypted video is greater than the bit number 1 of the original video, so that the server transmits the 8-bit encrypted video to the client in this way, which occupies more network resources than the server transmits the 1-bit original video to the client.
Therefore, in order to save network resources, in the present invention, when the key frame is operated according to the cipher stream, under the condition that the first bit number of the cipher stream is greater than the second bit number of the key frame, the data of the second bit number is selected from the cipher stream, and then the data of the second bit number and the key frame are subjected to an exclusive or operation to obtain the first encrypted frame corresponding to the key frame.
The cipher stream is generated according to the initialization vector and the preset key, so that the key frame does not need to be subjected to exclusive-or operation by using all data in the cipher stream, the key frame can be subjected to exclusive-or operation by using part of data in the cipher stream, the bit number of the data participating in the exclusive-or operation in the cipher stream can be the same as the second bit number included in the key frame, the bit number of the obtained first encrypted frame can be the same as the bit number of the key frame, the situation that the bit number of the first encrypted frame is larger than the bit number of the key frame is avoided, the situation that the bit number of the encrypted video is larger than the bit number of the original video is further avoided, and network resources can be saved.
After the original video is encrypted to obtain the encrypted video through the above embodiment, the encrypted video may be decrypted to obtain the original video, and the specific manner is as shown in the following embodiment.
Referring to fig. 2, a flowchart illustrating steps of a video processing method according to the present invention is shown, where the method may specifically include the following steps:
in step S201, an encrypted video is obtained, where the encrypted video is obtained according to second check data and an intermediate video, the second check data is obtained by checking the intermediate video based on a preset check algorithm, the intermediate video is obtained according to a non-key frame, a first encrypted frame and first check data in an original video, the first check data is obtained by checking the original video based on the preset check algorithm, and the first encrypted frame is obtained by encrypting a key frame in the original video;
in the present invention, the encrypted video may be obtained by encrypting the original video according to the method of the embodiment shown in fig. 1.
In step S202, second check data and an intermediate video are acquired from the encrypted video;
in which the number of bits of the second parity data is determined, and the second parity data is added after the intermediate video in the embodiment shown in fig. 1, and therefore, it is possible to take the last specific number of bits of data in the encrypted video as the second parity data and then take the data other than the second parity data in the encrypted video as the intermediate video.
In step S203, checking the intermediate video based on a preset checking algorithm to obtain third checking data;
in step S204, under the condition that the second verification data is the same as the third verification data, acquiring a non-key frame, a first encrypted frame, and first verification data from the intermediate video;
in case the second parity data is identical to the third parity data, it is indicated that the intermediate video is valid,
in which the number of bits of the first parity data is determined, and in the embodiment shown in fig. 1, the first parity data is added after the original video, and thus, the last specific number of bits of data in the intermediate video may be used as the first parity data.
In the present invention, in the embodiment of fig. 1, the server side encrypts the original video, and can mark the non-key frame and the first encrypted frame in the encrypted video through the special mark, so that the client side can identify the non-key frame and the first encrypted frame in the encrypted video according to the special mark. The first check data is located at the end of the intermediate video.
The non-key frames include P frames, B frames and the like in the original video.
In step S205, the first encrypted frame is decrypted to obtain a key frame;
wherein, the key frame at least comprises an I frame in the original video and the like.
In step S206, a video to be verified is obtained according to the key frame and the non-key frame;
the key frames and the non-key frames in the original video can be combined to obtain the video to be verified corresponding to the intermediate video. For example, the key frame is used to replace the first encrypted frame in the intermediate video, resulting in the video to be authenticated.
In step S207, verifying the video to be verified based on a preset verification algorithm to obtain fourth verification data;
in step S208, in the case that the fourth verification data is the same as the first verification data, the video to be verified is determined to be the original video.
And under the condition that the fourth verification data is the same as the first verification data, the video to be verified is valid, and the video to be verified can be determined as the original video.
By the method, whether the intermediate video is valid or not can be determined based on the second check data, and whether the restored original video is valid or not can be determined based on the first check data. Secondly, even if the lawbreaker obtains the non-key frames in the original video, the lawbreaker can hardly restore the original video as long as the lawbreaker does not crack the key frames in the original video. The method for decrypting the encrypted video supports that when the original video is encrypted, the whole original video is not encrypted, but the key frame in the original video is encrypted to obtain a first encrypted frame; and then, acquiring an encrypted video corresponding to the original video according to the non-key frame and the first encrypted frame in the original video, so that a lawbreaker can hardly restore the original video because the key frame in the original video is encrypted, the security of the original video is ensured, and in addition, the non-key frame in the original video can not be encrypted, thereby improving the encryption efficiency of the original video. Therefore, the invention can reduce the time consumed in the process of encrypting the original video on the premise of ensuring the safety of the original video, thereby improving the encryption efficiency of the original video.
In addition, when the encrypted video is decrypted, only the first encrypted frame in the encrypted video needs to be decrypted, and other frames do not need to be decrypted, so that the time consumed in the process of decrypting the encrypted video can be reduced, and the decryption efficiency of the encrypted video is improved.
In another embodiment of the present invention, the intermediate video is obtained according to a first encrypted frame, a second encrypted frame and encrypted data, the second encrypted frame is obtained by encrypting the non-key frame by using an encryption algorithm with a first encryption strength, the encrypted data is obtained by encrypting the first verification data by using an encryption algorithm with a first encryption strength, wherein the first encryption strength is lower than the second encryption strength of the encryption algorithm used for encrypting the key frame to obtain the first encrypted frame;
thus, when the non-key frame, the first encrypted frame and the first verification data are obtained according to the intermediate video, the first encrypted frame, the second encrypted frame and the encrypted data can be obtained according to the intermediate video; decrypting the second encrypted frame by using a decryption algorithm with the first decryption strength to obtain a non-key frame; decrypting the first encrypted data by using a decryption algorithm with first decryption intensity to obtain first verification data; the second decryption strength is lower than a second decryption strength of a decryption algorithm used to decrypt the first encrypted frame.
In support of the foregoing embodiment, when the intermediate video corresponding to the original video is obtained according to the non-key frame, the first encrypted frame, and the first verification data in the original video, the encryption algorithm with the first encryption strength may be used to encrypt the non-key frame, so as to obtain the second encrypted frame; encrypting the first verification data by using an encryption algorithm with first encryption strength to obtain encrypted data; wherein the first encryption strength is lower than the second encryption strength of the encryption algorithm used for encrypting the key frames, and then the intermediate video is obtained according to the first encryption frame, the second encryption frame and the encrypted data. The first encrypted frame, the second encrypted frame, and the encrypted data may be combined to obtain an intermediate video corresponding to the original video, for example, replacing a key frame in the original video with the first encrypted frame, and replacing a non-key frame in the original video with the second encrypted frame, and then adding the encrypted data after replacing the key frame and the non-key frame in the original video to obtain the encrypted video.
Therefore, when a lawbreaker wants to crack an original video, the lawbreaker needs to crack key frames in the original video according to the first encrypted frame, simultaneously needs to crack non-key frames in the original video according to the second encrypted frame, and cracks first check data according to the encrypted data.
In one embodiment of the present invention, the encrypted video sometimes includes at least two first encrypted frames, and the present invention can decrypt the at least two first encrypted frames, and in one manner, the encryption process for any one key frame is related to the result of encrypting the key frame before the key frame, for example, the initialization vector required to encrypt any one key frame is obtained at least according to the result of encrypting the key frame before the key frame, so that after one key frame is encrypted, the initialization vector required to encrypt the next key frame can be obtained according to the encryption result, and the next key frame can be kept secret.
Thus, in this manner, at least two frames of the first encrypted frames need to be decrypted in series, each frame of the first encrypted frames needs to be decrypted for one encryption time, several pieces of encryption time need to be consumed for decrypting several first encrypted frames in the encrypted video, and therefore, the process of decrypting at least two frames of the first encrypted frames needs to be consumed for a long time, and further, the encryption efficiency is low.
Therefore, in order to further improve the decryption efficiency, when the first encrypted frame in the encrypted video is decrypted, if at least two first encrypted frames in the encrypted video need to be decrypted, the at least two first encrypted frames can be respectively decrypted in parallel.
For example, at least two frames of a first encrypted frame that need to be encrypted may be determined in the original video; then, for any one frame of the first encrypted frames in the at least two frames of the first encrypted frames, an initialization vector corresponding to the first encrypted frame can be generated, then a cipher stream is generated according to a preset key and the initialization vector, and then the first encrypted frame is operated according to the cipher stream to obtain a key frame corresponding to the first encrypted frame. The same is true for each of the other at least two first encrypted frames.
In the present invention, the initialization vectors generated for different first encrypted frames may be different, and the initialization vector corresponding to any one frame of the first encrypted frame may be independent of the initialization vectors corresponding to other first encrypted frames, and may be independent of intermediate results and final results generated in the process of decrypting other first encrypted frames, or the initialization vectors of different first encrypted frames are independent of each other or do not affect each other. Accordingly, the decryption process for the at least two first encrypted frames in the encrypted video may be performed in parallel, so that the time required for the decryption process for the at least two first encrypted frames may be reduced, for example, the time required for the decryption process for the at least two first encrypted frames may be reduced to an encryption time, so that the decryption efficiency may be improved.
When the first encrypted frame is operated according to the cipher stream to obtain the key frame corresponding to the first encrypted frame, under the condition that a first bit number included in the cipher stream is greater than a second bit number included in the first encrypted frame, data of a second bit number is selected from the cipher stream, and then the data of the second bit number and the first encrypted frame are subjected to exclusive-or operation to obtain the key frame corresponding to the first encrypted frame.
The embodiment of the invention supports that when the original video is encrypted, the XOR operation on the key frame can be performed by using part of the data in the cipher stream without using all the data in the cipher stream, and the bit number of the data participating in the XOR operation in the cipher stream can be the same as the second bit number included in the key frame, so that the bit number of the obtained first encrypted frame can be the same as the bit number of the key frame, the situation that the bit number of the first encrypted frame is larger than the bit number of the key frame is avoided, the situation that the bit number of the encrypted video is larger than the bit number of the original video is further avoided, the situation that the bit number of the encrypted video transmitted from a service end to a client is larger than the bit number of the original video is further avoided, and the network resource can be saved.
Referring to fig. 3, there is shown a block diagram of a video processing apparatus of the present invention, the apparatus including:
the first checking module 11 is configured to check the original video based on a preset checking algorithm to obtain first checking data;
the encryption module 12 is configured to encrypt a key frame in the original video to obtain a first encrypted frame;
a first obtaining module 13, configured to obtain an intermediate video corresponding to the original video according to a non-key frame in the original video, the first encrypted frame, and the first verification data;
the second checking module 14 is configured to check the intermediate video based on a preset checking algorithm to obtain second checking data;
a second obtaining module 15, configured to obtain, according to the second check data and the intermediate video, an encrypted video corresponding to the original video.
In an optional implementation manner, the first obtaining module includes:
the first encryption unit is used for encrypting the non-key frames by using an encryption algorithm with first encryption strength to obtain second encrypted frames;
the second encryption unit is used for encrypting the first verification data by using an encryption algorithm with first encryption strength to obtain encrypted data;
a first obtaining unit configured to obtain the intermediate video according to the first encrypted frame, the second encrypted frame, and the encrypted data;
wherein the first encryption strength is lower than a second encryption strength of an encryption algorithm used to encrypt the key frame.
In an alternative implementation, the encryption module includes:
the first determining unit is used for determining at least two frames of key frames needing to be encrypted in the original video;
the device comprises a first generating unit, a first operating unit and a second generating unit, wherein the first generating unit is used for generating an initialization vector corresponding to each key frame in at least two key frames, the first generating unit is used for generating a cipher stream according to a preset key and the initialization vector, and the first operating unit is used for operating the key frames according to the cipher stream to obtain a first encrypted frame corresponding to the key frame.
In an optional implementation manner, the first operation unit includes:
the first selection unit is used for selecting the data of the second bit number in the cipher stream under the condition that the first bit number included in the cipher stream is larger than the second bit number included in the key frame, and the second operation unit is used for carrying out XOR operation on the data of the second bit number and the key frame to obtain a first encrypted frame corresponding to the key frame.
In the invention, an original video is verified based on a preset verification algorithm to obtain first verification data; encrypting a key frame in an original video to obtain a first encrypted frame; acquiring an intermediate video corresponding to the original video according to the non-key frame, the first encrypted frame and the first verification data in the original video; checking the intermediate video based on a preset checking algorithm to obtain second checking data; and acquiring the encrypted video corresponding to the original video according to the second check data and the intermediate video.
In this way, when the original video needs to be restored later, whether the intermediate video is valid or not can be determined based on the second check data, and whether the restored original video is valid or not can be determined based on the first check data.
In addition, even if a lawbreaker obtains a non-key frame in the original video, as long as the lawbreaker does not crack the key frame in the original video, the lawbreaker can hardly restore the original video, so that when the original video is encrypted, the original video can be encrypted without encrypting the whole original video, and the key frame in the original video can be encrypted to obtain a first encrypted frame; and then, acquiring an encrypted video corresponding to the original video according to the non-key frame and the first encrypted frame in the original video, so that a lawbreaker can hardly restore the original video because the key frame in the original video is encrypted, the security of the original video is ensured, and in addition, the non-key frame in the original video can not be encrypted, thereby improving the encryption efficiency of the original video. Therefore, the invention can reduce the time consumed in the process of encrypting the original video on the premise of ensuring the safety of the original video, thereby improving the encryption efficiency of the original video.
Referring to fig. 4, there is shown a block diagram of a video processing apparatus of the present invention, the apparatus including:
a third obtaining module 21, configured to obtain an encrypted video, where the encrypted video is obtained according to second verification data and an intermediate video, the second verification data is obtained by verifying the intermediate video based on a preset verification algorithm, the intermediate video is obtained according to a non-key frame in an original video, a first encrypted frame, and first verification data, the first verification data is obtained by verifying the original video based on the preset verification algorithm, and the first encrypted frame is obtained by encrypting a key frame in the original video;
a fourth obtaining module 22, configured to obtain the second check-up data and the intermediate video according to the encrypted video;
the third verification module 23 is configured to verify the intermediate video based on the preset verification algorithm to obtain third verification data;
a fifth obtaining module 24, configured to obtain the non-key frame, the first encrypted frame, and the first verification data according to the intermediate video when the second verification data is the same as the third verification data;
a decryption module 25, configured to decrypt the first encrypted frame to obtain the key frame;
a sixth obtaining module 26, configured to obtain a video to be verified according to the key frame and the non-key frame;
a fourth verification module 27, configured to verify the video to be verified based on the preset verification algorithm to obtain fourth verification data;
a determining module 28, configured to determine the video to be verified as the original video if the fourth verification data is the same as the first verification data.
In an optional implementation manner, the intermediate video is obtained according to a first encrypted frame, a second encrypted frame, and encrypted data, the second encrypted frame is obtained by encrypting the non-key frame by using an encryption algorithm with a first encryption strength, and the encrypted data is obtained by encrypting the first verification data by using an encryption algorithm with a first encryption strength, where the first encryption strength is lower than a second encryption strength of an encryption algorithm used for encrypting the key frame to obtain the first encrypted frame;
the fifth obtaining module includes:
a second obtaining unit configured to obtain the first encrypted frame, the second encrypted frame, and the encrypted data from the intermediate video;
the first decryption unit is used for decrypting the second encrypted frame by using a decryption algorithm with first decryption strength to obtain a non-key frame;
the first decryption unit is used for decrypting the first encrypted data by using a decryption algorithm with first decryption strength to obtain first verification data;
the second decryption strength is lower than a second decryption strength of a decryption algorithm used to decrypt the first encrypted frame.
In an optional implementation manner, the decryption module includes:
a second determination unit for determining at least two first encrypted frames in the original video;
the device comprises a third generating unit, a fourth generating unit and a second operating unit, wherein the third generating unit is used for generating an initialization vector corresponding to each first encryption frame in at least two first encryption frames, the fourth generating unit is used for generating a cipher stream according to a preset key and the initialization vector, and the second operating unit is used for operating the first encryption frames according to the cipher stream to obtain key frames corresponding to the first encryption frames.
In an optional implementation manner, the second operation unit includes:
the second selection subunit is configured to select data of a second bit number from the cipher stream when a first bit number included in the cipher stream is greater than a second bit number included in the first encrypted frame, and the second operation subunit is configured to perform an exclusive or operation on the data of the second bit number and the first encrypted frame to obtain a key frame corresponding to the first encrypted frame.
By the method, whether the intermediate video is valid or not can be determined based on the second check data, and whether the restored original video is valid or not can be determined based on the first check data. Secondly, even if the lawbreaker obtains the non-key frames in the original video, the lawbreaker can hardly restore the original video as long as the lawbreaker does not crack the key frames in the original video. The method for decrypting the encrypted video supports that when the original video is encrypted, the whole original video is not encrypted, but the key frame in the original video is encrypted to obtain a first encrypted frame; and then, acquiring an encrypted video corresponding to the original video according to the non-key frame and the first encrypted frame in the original video, so that a lawbreaker can hardly restore the original video because the key frame in the original video is encrypted, the security of the original video is ensured, and in addition, the non-key frame in the original video can not be encrypted, thereby improving the encryption efficiency of the original video. Therefore, the invention can reduce the time consumed in the process of encrypting the original video on the premise of ensuring the safety of the original video, thereby improving the encryption efficiency of the original video.
In addition, when the encrypted video is decrypted, only the first encrypted frame in the encrypted video needs to be decrypted, and other frames do not need to be decrypted, so that the time consumed in the process of decrypting the encrypted video can be reduced, and the decryption efficiency of the encrypted video is improved.
An embodiment of the present invention further provides an electronic device, as shown in fig. 5, including a processor 601, a communication interface 602, a memory 603, and a communication bus 604, where the processor 601, the communication interface 602, and the memory 603 complete mutual communication through the communication bus 604,
a memory 603 for storing a computer program;
the processor 601 is configured to implement the following steps when executing the program stored in the memory 603:
verifying the original video based on a preset verification algorithm to obtain first verification data;
encrypting the key frame in the original video to obtain a first encrypted frame;
acquiring an intermediate video corresponding to the original video according to the non-key frame, the first encrypted frame and the first verification data in the original video;
verifying the intermediate video based on a preset verification algorithm to obtain second verification data;
and acquiring an encrypted video corresponding to the original video according to the second check data and the intermediate video.
In an optional implementation manner, the obtaining an intermediate video corresponding to the original video according to the non-key frame, the first encrypted frame, and the first verification data in the original video includes:
encrypting the non-key frames by using an encryption algorithm with first encryption strength to obtain second encrypted frames;
encrypting the first verification data by using an encryption algorithm with first encryption strength to obtain encrypted data;
acquiring the intermediate video according to the first encrypted frame, the second encrypted frame and the encrypted data;
wherein the first encryption strength is lower than a second encryption strength of an encryption algorithm used to encrypt the key frame.
In an optional implementation manner, the encrypting the key frame in the original video to obtain a first encrypted frame includes:
determining at least two key frames needing to be encrypted in the original video;
for each key frame of at least two key frames, generating an initialization vector corresponding to the key frame, generating a cipher stream according to a preset key and the initialization vector, and operating the key frame according to the cipher stream to obtain a first encrypted frame corresponding to the key frame.
In an optional implementation manner, the performing an operation on the key frame according to the cipher stream to obtain a first encrypted frame corresponding to the key frame includes:
and under the condition that a first bit number included in the cipher stream is greater than a second bit number included in the key frame, selecting data of the second bit number in the cipher stream, and then performing exclusive-or operation on the data of the second bit number and the key frame to obtain a first encrypted frame corresponding to the key frame.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
An embodiment of the present invention further provides an electronic device, as shown in fig. 6, including a processor 701, a communication interface 702, a memory 703 and a communication bus 704, where the processor 701, the communication interface 702, and the memory 703 complete mutual communication through the communication bus 704,
a memory 703 for storing a computer program;
the processor 701 is configured to implement the following steps when executing the program stored in the memory 703:
acquiring an encrypted video, wherein the encrypted video is acquired according to second check data and an intermediate video, the second check data is acquired by checking the intermediate video based on a preset check algorithm, the intermediate video is acquired according to a non-key frame, a first encrypted frame and first check data in an original video, the first check data is acquired by checking the original video based on the preset check algorithm, and the first encrypted frame is acquired by encrypting a key frame in the original video;
acquiring the second check-up data and the intermediate video according to the encrypted video;
verifying the intermediate video based on the preset verification algorithm to obtain third verification data;
under the condition that the second check data is the same as the third check data, acquiring the non-key frame, the first encrypted frame and the first check data according to the intermediate video;
decrypting the first encrypted frame to obtain the key frame;
acquiring a video to be verified according to the key frame and the non-key frame;
verifying the video to be verified based on the preset verification algorithm to obtain fourth verification data;
and under the condition that the fourth verification data is the same as the first verification data, determining the video to be verified as the original video.
In an optional implementation manner, the intermediate video is obtained according to a first encrypted frame, a second encrypted frame, and encrypted data, the second encrypted frame is obtained by encrypting the non-key frame by using an encryption algorithm with a first encryption strength, and the encrypted data is obtained by encrypting the first verification data by using an encryption algorithm with a first encryption strength, where the first encryption strength is lower than a second encryption strength of an encryption algorithm used for encrypting the key frame to obtain the first encrypted frame;
the acquiring the non-key frame, the first encrypted frame, and the first verification data according to the intermediate video includes:
acquiring the first encrypted frame, the second encrypted frame and the encrypted data according to the intermediate video;
decrypting the second encrypted frame by using a decryption algorithm with first decryption strength to obtain a non-key frame;
decrypting the first encrypted data by using a decryption algorithm with first decryption intensity to obtain first verification data;
the second decryption strength is lower than a second decryption strength of a decryption algorithm used to decrypt the first encrypted frame.
In an optional implementation manner, the decrypting the first encrypted frame to obtain the key frame includes:
determining at least two first encrypted frames in the original video;
for each frame of first encryption frames in at least two frames of first encryption frames, generating an initialization vector corresponding to the first encryption frame, generating a cipher stream according to a preset key and the initialization vector, and operating the first encryption frame according to the cipher stream to obtain a key frame corresponding to the first encryption frame.
In an optional implementation manner, the performing an operation on the first encrypted frame according to the cipher stream to obtain a key frame corresponding to the first encrypted frame includes:
and under the condition that a first bit number included in the cipher stream is larger than a second bit number included in the first encryption frame, selecting data of the second bit number in the cipher stream, and then carrying out XOR operation on the data of the second bit number and the first encryption frame to obtain a key frame corresponding to the first encryption frame.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, which has instructions stored therein, and when the instructions are executed on a computer, the computer is caused to execute the video processing method described in any of the above embodiments.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the video processing method of any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (14)

1. A method of video processing, the method comprising:
verifying the original video based on a preset verification algorithm to obtain first verification data;
encrypting the key frame in the original video to obtain a first encrypted frame;
acquiring an intermediate video corresponding to the original video according to the non-key frame, the first encrypted frame and the first verification data in the original video;
verifying the intermediate video based on a preset verification algorithm to obtain second verification data;
and acquiring an encrypted video corresponding to the original video according to the second check data and the intermediate video.
2. The method according to claim 1, wherein the obtaining an intermediate video corresponding to the original video according to the non-key frame in the original video, the first encrypted frame and the first verification data comprises:
encrypting the non-key frames by using an encryption algorithm with first encryption strength to obtain second encrypted frames;
encrypting the first verification data by using an encryption algorithm with first encryption strength to obtain encrypted data;
acquiring the intermediate video according to the first encrypted frame, the second encrypted frame and the encrypted data;
wherein the first encryption strength is lower than a second encryption strength of an encryption algorithm used to encrypt the key frame.
3. The method of claim 1, wherein encrypting the key frame in the original video to obtain the first encrypted frame comprises:
determining at least two key frames needing to be encrypted in the original video;
for each key frame of at least two key frames, generating an initialization vector corresponding to the key frame, generating a cipher stream according to a preset key and the initialization vector, and operating the key frame according to the cipher stream to obtain a first encrypted frame corresponding to the key frame.
4. The method of claim 3, wherein the operating the key frame according to the cipher stream to obtain a first encrypted frame corresponding to the key frame comprises:
and under the condition that a first bit number included in the cipher stream is greater than a second bit number included in the key frame, selecting data of the second bit number in the cipher stream, and then performing exclusive-or operation on the data of the second bit number and the key frame to obtain a first encrypted frame corresponding to the key frame.
5. A method of video processing, the method comprising:
acquiring an encrypted video, wherein the encrypted video is acquired according to second check data and an intermediate video, the second check data is acquired by checking the intermediate video based on a preset check algorithm, the intermediate video is acquired according to a non-key frame, a first encrypted frame and first check data in an original video, the first check data is acquired by checking the original video based on the preset check algorithm, and the first encrypted frame is acquired by encrypting a key frame in the original video;
acquiring the second check-up data and the intermediate video according to the encrypted video;
verifying the intermediate video based on the preset verification algorithm to obtain third verification data;
under the condition that the second check data is the same as the third check data, acquiring the non-key frame, the first encrypted frame and the first check data according to the intermediate video;
decrypting the first encrypted frame to obtain the key frame;
acquiring a video to be verified according to the key frame and the non-key frame;
verifying the video to be verified based on the preset verification algorithm to obtain fourth verification data;
and under the condition that the fourth verification data is the same as the first verification data, determining the video to be verified as the original video.
6. The method according to claim 5, wherein the intermediate video is obtained from a first encrypted frame, a second encrypted frame obtained by encrypting the non-key frame using an encryption algorithm with a first encryption strength, and encrypted data obtained by encrypting the first verification data using an encryption algorithm with a first encryption strength, wherein the first encryption strength is lower than a second encryption strength of an encryption algorithm used for encrypting the key frame to obtain the first encrypted frame;
the acquiring the non-key frame, the first encrypted frame, and the first verification data according to the intermediate video includes:
acquiring the first encrypted frame, the second encrypted frame and the encrypted data according to the intermediate video;
decrypting the second encrypted frame by using a decryption algorithm with first decryption strength to obtain a non-key frame;
decrypting the first encrypted data by using a decryption algorithm with first decryption intensity to obtain first verification data;
the second decryption strength is lower than a second decryption strength of a decryption algorithm used to decrypt the first encrypted frame.
7. The method of claim 5, wherein decrypting the first encrypted frame to obtain the key frame comprises:
determining at least two first encrypted frames in the original video;
for each frame of first encryption frames in at least two frames of first encryption frames, generating an initialization vector corresponding to the first encryption frame, generating a cipher stream according to a preset key and the initialization vector, and operating the first encryption frame according to the cipher stream to obtain a key frame corresponding to the first encryption frame.
8. The method of claim 7, wherein the operating the first encrypted frame according to the stream cipher to obtain the key frame corresponding to the first encrypted frame comprises:
and under the condition that a first bit number included in the cipher stream is larger than a second bit number included in the first encryption frame, selecting data of the second bit number in the cipher stream, and then carrying out XOR operation on the data of the second bit number and the first encryption frame to obtain a key frame corresponding to the first encryption frame.
9. A video processing apparatus, characterized in that the apparatus comprises:
the first checking module is used for checking the original video based on a preset checking algorithm to obtain first checking data;
the encryption module is used for encrypting the key frame in the original video to obtain a first encrypted frame;
a first obtaining module, configured to obtain an intermediate video corresponding to the original video according to a non-key frame in the original video, the first encrypted frame, and the first verification data;
the second checking module is used for checking the intermediate video based on a preset checking algorithm to obtain second checking data;
and the second acquisition module is used for acquiring the encrypted video corresponding to the original video according to the second check data and the intermediate video.
10. A video processing apparatus, characterized in that the apparatus comprises:
a third obtaining module, configured to obtain an encrypted video, where the encrypted video is obtained according to second check data and an intermediate video, the second check data is obtained by checking the intermediate video based on a preset check algorithm, the intermediate video is obtained according to a non-key frame, a first encrypted frame, and first check data in an original video, the first check data is obtained by checking the original video based on the preset check algorithm, and the first encrypted frame is obtained by encrypting a key frame in the original video;
a fourth obtaining module, configured to obtain the second check data and the intermediate video according to the encrypted video;
the third checking module is used for checking the intermediate video based on the preset checking algorithm to obtain third checking data;
a fifth obtaining module, configured to obtain the non-key frame, the first encrypted frame, and the first verification data according to the intermediate video when the second verification data is the same as the third verification data;
the decryption module is used for decrypting the first encrypted frame to obtain the key frame;
a sixth obtaining module, configured to obtain a video to be verified according to the key frame and the non-key frame;
the fourth verification module is used for verifying the video to be verified based on the preset verification algorithm to obtain fourth verification data;
a determining module, configured to determine the video to be verified as the original video under the condition that the fourth verification data is the same as the first verification data.
11. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 4 when executing a program stored in the memory.
12. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-4.
13. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 5 to 8 when executing a program stored in the memory.
14. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 5-8.
CN202010525268.2A 2020-06-10 2020-06-10 Video processing method and device, electronic equipment and storage medium Pending CN111669650A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010525268.2A CN111669650A (en) 2020-06-10 2020-06-10 Video processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010525268.2A CN111669650A (en) 2020-06-10 2020-06-10 Video processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111669650A true CN111669650A (en) 2020-09-15

Family

ID=72386616

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010525268.2A Pending CN111669650A (en) 2020-06-10 2020-06-10 Video processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111669650A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112351065A (en) * 2020-09-21 2021-02-09 视联动力信息技术股份有限公司 Data transmission method, device, terminal equipment and storage medium
CN113573306A (en) * 2021-04-29 2021-10-29 中国南方电网有限责任公司 5G-fused heterogeneous networking gateway encryption method and system
CN117556082A (en) * 2024-01-12 2024-02-13 广东启正电子科技有限公司 Remote face recognition video storage method and system based on sequence coding

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549491A (en) * 2003-05-06 2004-11-24 �Ҵ���˾ Encrypting and deencrypting method and apparatus for data flow
CN1567878A (en) * 2003-06-27 2005-01-19 华为技术有限公司 A method of data integrity protection in WLAN
CN101094057A (en) * 2006-06-20 2007-12-26 国际商业机器公司 Content dividing method, device and system
CN101784045A (en) * 2009-01-20 2010-07-21 英华达(上海)电子有限公司 Method and device for generating secrete key and method and device for loading secrete key
CN103684787A (en) * 2013-12-13 2014-03-26 北京大学深圳研究生院 Encryption-decryption method and terminal of data pack based on network transmission
CN110311773A (en) * 2019-06-28 2019-10-08 兆讯恒达微电子技术(北京)有限公司 A kind of method of the anti-injection attack of Advanced Encryption Standard coprocessor
CN110430446A (en) * 2019-07-26 2019-11-08 东软集团股份有限公司 Method for processing video frequency, device, equipment and computer readable storage medium
CN110868398A (en) * 2019-10-17 2020-03-06 北京全路通信信号研究设计院集团有限公司 Data frame encryption method, data frame decryption method and data frame decryption device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549491A (en) * 2003-05-06 2004-11-24 �Ҵ���˾ Encrypting and deencrypting method and apparatus for data flow
CN1567878A (en) * 2003-06-27 2005-01-19 华为技术有限公司 A method of data integrity protection in WLAN
CN101094057A (en) * 2006-06-20 2007-12-26 国际商业机器公司 Content dividing method, device and system
CN101784045A (en) * 2009-01-20 2010-07-21 英华达(上海)电子有限公司 Method and device for generating secrete key and method and device for loading secrete key
CN103684787A (en) * 2013-12-13 2014-03-26 北京大学深圳研究生院 Encryption-decryption method and terminal of data pack based on network transmission
CN110311773A (en) * 2019-06-28 2019-10-08 兆讯恒达微电子技术(北京)有限公司 A kind of method of the anti-injection attack of Advanced Encryption Standard coprocessor
CN110430446A (en) * 2019-07-26 2019-11-08 东软集团股份有限公司 Method for processing video frequency, device, equipment and computer readable storage medium
CN110868398A (en) * 2019-10-17 2020-03-06 北京全路通信信号研究设计院集团有限公司 Data frame encryption method, data frame decryption method and data frame decryption device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112351065A (en) * 2020-09-21 2021-02-09 视联动力信息技术股份有限公司 Data transmission method, device, terminal equipment and storage medium
CN113573306A (en) * 2021-04-29 2021-10-29 中国南方电网有限责任公司 5G-fused heterogeneous networking gateway encryption method and system
CN117556082A (en) * 2024-01-12 2024-02-13 广东启正电子科技有限公司 Remote face recognition video storage method and system based on sequence coding
CN117556082B (en) * 2024-01-12 2024-03-22 广东启正电子科技有限公司 Remote face recognition video storage method and system based on sequence coding

Similar Documents

Publication Publication Date Title
JP4907450B2 (en) Apparatus and method for providing a video stream that ensures integrity
CN111669650A (en) Video processing method and device, electronic equipment and storage medium
CN101977190B (en) Digital content encryption transmission method and server side
JP4674608B2 (en) NODE DEVICE, INFORMATION PROCESSING METHOD, AND NODE DEVICE PROGRAM
US20140086412A1 (en) Encryption device, encryption method, and encryption program
CN103338385A (en) Video processing system and corresponding method
CN109274644B (en) Data processing method, terminal and watermark server
US20170353745A1 (en) Secure media player
WO2019001083A1 (en) Authentication method and device for video stream address
TW201251427A (en) Enforcing software updates in an electronic device
JP2004193942A (en) Method, apparatus and program for transmitting content and method, apparatus and program for receiving content
JP2018148434A (en) Key generation device and key generation method
CN111786777B (en) Stream data encryption and decryption method, device, system and storage medium
CN111586442B (en) Stream media encryption method and device, computer equipment and storage medium
KR102038963B1 (en) Method and Apparatus for Selectively Providing Protection of Screen information data
CN112804058A (en) Conference data encryption and decryption method and device, storage medium and electronic equipment
CN111698534B (en) Video processing method and device, electronic equipment and storage medium
CN110798436B (en) Verification code verification method and device
CN111432242A (en) Encrypted video call method, device, equipment and storage medium
CN113704206B (en) Metadata processing method and device, electronic equipment and storage medium
CN115603907A (en) Method, device, equipment and storage medium for encrypting storage data
CN109218009A (en) It is a kind of to improve the method for device id safety, client and server
Wang et al. On the multi-level embedding of crypto-image reversible data hiding
CN112104874A (en) Data transmission method and system
CN106921644B (en) Client data file verification method and device

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200915

RJ01 Rejection of invention patent application after publication