技术领域technical field
本发明涉及一种数据加密技术,具体地说是一种视频数据的加密方法。 The invention relates to a data encryption technology, in particular to an encryption method of video data.
背景技术Background technique
视频信息是多媒体信息的核心,利用网络进行视频会议,视频点播,视频监控,可视电话,视频聊天等等已成为时下视频业务主流,实现通信高效,保密,安全,是使用这些便利业务的前提。视频加密技术为视频业务的通信安全提供保障。一般的视频业务对实时性要求比较高,因此要求加解密速度快,同时又能保证安全性。Video information is the core of multimedia information. Using the network for video conferencing, video on demand, video surveillance, videophone, video chat, etc. has become the mainstream of video services nowadays. To achieve efficient communication, confidentiality, and security is the prerequisite for using these convenient services . Video encryption technology guarantees the communication security of video services. General video services have relatively high requirements for real-time performance, so fast encryption and decryption speeds are required while ensuring security.
发明内容Contents of the invention
本发明的技术任务是针对以上不足之处,提供一种视频数据的加密方法,加密速度快且抗攻击能力强。解决现有视频业务中视频内容安全、视频内容版权保护问题。The technical task of the present invention is to provide a method for encrypting video data, which has fast encryption speed and strong anti-attack ability. Solve the problems of video content security and video content copyright protection in existing video services.
本发明解决其技术问题所采用的技术方案是:The technical solution adopted by the present invention to solve its technical problems is:
一种视频数据的加密方法,视频数据包括多个视频I帧,每一个视频I帧包括n个宏块,每个宏块包括16个块,把I帧分成数个大块,每个大块包括数个宏块,该加密方法包括如下步骤:A kind of encryption method of video data, video data comprises a plurality of video I frames, and each video I frame comprises n macroblocks, and each macroblock comprises 16 blocks, and I frame is divided into several large blocks, each large block Including several macroblocks, the encryption method comprises the following steps:
每个块包括直流系数和交流系数;Each block includes DC and AC coefficients;
由直流系数得到直流差值;Get the DC difference from the DC coefficient;
针对同一个大块中的多个块,提取特定交流系数差值,形成组合向量;For multiple blocks in the same block, extract specific AC coefficient difference to form a combination vector;
产生多个参数;generate multiple parameters;
用多个参数中的部分参数加密多个直流差值和多个特定交流系数差值,得到多个加密直流差值和加密特定交流系数差值;Encrypting a plurality of DC difference values and a plurality of specific AC coefficient difference values by using some parameters in the plurality of parameters to obtain a plurality of encrypted DC difference values and encrypted specific AC coefficient difference values;
用所述多个参数中的一个生成排列位置;generating a permutation position using one of the plurality of parameters;
根据所述排列位置将所述组合向量中的所述特定交流系数差值重新排列后回置于所述块内;rearranging the specific AC coefficient difference in the combination vector according to the arrangement position and putting it back into the block;
将所述部分参数连接成参数向量;concatenating the partial parameters into a parameter vector;
根据一公开密钥加密所述参数向量得到位元序列;Encrypting the parameter vector according to a public key to obtain a bit sequence;
用所述位元序列将所有位元隐藏在大块中,尤其隐藏在不包括存放所述加密特定交流系数的其它交流系数位置中。All bits are concealed in large blocks with said sequence of bits, especially in other AC coefficient locations not including where said encryption-specific AC coefficients are stored.
根据影像数据帧种类一般的视频数据帧可以划分为I帧、P帧和B帧。P帧利用最接近的I帧或P帧预测其移动向量,而B帧则同时利用前后接近的影像数据帧作为预测的参考。为了提高视频的加解密的速率,只对I帧加密,P帧和B帧要参考I帧才能解码,所以简接的实现了加密功能。According to the type of image data frame, general video data frames can be divided into I frame, P frame and B frame. The P frame uses the closest I frame or P frame to predict its motion vector, while the B frame uses the previous and previous image data frames as the reference for prediction. In order to improve the rate of video encryption and decryption, only I frame is encrypted, and P frame and B frame can only be decoded by referring to I frame, so the encryption function is implemented simply.
以第一个宏块的交流系数为基数,取后续的宏块的交流系数与第一宏块的交流系数的差值。减少加密数据量,利于视频数据的传输。Taking the AC coefficient of the first macroblock as the base, the difference between the AC coefficient of the subsequent macroblock and the AC coefficient of the first macroblock is taken. Reduce the amount of encrypted data, which is conducive to the transmission of video data.
本发明的一种视频数据的加密方法和现有技术相比,具有以下有益效果:Compared with the prior art, an encryption method of video data of the present invention has the following beneficial effects:
采用关键帧加密技术,提高了加密速度,而又不影响加密性能;Key frame encryption technology is adopted to increase the encryption speed without affecting the encryption performance;
采用交流系数差值加密技术,使得加密的数据量减小,占用的视频码流降低;Using AC coefficient difference encryption technology, the amount of encrypted data is reduced, and the occupied video stream is reduced;
本专利通过交流系数差值向量,关键帧加密技术,提高了视频的加密解密速度,不影响视频业务的实时性。This patent improves the speed of video encryption and decryption through the exchange coefficient difference vector and key frame encryption technology, without affecting the real-time performance of video services.
具体实施方式detailed description
下面结合具体实施例对本发明作进一步说明。 The present invention will be further described below in conjunction with specific examples.
本发明的一种视频数据的加密方法,其结构包括A kind of encryption method of video data of the present invention, its structure comprises
一种视频数据的加密方法,视频数据包括多个视频I帧,每一个视频I帧包括n个宏块,每个宏块包括16个块,把I帧分成数个大块,每个大块包括数个宏块,该加密方法包括如下步骤:A kind of encryption method of video data, video data comprises a plurality of video I frames, and each video I frame comprises n macroblocks, and each macroblock comprises 16 blocks, and I frame is divided into several large blocks, each large block Including several macroblocks, the encryption method comprises the following steps:
每个块包括直流系数和交流系数;Each block includes DC and AC coefficients;
由直流系数得到直流差值;Get the DC difference from the DC coefficient;
针对同一个大块中的多个块,提取特定交流系数差值,形成组合向量;For multiple blocks in the same block, extract specific AC coefficient difference to form a combination vector;
产生多个参数;generate multiple parameters;
用多个参数中的部分参数加密多个直流差值和多个特定交流系数差值,得到多个加密直流差值和加密特定交流系数差值;Encrypting a plurality of DC difference values and a plurality of specific AC coefficient difference values by using some parameters in the plurality of parameters to obtain a plurality of encrypted DC difference values and encrypted specific AC coefficient difference values;
用所述多个参数中的一个生成排列位置;generating a permutation position using one of the plurality of parameters;
根据所述排列位置将所述组合向量中的所述特定交流系数差值重新排列后回置于所述块内;rearranging the specific AC coefficient difference in the combination vector according to the arrangement position and putting it back into the block;
将所述部分参数连接成参数向量;concatenating the partial parameters into a parameter vector;
根据一公开密钥加密所述参数向量得到位元序列;Encrypting the parameter vector according to a public key to obtain a bit sequence;
用所述位元序列将所有位元隐藏在大块中,尤其隐藏在不包括存放所述加密特定交流系数的其它交流系数位置中。All bits are concealed in large blocks with said sequence of bits, especially in other AC coefficient locations not including where said encryption-specific AC coefficients are stored.
视频数据压缩为了达到高压缩效率,一般比较注重去除影像数据帧的时间多余度。而根据影像数据帧种类一般的视频数据帧可以划分为I帧、P帧和B帧。P帧利用最接近的I帧或P帧预测其移动向量,而B帧则同时利用前后接近的影像数据帧作为预测的参考。为了提高视频的加解密的速率,只对I帧加密,P帧和B帧要参考I帧才能解码,所以简接的实现了加密功能。In order to achieve high compression efficiency, video data compression generally pays more attention to removing the time redundancy of image data frames. According to the types of image data frames, general video data frames can be divided into I frames, P frames and B frames. The P frame uses the closest I frame or P frame to predict its motion vector, while the B frame uses the previous and previous image data frames as the reference for prediction. In order to improve the rate of video encryption and decryption, only I frame is encrypted, and P frame and B frame can only be decoded by referring to I frame, so the encryption function is implemented simply.
首先将I帧进行余弦转换,从而将4×4的像素数转换成4×4个直流系数或交流系数。经过余弦转换后,对直流系数进行差值脉冲编码调节的差值化步骤。例如以第一直流系数为基数,取后续直流系数与第一直流系数之间的直流差值。也可以其它直流系数为基数,取其它直流系数与该基数的直流差值。以第一个宏块的交流系数为基数,取后续的宏块的交流系数与第一宏块的交流系数的差值。在差值化同时,可以对交流系数进行量化步骤。First, the I frame is subjected to cosine transformation, thereby converting the 4×4 pixel number into 4×4 DC coefficients or AC coefficients. After the cosine transformation, the differential pulse code adjustment step is performed on the DC coefficient. For example, taking the first DC coefficient as a base, the DC difference between the subsequent DC coefficient and the first DC coefficient is taken. It is also possible to use other DC coefficients as the base, and take the DC difference between the other DC coefficients and the base. Taking the AC coefficient of the first macroblock as the base, the difference between the AC coefficient of the subsequent macroblock and the AC coefficient of the first macroblock is taken. Simultaneously with the differencing, a quantization step may be performed on the AC coefficients.
在视频数据经转换、差值化和量化模块处理后,得到了多个直流差值和特定的交流系数。同时,参数生成器生成了多个参数,例如wp、wm、ws、m、r和a。加密单元、保密密钥加密模块和保密密钥隐藏模块可以利用上述参数对直流差值和特定交流系数进行加密,包括:根据参数产生两个二值化随机序列;和根据两个二值化随即序列将直流差值和特定交流系数加密,成为加密直流系数和加密交流系数。 参数wp用于产生二值化随机序列Ppn={pi},其产生的数值为加1或减1。交流系数加密单元将上述特定交流系数ACi乘以二值化随机序列pi,得到加密后的交流系数ACi′=ACi*pi。同时,参数ws用于产生二值化随机序列Spn={si},直流系数加密单元利用该二值化随机序列将每个直流差值ΔDCi进行处理:ΔDCi′=ΔDCi+a*(r*si-1)。由于本项目的加密方法仅对直流差值和交流系数差值进行加密,因此比现有技术中视频数据的加密方法得到的数据小,可以提高加解密的速度。After the video data is processed by the conversion, difference and quantization modules, multiple DC difference values and specific AC coefficients are obtained. Meanwhile, the parameter generator generates multiple parameters, such as wp, wm, ws, m, r, and a. The encryption unit, the secret key encryption module and the secret key hiding module can use the above parameters to encrypt the DC difference and the specific AC coefficient, including: generating two binary random sequences according to the parameters; The sequence encrypts the DC difference and the specific AC coefficients into encrypted DC coefficients and encrypted AC coefficients. The parameter wp is used to generate a binarized random sequence Ppn={pi}, and the value generated by it is plus 1 or minus 1. The AC coefficient encryption unit multiplies the specific AC coefficient ACi by the binary random sequence pi to obtain the encrypted AC coefficient ACi′=ACi*pi. At the same time, the parameter ws is used to generate a binary random sequence Spn={si}, and the DC coefficient encryption unit uses the binary random sequence to process each DC difference ΔDCi: ΔDCi′=ΔDCi+a*(r*si-1 ). Because the encryption method of this project only encrypts the DC difference and the AC coefficient difference, the data obtained by the encryption method of video data in the prior art is smaller, and the speed of encryption and decryption can be improved.
通过上面具体实施方式,所述技术领域的技术人员可容易的实现本发明。但是应当理解,本发明并不限于上述的具体实施方式。在公开的实施方式的基础上,所述技术领域的技术人员可任意组合不同的技术特征。Through the above specific implementation manners, those skilled in the technical field can easily realize the present invention. However, it should be understood that the present invention is not limited to the specific embodiments described above. On the basis of the disclosed embodiments, those skilled in the art can combine different technical features arbitrarily.
除说明书所述的技术特征外,均为本专业技术人员的已知技术。Except for the technical features described in the instructions, all are known technologies by those skilled in the art.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610397397.1ACN105959708A (en) | 2016-06-07 | 2016-06-07 | Video data encryption method |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610397397.1ACN105959708A (en) | 2016-06-07 | 2016-06-07 | Video data encryption method |
| Publication Number | Publication Date |
|---|---|
| CN105959708Atrue CN105959708A (en) | 2016-09-21 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610397397.1APendingCN105959708A (en) | 2016-06-07 | 2016-06-07 | Video data encryption method |
| Country | Link |
|---|---|
| CN (1) | CN105959708A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110149521A (en)* | 2019-04-09 | 2019-08-20 | 西安万像电子科技有限公司 | Data processing method and system |
| CN110597453A (en)* | 2018-06-13 | 2019-12-20 | 杭州海康威视系统技术有限公司 | Video data storage method and device in cloud storage system |
| CN119603431A (en)* | 2025-01-24 | 2025-03-11 | 杭州宇泛智能科技股份有限公司 | Video surveillance transmission method and device based on dual-channel communication and selective encryption |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110597453A (en)* | 2018-06-13 | 2019-12-20 | 杭州海康威视系统技术有限公司 | Video data storage method and device in cloud storage system |
| US11316925B2 (en) | 2018-06-13 | 2022-04-26 | Hangzhou Hikvision System Technology Co., Ltd. | Video data storage method and device in cloud storage system |
| CN110149521A (en)* | 2019-04-09 | 2019-08-20 | 西安万像电子科技有限公司 | Data processing method and system |
| CN110149521B (en)* | 2019-04-09 | 2022-03-22 | 西安万像电子科技有限公司 | Data processing method and system |
| CN114640855A (en)* | 2019-04-09 | 2022-06-17 | 西安万像电子科技有限公司 | Data processing method and system |
| CN119603431A (en)* | 2025-01-24 | 2025-03-11 | 杭州宇泛智能科技股份有限公司 | Video surveillance transmission method and device based on dual-channel communication and selective encryption |
| Publication | Publication Date | Title |
|---|---|---|
| Liu et al. | Selective encryption of multimedia content in distribution networks: Challenges and new directions | |
| Yang et al. | Data-image-video encryption | |
| CN101163228B (en) | Video data encrypted system and method for network video monitoring | |
| CN101247520B (en) | Video data enciphering/deciphering method | |
| CN100426859C (en) | Selective encryption algorithm aiming at network video | |
| CN102123026A (en) | Chaos and hyperchaos based two-level video streaming media encryption method | |
| US8837598B2 (en) | System and method for securely transmitting video over a network | |
| CN102843558A (en) | H.264/AVC (Advanced Video Coding) compressed domain video encryption/decryption device and encryption/decryption method thereof | |
| CN107172433A (en) | A kind of video encryption method | |
| CN108768606B (en) | Streaming media real-time encryption method and system based on video transmission | |
| CN103856786A (en) | Streaming media video encryption method and device based on H.264 | |
| CN101536514A (en) | Method and device for managing a transmission of keys | |
| CN105959708A (en) | Video data encryption method | |
| CN103607272A (en) | Video encryption method | |
| CN101489123B (en) | A fast protection and deprotection method for digital video content | |
| CN105554344A (en) | Multi-image encryption method based on mixed graphics primitives | |
| CN108322750A (en) | Encrypted domain HEVC video data hidden methods based on residual error coefficient modulation | |
| Rengarajaswamy et al. | SPIRT compression on encrypted images | |
| Obaida | Combining audio samples and image frames for enhancing video security | |
| Wang et al. | Hash key-based video encryption scheme for H. 264/AVC | |
| Hong et al. | The study of selective encryption of motion vector based on the S-Box for the security improvement in the process of video | |
| CN106231318A (en) | A kind of video scrambling method and device based on quantization transform coefficient | |
| CN101064813A (en) | Video encrypting/deciphering device and encrypting/deciphering method | |
| CN102625153A (en) | Video data encryption method | |
| Hole et al. | Robust video encryption and decryption using selective encryption |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| WD01 | Invention patent application deemed withdrawn after publication | Application publication date:20160921 | |
| WD01 | Invention patent application deemed withdrawn after publication |