A kind of video encryption methodTechnical field
The present invention relates to technical fields such as video-encryption, coding and decoding videos, a kind of video encryption method is in particular related to.
Background technology
Currently, as computer network is popularized and the fast lifting of network performance, in safe city, smart city, intelligenceIn terms of traffic, video monitoring just with its good technology and cost advantage, achieves fast development, disparate networks video monitoringConstruction is also carried out throughout the country.
A large amount of digital high-definition IPC High Speed Construction, has driven video storage technology fast-developing.It is based especially on IP networkThe memory technology of framework is maked rapid progress, and the storage product of a large amount of forms, such as NVR/ have been emerged around Video Surveillance Industry applicationCVR storages, network storage server, storage all-in-one, cloud storage etc..The modern times such as safe city, intelligent prison, wisdom postThe scale of the video monitoring system of change is increasing, therewith, and the video interactive of management and control also more and more frequently, causes video to be shared(safety) and circulation monitoring (tracing to the source) etc. have very big hidden danger.
Removing needs outside the service video information that opens towards the public, all monitoring systems no matter be used for where or whatPlant purpose to have to video information uniqueness and private demand for security, at present, the industry that encrypted video is primarily applied shouldIt is that risk is higher with the higher important department of safe class.It can be passed further, since encrypted video is exclusive in public internet safeDefeated characteristic, also makes it have obvious advantage and the imagination empty in long-distance education, tele-medicine, remote production and job managementBetween.
Relatively simple to the AES of video at present, security is difficult to ensure that;And encrypt offline commonplace, it is impossible to reachTo the real-time encrypted of video, encryption efficiency is than relatively low.
The content of the invention
According to problems of the prior art, the invention provides a kind of video encryption method, the present invention realize fromThe synchronism of the real-time encrypted processing in storage device top foradownloaded video side, improves video-encryption and copy efficiency, compares simultaneouslyFor single AES, cipher round results are good, with good security.
For achieving the above object, the invention provides a kind of video encryption method, comprise the following steps:
S1, whether for the video file for needing to encrypt, it is source code flow video to judge it;
S2, when video file is source code flow video, using Key Frame Extraction algorithm and the header AES of videoVideo is encrypted, the video file of encryption is formed;When video is compressed bit stream video, is first decoded, be reduced into originalStreaming video, then video is encrypted using the header AES of Key Frame Extraction algorithm and video again, is formed and addedClose video file;
H.264, S3, is encoded and is preserved to the video file after encryption, forms compression encrypted video file.
It is preferred that, the Key Frame Extraction algorithm refers to the IPB frame structures by video, I frames is extracted from video flowing, onlyI frames are encrypted.
It is preferred that, the video header encryption refers to the header information data of video is encrypted, and the head of video is believedBreath data become random sequence.
It is preferred that, the decoding includes standard decoding, that is, uses H.264 to decode and coded format is entered for code stream H.264Row decoding.
The beneficial effects of the present invention are:
1) present invention reduces encryption number of frames by the way that only the I frames in the IPB frames of video are encrypted, and improves and addsClose speed, realizes the synchronism from the real-time encrypted processing in storage device top foradownloaded video side, so as to improve video-encryptionWith copy efficiency, the requirement of the real-time encrypted transmission of video data and access is met.
2) while the present invention is encrypted by the I frames in the IPB frames to video, the header of video is encrypted, i.e.,The header information data of video is become into random sequence, after header information data encryption, has broken original corresponding relation, has served and addClose effect;For single AES, two kinds of encryption methods combine that cipher round results are good, with good safetyProperty.
Brief description of the drawings
Fig. 1 is the overview flow chart of video encryption method of the present invention.
Fig. 2 is the workflow diagram of video encryption method of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, completeSite preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.It is based onEmbodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under the premise of creative work is not madeEmbodiment, belongs to the scope of protection of the invention.
As depicted in figs. 1 and 2, a kind of video encryption method, the described method comprises the following steps:
S1, whether for the video file for needing to encrypt, it is source code flow video to judge it;
Specifically, the video file encrypted the need for being provided for video storaging equipments such as DVR/NVR, judgement is source codeStream video or compressed bit stream video.
S2, when video file is source code flow video, using Key Frame Extraction algorithm and the header AES of videoVideo is encrypted, the video file of encryption is formed;When video is compressed bit stream video, is first decoded, be reduced into originalStreaming video, video is encrypted using the header AES of Key Frame Extraction algorithm and video, forms regarding for encryptionFrequency file;
Specifically, the Key Frame Extraction algorithm refers to the IPB frame structures by video, I frames are extracted from video flowing, onlyI frames are encrypted, the number of frames for needing to encrypt is reduced, improves enciphering rate, the number of frames for needing to encrypt is reduced, carriesHigh enciphering rate, realizes the synchronism from the real-time encrypted processing in storage device top foradownloaded video side, is regarded so as to improveFrequency is encrypted and copy efficiency, meets the requirement of the real-time encrypted transmission of video data and access.
Meanwhile, the encryption of video header is that the header information data of video is encrypted, and the header information data of video is becomeInto random sequence, after header information data encryption, original corresponding relation is broken, has served the effect of encryption, made recipient difficultWith specification configuration information data (video information such as position, size, time of frame) and video information data (video frame information), moreIt is difficult to know the particular content of data structure and data, it is difficult to the Video coding number received is decoded by former data structureAccording to, it is impossible to original image is obtained, the purpose of encryption is reached.
The decoding includes standard and decoded, that is, uses H.264 to decode coded format is decoded for code stream H.264.
H.264 it is the technology encoded based on frame, using DPCM plus the hybrid coding pattern of transition coding.But it, which is used, " returnsReturn basic " compact design, without numerous options, many compression performances better than H.263++ can be obtained;Strengthen to variousThe adaptability of channel, using the structure and grammer of " network friendliness ", is conducive to the processing to error code and packet loss;It is based on systemOpen, application target wider range H.264, to meet different rates, different resolutions and the different need for transmitting occasionAsk.
H.264, S3, is encoded and is preserved to the video file after encryption, forms compression encrypted video file.
In summary, the invention provides a kind of video encryption method, by first being carried out to the I frames in the IPB frames of videoEncryption, due to only the I frames of frame of video being encrypted, reduces the number of frames for needing to encrypt, improves enciphering rate, realizeFrom the synchronism of the real-time encrypted processing in storage device top foradownloaded video side, so that video-encryption and copy efficiency are improved, it is fullThe real-time encrypted transmission of foot video data and the requirement of access;Then the header encryption of video is carried out again, and the head of video is believedBreath data become random sequence, after header information data encryption, have broken original corresponding relation, recipient is not being known keyIn the case of be difficult to differentiate between structural information data and video information data, it is more difficult to know data structure and data it is specific inHold, it is difficult to the video data encoder received is decoded by former data structure, it is impossible to obtain original image, reach the mesh of encryption, for single AES, two kinds of encryption methods combine that cipher round results are good, with good security.