Video compression and encryption method and device

By using sensitive target detection and flag steganography techniques, the security level is determined based on the number of sensitive targets in an image group. The video is then encrypted with a rate-free inflation key stream, which solves the problems of insufficient efficiency and security in existing video compression encryption technologies, and achieves efficient and secure video data storage and transmission.

CN120897017APending Publication Date: 2025-11-04LIAONING COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511169277.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-20
Publication Date
2025-11-04

AI Technical Summary

Technical Problem

Existing video compression and encryption methods fail to effectively consider the encoding characteristics of the syntax elements to be encrypted, resulting in increased bitrate of the encrypted video data stream. Furthermore, the semantic features of different image groups are not fully utilized, reducing the efficiency and security of video compression and encryption.

Method used

By using sensitive target detection and flag steganography techniques, the security level is determined based on the number of sensitive targets in the image group. The encryption key stream is used to encrypt multiple syntax elements without bitrate inflation, which improves the efficiency and security of video compression encryption.

Benefits of technology

It improves the efficiency and security of video compression and encryption while maintaining the same video bitrate, which is beneficial for the storage and transmission of video data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120897017A_ABST
    Figure CN120897017A_ABST
Patent Text Reader

Abstract

The invention provides a video compression and encryption method and device, and the method comprises the steps: recognizing a sensitive target in each image group in a to-be-compressed video through a target detection model, determining the number of corresponding sensitive targets, and carrying out the compression and encryption of the to-be-compressed video in a process of carrying out the compression and coding of the to-be-compressed video, embedding flag bits corresponding to the number of the sensitive targets into each image group in a steganography manner, and determining a security level corresponding to each image group based on the number of the sensitive targets corresponding to each image group; according to the security level, performing syntax element encryption on the image group in the entropy coding process by using an encryption key stream generated by the input key information to obtain a corresponding ciphertext syntax element, and writing the ciphertext syntax element into an output code stream corresponding to the video to be compressed; and obtaining a target compressed video based on the output code stream. According to the method, the efficiency and safety of video compression and encryption are improved, and the effect that the video code rate is kept unchanged after the video is compressed and encrypted is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of video compression encryption, in particular to a video compression encryption method and device. BACKGROUND

[0002] In the early method of compressing and encrypting video, the video data is regarded as ordinary binary code stream and is completely encrypted, which increases the computational complexity. The current video compression encryption method selects important syntax elements for selective encryption, and does not design a corresponding encryption method for the coding characteristics of the encrypted syntax elements, so that the encrypted video data stream has the problem of code rate expansion compared with the original video data stream.

[0003] In addition, the existing video compression encryption method only encrypts different syntax elements to ensure format compatibility and security strength, and all different groups of pictures (Group of Pictures, GOP) in the plaintext video to be encrypted use the same syntax element encryption combination, without considering that they may have different semantic characteristics, which reduces the efficiency and security of video compression encryption. SUMMARY

[0004] Therefore, the purpose of the present application is to provide a video compression encryption method and device, which uses video encryption, sensitive target detection and flag steganography technology to make the video compression encryption process have content perception ability, determines the security level of each group of pictures in the video to be compressed according to the number of sensitive targets in the group of pictures, and then determines the encryption mode corresponding to the group of pictures, so as to use the encryption key stream to encrypt multiple syntax elements without code rate expansion, improve the efficiency and security of video compression encryption, and realize the effect of keeping the video code rate unchanged after video compression encryption, which is beneficial to the storage and transmission of video data.

[0005] The present application provides a video compression encryption method, which comprises: For multiple groups of pictures in the input video to be compressed, a preset target detection model is used to identify sensitive targets in each group of pictures, determine the number of sensitive targets corresponding to each group of pictures, and in response to the number of sensitive targets being determined, start compression encoding of the video to be compressed; In the process of compression encoding, the flag steganography corresponding to the number of sensitive targets is embedded into each group of pictures, and the security level corresponding to each group of pictures is determined based on the number of sensitive targets corresponding to each group of pictures; According to the security level, the syntax elements of the entropy coding process of the image group are encrypted by using the encryption key stream generated by the input key information, to obtain the ciphertext syntax elements corresponding to each image group, and the ciphertext syntax elements are written into the output code stream corresponding to the to-be-compressed video. Based on the output code stream including the flag bit and the ciphertext syntax elements, a target compressed video generated by compressively encoding the to-be-compressed video is obtained.

[0006] Further, the sensitive target in each image group is identified by using a preset target detection model, and the number of sensitive targets corresponding to each image group is determined, including: extracting a first video frame and a second video frame in each image group; Based on a preset sensitive target, the sensitive target in the first video frame and the second video frame is identified by using a preset target detection model, to obtain a sensitive target identification result corresponding to each image group; Based on the sensitive target identification result, the number of sensitive targets corresponding to each image group is determined.

[0007] Further, the flag bit corresponding to the number of sensitive targets is steganographically embedded into each image group, including: For each image group, the number of sensitive targets corresponding to the image group is compared with a first preset number threshold and a second preset number threshold, respectively, to obtain a comparison result; wherein the first preset number threshold is greater than the second preset number threshold; Based on the comparison result, the flag bit information corresponding to each image group is determined; Based on the flag bit information, the flag bit corresponding to each image group is generated, and the flag bit corresponding to each image group is embedded into the sideband compensation syntax elements included in each image group.

[0008] Further, the security level corresponding to each image group is determined based on the number of sensitive targets corresponding to each image group, including: For each image group, the number of sensitive targets corresponding to the image group is compared with a first preset number threshold and a second preset number threshold, respectively, to obtain a comparison result; wherein the first preset number threshold is greater than the second preset number threshold; When the comparison result is that the number of sensitive targets is greater than the first preset number threshold, the security level corresponding to the image group is determined to be a first security level; when the comparison result is that the sensitive target quantity is less than or equal to the first preset quantity threshold and the sensitive target quantity is greater than the second preset quantity threshold, determining that the security level corresponding to the image group is a second security level; when the comparison result is that the sensitive target quantity is equal to the second preset quantity threshold, determining that the security level corresponding to the image group is a third security level.

[0009] Further, the encryption key stream is generated from the input key information by the following steps: obtaining the key information input by the user, and iterating in the chaotic system with the key information as the initial value in the preset chaotic system, and obtaining the chaotic state value output by the chaotic system when iterating to a preset number of times; generating a key stream element group corresponding to each encryption mode based on the pre-generated Latin square element, the chaotic state value, and the quantization level corresponding to each encryption mode; wherein the encryption mode at least includes quantization syntax element encryption, filter coefficient encryption, and motion information syntax element encryption; Based on the key stream element group, continue to iterate the chaotic system until all the syntax elements to be encrypted in the chaotic system are encrypted, and obtain the encryption key stream corresponding to each encryption mode generated by the chaotic system.

[0010] Further, the syntax element encryption of the entropy encoding process of the image group is encrypted using the encryption key stream generated from the input key information according to the security level, to obtain the ciphertext syntax element corresponding to each image group, including: when the security level of the image group is the first security level, the encryption key stream corresponding to each encryption mode is used to respectively encrypt the quantization syntax element, the filter coefficient, and the motion information syntax element in the image group in the entropy encoding process, to obtain the first ciphertext syntax element corresponding to the image group; wherein the first ciphertext syntax element includes quantization syntax encryption element, filter encryption element, and motion information syntax encryption element; when the security level of the image group is the second security level, the encryption key stream corresponding to each encryption mode is used to respectively encrypt the filter coefficient and the motion information syntax element in the image group in the entropy encoding process, to obtain the second ciphertext syntax element corresponding to the image group; wherein the second ciphertext syntax element includes filter encryption element and motion information syntax encryption element; When the security level of the image group is the third security level, the motion information syntax elements in the image group are encrypted in an entropy encoding process by using the encryption key stream corresponding to each encryption mode respectively, to obtain third ciphertext syntax elements corresponding to the image group; wherein the third ciphertext syntax elements include motion information syntax encryption elements.

[0011] Further, when the encryption mode is quantization syntax element encryption, the quantization syntax elements in the image group are encrypted in an entropy encoding process by using the encryption key stream corresponding to each encryption mode through the following steps: obtaining a plurality of non-zero AC coefficients generated in a binary arithmetic encoding process in the entropy encoding process of the image group, and determining suffix information and sign bit information corresponding to each non-zero AC coefficient, and obtaining quantization parameter prediction error sign bit information corresponding to the image group; obtaining a first encryption key stream corresponding to the suffix information, and encrypting the amplitude in the suffix information by using the first encryption key stream to obtain a first ciphertext value; obtaining a second encryption key stream corresponding to the sign bit information, and encrypting the sign bit information by using a preset flip formula based on the second encryption key stream to obtain a second ciphertext value; obtaining a third encryption key stream corresponding to the quantization parameter prediction error sign bit information, and encrypting the quantization parameter prediction error sign bit information by using the third encryption key stream to obtain a third ciphertext value; determining the first ciphertext value, the second ciphertext value and the third ciphertext value as the quantization syntax encryption elements.

[0012] Further, when the encryption mode is filter coefficient encryption, the filter coefficients in the image group are encrypted in an entropy encoding process by using the encryption key stream corresponding to each encryption mode through the following steps: obtaining a fourth key stream corresponding to the filter coefficients, and obtaining a plurality of boundary compensation values in the filter coefficients in the image group; encrypting each boundary compensation value by using the fourth key stream to obtain a fourth ciphertext value, and determining the fourth ciphertext value as the filter encryption elements.

[0013] Further, when the encryption mode is motion information syntax element encryption, the motion information syntax elements in the image group are encrypted in an entropy encoding process by using the encryption key stream corresponding to each encryption mode through the following steps: obtaining motion vector difference values, merge index values and reference frame index values corresponding to the image group, and determining whether the motion vector difference values belong to a preset value range; If the motion vector difference value belongs to a preset value range, a fifth key stream corresponding to the motion vector difference value is obtained, and the motion vector difference value is encrypted by using the fifth key stream to obtain a fifth ciphertext value; It is judged whether the merging index value is any one of a plurality of first preset values. If the merging index value is any one of a plurality of first preset values, a sixth key stream corresponding to the merging index value is obtained, and the merging index value is encrypted by using the sixth key stream to obtain a sixth ciphertext value. It is judged whether the reference frame index value is any one of a plurality of second preset values. If the reference frame index value is any one of a plurality of second preset values, a seventh key stream corresponding to the reference frame index value is obtained, and the reference frame index value is encrypted by using the seventh key stream to obtain a seventh ciphertext value. The fifth ciphertext value, the sixth ciphertext value and the seventh ciphertext value are determined as the motion information syntax encryption elements.

[0014] Embodiments of the present application also provide a video compression encryption device, the compression encryption device comprising: A sensitive target detection module is configured to identify sensitive targets in each image group in an input video to be compressed by using a preset target detection model, determine the number of sensitive targets corresponding to each image group, and start compression encoding of the video to be compressed in response to the number of sensitive targets being determined. A sensitive target processing module is configured to steganographically embed a flag bit corresponding to the number of sensitive targets into each image group during the compression encoding, and determine a security level corresponding to each image group based on the number of sensitive targets corresponding to each image group. A syntax element encryption module is configured to encrypt syntax elements of an entropy encoding process of the image group by using an encryption key stream generated by input key information according to the security level, obtain ciphertext syntax elements corresponding to each image group, and write the ciphertext syntax elements into an output code stream corresponding to the video to be compressed. A video compression encoding module is configured to obtain a target compression video generated by compression encoding of the video to be compressed based on the output code stream including the flag bit and the ciphertext syntax elements.

[0015] The embodiment of the present application also provides an electronic device, comprising a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, and the machine readable instructions are executed by the processor to perform the steps of the video compression encryption method.

[0016] The embodiment of the present application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to perform the steps of the video compression encryption method.

[0017] The video compression encryption method and device provided by the embodiment of the present application, the compression encryption method comprises: for a plurality of image groups in an input compressed video, using a preset target detection model to identify sensitive targets in each image group, determining the number of sensitive targets corresponding to each image group, and in response to the number of sensitive targets being determined, starting to compress and encode the compressed video; in the process of compression and encoding, the number of sensitive targets corresponding to the flag bit is steganographically embedded in each image group, and the security level corresponding to each image group is determined based on the number of sensitive targets corresponding to each image group; according to the security level, the encryption key stream generated by the input key information is used to encrypt the syntax elements in the entropy encoding process of the image group, to obtain the ciphertext syntax elements corresponding to each image group, and the ciphertext syntax elements are written into the output code stream corresponding to the compressed video; based on the output code stream including the flag bit and the ciphertext syntax element, a target compressed video generated by compressing and encoding the compressed video is obtained.

[0018] Compared with the prior art of regarding video data as ordinary binary code stream and completely encrypting it, and selectively encrypting important syntax elements, by using video encryption, sensitive target detection and flag steganography, the process of compressing and encrypting the video has content perception ability, the security level of the image group is determined according to the number of sensitive targets in each image group in the compressed video, and then the encryption mode corresponding to the image group is determined, so that the encryption key stream is used to encrypt the syntax elements without code rate expansion, the efficiency and security of video compression encryption are improved, and the effect of keeping the video code rate unchanged after compressing and encrypting the video is realized, which is beneficial to the storage and transmission of video data.

[0019] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the following preferred embodiments are described in detail below, and the accompanying drawings are described as follows. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor.

[0021] Figure 1 A flow chart of a video compression encryption method provided by an embodiment of the present application; Figure 2 A structural schematic diagram of a video compression encryption device provided by an embodiment of the present application; Figure 3 A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all. The components of the embodiments of the present application described and shown in the drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, every other embodiment obtained by those skilled in the art without creative labor belongs to the scope of the present application.

[0023] It is found through research that, in actual application process, for example, road monitoring video data is crucial for real-time road condition monitoring, traffic accident analysis, traffic violation behavior evidence collection, etc. With the mature application of H.265 digital video coding technology, the H.265 video code stream of road monitoring can more efficiently adapt to different network bandwidth conditions, realize clearer and smoother video transmission and storage. However, the road monitoring video data covers a large amount of sensitive information, such as vehicle driving track, driver facial features and license plate number, etc. Due to the openness and complexity of network environment, these video data are extremely vulnerable to attacks in the process of transmission and storage.

[0024] In view of the above video security problem, in the early method of compressing and encrypting video, the video data is regarded as ordinary binary code stream and is completely encrypted, which increases the calculation complexity. The current video compression encryption method selects important syntax elements for selective encryption, and does not design a corresponding encryption method for the coding characteristics of the syntax elements to be encrypted, so that the encrypted video data stream has the problem of code rate expansion compared with the original video data stream.

[0025] For example, there may be no vehicle passing through the road in the non-busy road section at some time, and there is no need to encrypt a large number of syntax elements in the road monitoring video content at this time period, and only a small number of syntax elements are encrypted to provide a basic security protection strength, thereby reducing unnecessary encryption time overhead and code rate overhead.

[0026] In addition, the existing video compression encryption method only encrypts different syntax elements to ensure format compatibility and security strength, and all different groups of pictures (GOP) in the plaintext video to be encrypted use the same syntax element encryption combination, without considering that they may have different semantic characteristics, which reduces the efficiency and security of video compression encryption.

[0027] Based on this, the embodiment of the application provides a video compression encryption method, which has content perception capability by using video encryption, sensitive target detection and flag steganography technology, determines the security level of each group of pictures in the video to be compressed according to the number of sensitive targets in the group of pictures, and then determines the encryption mode corresponding to the group of pictures, so as to use the encryption key stream to encrypt the multiple syntax elements without code rate expansion, thereby improving the efficiency and security of video compression encryption, achieving the effect of keeping the video code rate unchanged after compression and encryption of the video, and being beneficial to storage and transmission of video data.

[0028] Please refer to Figure 1 , Figure 1 The embodiment of the application provides a flowchart of a video compression encryption method. As shown in Figure 1 The video compression encryption method provided by the embodiment of the application comprises the following steps. S101, for a plurality of groups of pictures in an input video to be compressed, a preset target detection model is used to identify sensitive targets in each group of pictures, to determine the number of sensitive targets corresponding to each group of pictures, and in response to the number of sensitive targets being determined, to start compression encoding of the video to be compressed.

[0029] In the embodiment of the application, the process of compression encoding of the input video to be compressed includes a process of compression encoding conversion of the plaintext video of the YUV format video sequence into the ciphertext video of the H.265 encoding format.

[0030] YUV video is a widely used color encoding system that separates video signals into two parts: luminance (Luma) and chrominance (Chroma). Y represents luminance (Luma), U represents blue-difference chroma (Blue-difference Chroma), and V represents red-difference chroma (Red-difference Chroma).

[0031] H.265 (High Efficiency Video Coding, HEVC) is a high-efficiency video coding method, that is, a video compression standard. The main goal of H.265 is to reduce the bit rate of video data while maintaining the same subjective video quality, or to provide significantly higher video quality at the same bit rate.

[0032] Here, the to-be-compressed video includes multiple image groups. Group of Pictures (GOP) is a very important concept in video encoding, referring to the collection of all video image frames between two consecutive key frames (e.g., I frames, Intra-coded frames) in the video compression process.

[0033] In an embodiment of the present application, the preset target detection model can include a YOLOv8 model.

[0034] In an implementation manner of the present application, in the step S101, the step of determining the number of sensitive targets corresponding to each image group can include: S1011, extracting a first video frame and a second video frame in each image group.

[0035] In an embodiment of the present application, the first video frame can include the first video frame in each image group, and the second video frame can include the nf / 2th video frame in each image group; where nf represents the number of video frames in each image group.

[0036] S1012, based on the preset sensitive target, using the preset target detection model to identify the sensitive target in the first video frame and the second video frame respectively, to obtain the sensitive target identification result corresponding to each image group.

[0037] In this step, the sensitive targets in the preset video to be compressed are determined, all sensitive targets in the first video frame are identified by using the preset target detection model, and all sensitive targets in the second video frame are identified by using the preset target detection model, to obtain a first sensitive target identification result of the first video frame and a second sensitive target identification result of the second video frame, so as to determine the first sensitive target identification result and the second sensitive target identification result as the sensitive target identification result corresponding to each image group.

[0038] In this step, the sensitive target identification result corresponding to each image group is determined.

[0039] In this step, the number of sensitive targets in the first video frame and the number of sensitive targets in the second video frame are determined in the sensitive target identification result corresponding to each image group, to determine the number of sensitive targets in each image group.

[0040] In this step, the sensitive target identification result corresponding to each image group is determined.

[0041] In an embodiment of the present application, in specific implementation, the step of steganographically embedding the flag bit corresponding to the number of sensitive targets into each image group in step S102 can include: S1021, for each image group, the number of sensitive targets corresponding to the image group is compared with a first preset number threshold and a second preset number threshold respectively, to obtain a comparison result.

[0042] Wherein, the first preset number threshold is greater than the second preset number threshold, the first preset number threshold can be calibrated according to the actual content of the video to be compressed and the specific encryption requirement, and the second preset number threshold is generally set to 0.

[0043] In the embodiment of the present application, when the first preset number threshold is set to NT and the second preset number threshold is generally set to 0, it is first determined whether the number of sensitive targets corresponding to each image group is greater than NT, then it is determined whether the number of sensitive targets corresponding to each image group is less than or equal to NT and greater than 0, and finally it is determined whether the number of sensitive targets corresponding to each image group is equal to 0.

[0044] S1022, based on the comparison result, determine the flag bit information corresponding to each image group.

[0045] In the embodiments of the present application, for each image group, when the number of sensitive targets of the image group is greater than the first preset number threshold, the flag bit information corresponding to the image group is determined as binary number 10; when the number of sensitive targets of the image group is less than or equal to the first preset number threshold and greater than the second preset number threshold, the flag bit information corresponding to the image group is determined as binary number 01; and when the number of sensitive targets of the image group is equal to the second preset number threshold, the flag bit information corresponding to the image group is determined as binary number 00.

[0046] For example, the flag bit information corresponding to a plurality of image groups in a video to be compressed can be represented as: {FG1, FG2, FG3,..., FGn}, where n represents the number of image groups. Generally, FG1 can be directly set as binary number 10 for decryption. ng

[0047] In step S1023, the flag bit corresponding to each image group is generated based on the flag bit information, and the flag bit corresponding to each image group is embedded into the sideband compensation syntax element included in each image group.

[0048] Here, since the change of the sideband compensation value in the filter coefficient has little effect on the video quality, the flag bit information of each image group is efficiently embedded into the sideband compensation syntax element.

[0049] In this step, the flag bit information of each image group is embedded into the sideband compensation value of the first sideband compensation syntax element in the previous image group of the image group by using a preset embedding formula.

[0050] In the embodiments of the present application, the expression of the embedding formula is as follows.

[0051] .

[0052] wherein, FGn represents the flag bit information corresponding to the nth image group; FGn-1 represents the sideband compensation value embedded with the flag bit information; FGn-2 represents the sideband compensation value not embedded with the flag bit information.

[0053] In one implementation manner of the present application, in the specific implementation, the step of determining the security level corresponding to each image group based on the number of sensitive targets corresponding to each image group in step S102 can include: S1024, for each image group, the number of sensitive targets corresponding to the image group is compared with the first preset number threshold and the second preset number threshold respectively, and a comparison result is obtained. ​​

[0054] wherein the first preset quantity threshold is greater than the second preset quantity threshold.

[0055] Here, the description of S1024 can refer to the description of S1021, and the same technical effects can be achieved, and thus will not be described here.

[0056] S1025, when the comparison result is that the sensitive target quantity is greater than the first preset quantity threshold, determining that the security level corresponding to the image group is a first security level.

[0057] In the embodiments of the present application, the first security level can include a high security level, and encryption of multiple syntax elements is required in the entropy encoding process.

[0058] S1026, when the comparison result is that the sensitive target quantity is less than or equal to the first preset quantity threshold and greater than the second preset quantity threshold, determining that the security level corresponding to the image group is a second security level.

[0059] In the embodiments of the present application, the second security level can include a medium security level.

[0060] S1027, when the comparison result is that the sensitive target quantity is equal to the second preset quantity threshold, determining that the security level corresponding to the image group is a third security level.

[0061] In the embodiments of the present application, the third security level can include a low security level, and encryption of one syntax element is required in the entropy encoding process.

[0062] In this way, multiple syntax elements in the image group containing a large number of sensitive targets are encrypted without rate expansion to ensure high security strength, and only individual types of syntax elements in the image group containing a small number of sensitive targets are encrypted to reduce encryption time overhead.

[0063] S103, according to the security level, encrypting syntax elements in the entropy encoding process of the image group using the encryption key stream generated by the input key information, obtaining the ciphertext syntax elements corresponding to each image group, and writing the ciphertext syntax elements into the output bitstream corresponding to the to-be-compressed video.

[0064] Here, the user input key information is used to drive the preset chaotic system, and the Latin square elements generated in advance are used to multiplex the chaotic state values output by the chaotic system, so as to quickly generate the encryption key stream.

[0065] Further, in the entropy encoding process of the image group, according to the security level corresponding to each image group, the generated encryption key stream is used to encrypt the syntax elements of the image group.

[0066] In an implementation of the present application, the step of generating the encryption key stream from the input key information in step S103 can include the following steps: S1031, obtaining the key information input by the user, and iterating in the preset chaotic system with the key information as the initial value in the chaotic system, and obtaining the chaotic state value output by the chaotic system when iterating to a preset number of times.

[0067] In the embodiment of the present application, the key information input by the user is two double-precision floating-point numbers, for example, the key information input by the user is (x0, y0) = (0.154256987451286, 0.254196547892105). subkey_x , subkey_y ), subkey_x The value of x0 can be 0.154256987451286. subkey_y The value of y0 can be 0.254196547892105.

[0068] Further, the key information is taken as the initial value in the preset chaotic system, that is, (x0, y0) is taken as the initial value (x0, y0) in the chaotic system, and the chaotic system is iterated based on the initial value to obtain the chaotic state value output by the chaotic system when iterating to a preset number of times. subkey_x , subkey_y ) as the initial value (x0, y0) in the chaotic system, and the chaotic system is iterated based on the initial value to obtain the chaotic state value output by the chaotic system when iterating to a preset number of times. x 0, y 0).

[0069] Here, the preset number of times is at least 200.

[0070] In the embodiment of the present application, the expression of the chaotic system outputting the chaotic state value is as follows.

[0071] .

[0072] wherein, and represent the chaotic state value output by the chaotic system; and represent the state variables of the chaotic system; and represent the preset control parameters, wherein, is generally set to 1.4, is generally set to 0.3.

[0073] S1032, generating a group of key stream elements corresponding to each encryption mode based on the previously generated Latin square elements, the chaotic state value, and the quantization level corresponding to each encryption mode.

[0074] The encryption mode includes at least quantization syntax element encryption, filter coefficient encryption, and motion information syntax element encryption.

[0075] In the embodiments of the present application, the Latin square elements are generated by using the cyclic shift method, wherein the Latin square elements include a Latin square with a size of "16x16", and the elements T(i, j) in the Latin square are integers from 1 to 16, wherein 1≤i≤16 and 1≤j≤16.

[0076] Further, the corresponding chaotic state values are generated by continuing to iterate the chaotic system for n times, and the expression for quantizing the chaotic state values is as follows.

[0077] .

[0078] wherein, and represent the corresponding chaotic state values generated by iterating the chaotic system for n times; n represents the iteration times; and represent the values in the pre-generated Latin square elements; and represent the quantized arrays corresponding to the chaotic state values. In the embodiments of the present application, the formula for generating the key stream element group corresponding to each encryption mode is as follows.

[0079]

[0080] .

[0081] wherein, the key stream element group; n represents the iteration times; the pre-generated Latin square elements; the function is used to take the remainder of p divided by q, the function is used to cyclically right shift p by q bits, and the function is used to cyclically left shift p by q bits, is the quantization level corresponding to each encryption mode.

[0082] For example, the generated Latin square is used as a lookup table, 2n values in the array obtained by quantizing the chaotic state values are multiplexed, and n 2 key stream elements are generated.

[0083] S1033, based on the key stream element group, the chaotic system is continued to iterate until all the syntax elements to be encrypted in the chaotic system are encrypted, and the encryption key stream corresponding to each encryption mode generated by the chaotic system is obtained.

[0084] ​In this step, the iteration of the chaotic system continues until all the syntax elements to be encrypted in the chaotic system are encrypted, and all the key stream elements to be encrypted are determined as the encryption key stream corresponding to each encryption mode generated by the chaotic system.

[0085] In an implementation manner of the present application, in specific implementation, the step of encrypting the syntax elements in the entropy coding process of the image group according to the security level by using the encryption key stream generated by the input key information to obtain the ciphertext syntax elements corresponding to each image group in step S103 can include: S1034, when the security level of the image group is the first security level, the quantized syntax elements, the filter coefficients and the motion information syntax elements in the image group are respectively encrypted by using the encryption key stream corresponding to each encryption mode in the entropy coding process to obtain the first ciphertext syntax elements corresponding to the image group.

[0086] The first ciphertext syntax elements include the quantized syntax encrypted elements, the filter encrypted elements and the motion information syntax encrypted elements.

[0087] Here, in the video coding standards (such as H.264 / AVC, H.265 / HEVC, H.266 / VVC, etc.), the syntax elements of the video (Video Syntax Elements) are the basic syntax units constituting the coded bitstream (Bitstream), and are the structured data output by the encoder and input by the decoder, which contains all the information required for reconstructing the video picture.

[0088] In the embodiments of the present application, when the security level of the image group is the first security level, it indicates that the security level of the image group is high, i.e., the encryption of the quantized syntax elements, the filter coefficients and the motion information syntax elements of the image group in the entropy coding process is performed, and the quantized syntax encrypted elements obtained by encrypting the quantized syntax elements, the filter encrypted elements obtained by encrypting the filter coefficients and the motion information syntax encrypted elements obtained by encrypting the motion information syntax elements are determined.

[0089] S1035, when the security level of the image group is the second security level, the filter coefficients and the motion information syntax elements in the image group are respectively encrypted by using the encryption key stream corresponding to each encryption mode in the entropy coding process to obtain the second ciphertext syntax elements corresponding to the image group.

[0090] The second ciphertext syntax elements include the filter encrypted elements and the motion information syntax encrypted elements.

[0091] In the embodiment of the present application, when the security level of the image group is the second security level, it indicates that the security level of the image group is medium, i.e. the filter coefficient and motion information syntax element of the image group are encrypted in the entropy coding process, and the filter encryption element obtained by encrypting the filter coefficient and the motion information syntax encryption element obtained by encrypting the motion information syntax element are determined.

[0092] S1036, when the security level of the image group is the third security level, the motion information syntax element in the image group is encrypted in the entropy coding process by using the encryption key stream corresponding to each encryption mode, to obtain the third ciphertext syntax element corresponding to the image group.

[0093] The third ciphertext syntax element includes the motion information syntax encryption element.

[0094] In the embodiment of the present application, when the security level of the image group is the third security level, it indicates that the security level of the image group is low, i.e. the motion information syntax element of the image group is encrypted in the entropy coding process, and the motion information syntax encryption element obtained by encrypting the motion information syntax element is determined.

[0095] In an implementable manner of the present application, in the specific implementation, when the encryption mode is quantization syntax element encryption, the quantization syntax element encryption is performed in the entropy coding process, and the sign bit, amplitude and quantization parameter prediction error of the non-zero AC coefficient (Alternating Current, AC) are encrypted by using the encryption key stream corresponding to each encryption mode.

[0096] Specifically, when the encryption mode is quantization syntax element encryption, the step of encrypting the quantization syntax element in the image group in the entropy coding process by using the encryption key stream corresponding to each encryption mode in step S103 can include: S103A1, obtaining a plurality of non-zero AC coefficients generated in the binary arithmetic coding process in the entropy coding process of the image group, determining the suffix information and sign bit information corresponding to each non-zero AC coefficient, and obtaining the quantization parameter prediction error sign bit information corresponding to the image group.

[0097] Here, after the DCT transformation of converting the image from the spatial domain (arrangement of pixel values) to the frequency domain, the values of many AC coefficients are very small, close to zero, especially the coefficients representing high frequency (for example, fine texture, noise, sharp edge), and quantization is a key step of compression, which rounds these small AC coefficients to zero to achieve a large amount of data compression, and the non-zero AC coefficient is the AC coefficient whose value is still not zero after quantization.

[0098] The suffix information corresponding to the non-zero AC coefficient at least includes a suffix length of a binary string corresponding to the amplitude of the non-zero AC coefficient, and an amplitude suffix of the non-zero AC coefficient; and the sign bit information corresponding to the non-zero AC coefficient at least includes a sign bit corresponding to the amplitude of the non-zero AC coefficient.

[0099] S103A2, a first encryption key stream corresponding to the suffix information is obtained, and the amplitude in the suffix information is encrypted by using the first encryption key stream to obtain a first ciphertext value.

[0100] In the embodiment of the present application, in the first encryption key stream corresponding to the suffix information, the corresponding quantization level is set to 2 ls , wherein, ls represents a suffix length of a binary string corresponding to the amplitude of the non-zero AC coefficient.

[0101] Here, the amplitude in the suffix information is encrypted by using the first encryption key stream according to the following formula.

[0102] .

[0103] , wherein, represents the first encryption key stream; represents the amplitude in the suffix information; represents the first ciphertext value.

[0104] S103A3, a second encryption key stream corresponding to the sign bit information is obtained, and the sign bit information is encrypted by using a preset flip formula based on the second encryption key stream to obtain a second ciphertext value.

[0105] In the embodiment of the present application, in the second encryption key stream corresponding to the sign bit information, the corresponding quantization level is set to 2.

[0106] Here, the expression of the preset flip formula is as follows.

[0107] .

[0108] , wherein, represents the second encryption key stream; represents the sign bit information; represents the second ciphertext value.

[0109] It should be noted that the use condition of the flip formula is that the suffix length value of the second encryption key stream is greater than or equal to 1, and if the suffix length value of the second encryption key stream is equal to 0, the sign bit information is not encrypted.

[0110] S103A4, obtaining a third encryption key stream corresponding to the quantization parameter prediction error sign bit information, and encrypting the quantization parameter prediction error sign bit information by using the third encryption key stream to obtain a third ciphertext value.

[0111] For example, the binary string corresponding to the encoding rule of the quantization parameter prediction error sign bit and amplitude value is shown in the following table.

[0112]

[0113] Here, when encrypting the quantization parameter prediction error sign bit information, it is necessary to determine whether the amplitude value corresponding to the quantization parameter prediction error is 0. If it is 0, no encryption is performed, and if it is not 0, encryption is performed.

[0114] In the embodiments of the present application, in the third encryption key stream corresponding to the quantization parameter prediction error sign bit information, the corresponding quantization level is set to 2.

[0115] Here, the quantization parameter prediction error sign bit information is encrypted by using the third encryption key stream according to the following formula.

[0116]

[0117] wherein, denotes the third encryption key stream; denotes the quantization parameter prediction error sign bit information; denotes the third ciphertext value.

[0118] S103A5, determining the first ciphertext value, the second ciphertext value and the third ciphertext value as the quantization syntax encryption elements.

[0119] In this step, the first ciphertext value, the second ciphertext value and the third ciphertext value are determined as the quantization syntax encryption elements, the quantization syntax encryption elements are respectively written into the output bitstream corresponding to the to-be-compressed video, and the entropy encoding process of the to-be-compressed video is continued.

[0120] In an implementable manner of the present application, when the encryption mode is filter coefficient encryption, in the entropy encoding process of the filter coefficient, the filter coefficient is encrypted by using the encryption key stream corresponding to the filter coefficient encryption mode.

[0121] Specifically, when the encryption mode is filter coefficient encryption, the step of encrypting the quantization syntax elements in the group of images in the entropy encoding process by using the encryption key stream corresponding to each of the encryption modes in step S103 can include: S103B1, obtain a fourth key stream corresponding to the filter coefficient, and obtain a plurality of boundary compensation values in the filter coefficient in the image group.

[0122] In the embodiments of the present application, in the fourth encryption key stream corresponding to the filter coefficient, the corresponding quantization level is set to 4.

[0123] Here, the boundary compensation method (i.e., how to handle the boundary) is essentially part of the filter application strategy, which needs to handle the boundary in the process of filtering the filter, and will generate a plurality of boundary compensation values.

[0124] S103B2, encrypt each of the boundary compensation values using the fourth key stream to obtain a fourth ciphertext value, and determine the fourth ciphertext value as the filter encryption element.

[0125] Here, each boundary compensation value is encrypted using the fourth encryption key stream by the following formula.

[0126]

[0127] wherein, denotes the fourth encryption key stream; denotes the boundary compensation value in the filter coefficient; denotes the fourth ciphertext value.

[0128] In this step, the fourth ciphertext value is determined as the filter encryption element, and the filter encryption element is written into the output bitstream corresponding to the to-be-compressed video, and the entropy encoding process of the to-be-compressed video is continued.

[0129] In an implementable manner of the present application, when the encryption mode is motion information syntax element encryption in specific implementation, in combination with the encoding characteristics of the motion information syntax element in the H.265 encoding rule, the motion information syntax element is encrypted using the encryption key stream corresponding to the motion information syntax element encryption mode in the entropy encoding process of the motion information syntax element.

[0130] Specifically, when the encryption mode is motion information syntax element encryption, the step of encrypting the quantization syntax element in the image group in the entropy encoding process using the encryption key stream corresponding to each of the encryption modes in step S103 can include: S103C1, obtain a fourth key stream corresponding to the filter coefficient, and obtain a plurality of boundary compensation values in the filter coefficient in the image group.

[0131] In the embodiments of the present application, the preset value range is generally set to (-∞, -1) ∪ (1, +∞).

[0132] Here, when the motion vector difference value is 0, 1 or -1, the encoder does not directly entropy encode the motion vector difference value, and thus, in this case, the motion vector difference value is not encrypted, so as to ensure that the ciphertext video code rate is unchanged.

[0133] S103C2, if the motion vector difference value belongs to a preset value range, a fifth key stream corresponding to the motion vector difference value is obtained, and the motion vector difference value is encrypted by using the fifth key stream to obtain a fifth ciphertext value.

[0134] In the embodiment of the present application, in the fifth key stream corresponding to the motion vector difference value, the corresponding quantization level is set to 2 cg , wherein, cg indicates the code word group in which the motion vector difference value is located.

[0135] Here, when each motion vector difference value is encrypted, since in the H.265 encoding rule, the motion vector difference has a horizontal component and a vertical component, and the horizontal component and the vertical component always appear in pairs, therefore, the two components are exchanged in the encryption process to improve the encryption strength.

[0136] Here, the motion vector difference value is encrypted by using the fifth encryption key stream by the following formula.

[0137] .

[0138] , wherein, indicates the fifth encryption key stream; and indicate the horizontal component and the vertical component corresponding to the motion vector difference value, respectively; and indicate the encrypted ciphertext of the horizontal component and the encrypted ciphertext of the vertical component of the motion vector difference value in the fifth ciphertext value.

[0139] S103C3, judging whether the merge index value is any one of a plurality of first preset values.

[0140] In the embodiment of the present application, the first preset values can be set to include 3 and 4.

[0141] Here, in order to ensure that the encryption application of the motion information syntax element does not affect the size of the compressed video, whether the merge index value is any one of a plurality of first preset values is judged.

[0142] Further, if the merge index value is not any one of a plurality of first preset values, the merge index value is not encrypted.

[0143] S103C4, if the merging index value is any one of a plurality of first preset values, a sixth key stream corresponding to the merging index value is acquired, and the merging index value is encrypted by using the sixth key stream to obtain a sixth ciphertext value.

[0144] In the embodiment of the present application, in the sixth key stream corresponding to the merging index value, the corresponding quantization level is set to 2.

[0145] Here, the merging index value is encrypted by using the sixth encryption key stream according to the following formula.

[0146] .

[0147] wherein, denotes the sixth encryption key stream; denotes the merging index value; denotes the sixth ciphertext value.

[0148] S103C5, it is judged whether the reference frame index value is any one of a plurality of second preset values.

[0149] In the embodiment of the present application, the second preset values can be set to include 2 and 3.

[0150] Here, in order to ensure that the encryption application to the motion information syntax element does not affect the size of the compressed video, it is judged whether the reference frame index value is any one of a plurality of second preset values.

[0151] Further, if the reference frame index value is not any one of a plurality of second preset values, the reference frame index value is not encrypted.

[0152] S103C6, if the reference frame index value is any one of a plurality of second preset values, a seventh key stream corresponding to the reference frame index value is acquired, and the reference frame index value is encrypted by using the seventh key stream to obtain a seventh ciphertext value.

[0153] In the embodiment of the present application, in the seventh key stream corresponding to the reference frame index value, the corresponding quantization level is set to 2.

[0154] Here, the reference frame index value is encrypted by using the seventh encryption key stream according to the following formula.

[0155] .

[0156] wherein, denotes the seventh encryption key stream; denotes the reference frame index value; denotes the seventh ciphertext value.

[0157] S103C7, determining the fifth ciphertext value, the sixth ciphertext value and the seventh ciphertext value as the motion information syntax encryption element.

[0158] Here, the fifth ciphertext value is first-order exponential columnbus coded to obtain the syntax encryption element corresponding to the fifth ciphertext value, and the syntax encryption element corresponding to the fifth ciphertext value, the sixth ciphertext value and the seventh ciphertext value are determined as the motion information syntax encryption element, and the motion information syntax encryption element is written into the output bitstream corresponding to the to-be-compressed video, and the entropy encoding process of the to-be-compressed video is continued.

[0159] S104, based on the output bitstream including the flag bit and the ciphertext syntax element, obtaining a target compressed video generated by compressively encoding the to-be-compressed video.

[0160] In this step, after the flag bit is steganographically embedded into each group of images and the ciphertext syntax element is written into the output bitstream corresponding to the to-be-compressed video, the target compressed video obtained by compressively encoding the to-be-compressed video is generated by continuing to compressively encode the to-be-compressed video.

[0161] As an example of testing the encoding time of the to-be-compressed video and the time of compressively encoding and encrypting, the time expansion generated by the encryption operation is calculated. The time expansion experimental results are shown in the following table. It can be seen that the encryption time expansion rate is less than 0.06%, and the time overhead is small. That is, the video compressively encrypting method provided by the embodiment has high time efficiency.

[0162]

[0163] As an example of calculating the code rate expansion of compressively encrypting the to-be-compressed video into the target compressed video, the code rate expansion refers to the video size after the encryption operation in the encoding process minus the video size generated by only the encoding operation. The greater the value calculated by the code rate expansion calculation formula shown below, the greater the influence of the encryption algorithm on the compression efficiency of the video encoding. Conversely, the smaller the influence of the encryption algorithm on the compression efficiency of the video encoding.

[0164] .

[0165] wherein, represents the code rate expansion percentage of compressively encrypting the to-be-compressed video into the target compressed video; represents the number of bytes of the target compressed video; represents the number of bytes of the video file obtained by only encoding the to-be-compressed video.

[0166] Based on the above examples, the video compression encryption method provided by the embodiments of the present application realizes zero-rate expansion video compression encryption by analyzing and encrypting the coding characteristics of various syntax elements, and does not occupy additional bandwidth for data transmission in application.

[0167] The video compression encryption method provided by the embodiments of the present application has content perception capability in the process of compressing and encrypting the video by means of video encryption, sensitive target detection and steganography of flag bits, determines the security level of each image group according to the number of sensitive targets in the image group to be compressed, and further determines the encryption mode corresponding to the image group, so as to encrypt the multiple syntax elements by using the encryption key stream with zero-rate expansion, thereby improving the efficiency and security of video compression encryption, achieving the effect of keeping the video code rate unchanged after the video is compressed and encrypted, and being beneficial to the storage and transmission of video data.

[0168] Please refer to Figure 2 , Figure 2 The structure of a video compression encryption device provided by the embodiments of the present application is shown in FIG. 1. Figure 2 As shown in FIG. 1, the compression encryption device 200 includes: A sensitive target detection module 210 is configured to identify sensitive targets in each image group in the input video to be compressed by using a preset target detection model, determine the number of sensitive targets corresponding to each image group, and start compression encoding of the video to be compressed in response to the number of sensitive targets being determined. A sensitive target processing module 220 is configured to embed a flag bit corresponding to the number of sensitive targets into each image group in the process of compression encoding, and determine the security level corresponding to each image group based on the number of sensitive targets corresponding to each image group. A syntax element encryption module 230 is configured to encrypt syntax elements in an entropy coding process of each image group by using an encryption key stream generated from input key information according to the security level, obtain ciphertext syntax elements corresponding to each image group, and write the ciphertext syntax elements into an output code stream corresponding to the video to be compressed. A video compression encoding module 240 is configured to obtain a target compressed video generated by compression encoding of the video to be compressed based on the output code stream including the flag bit and the ciphertext syntax elements.

[0169] Further, when the sensitive target detection module 210 is configured to identify sensitive targets in each image group by using a preset target detection model and determine the number of sensitive targets corresponding to each image group, the sensitive target detection module 210 is configured to: extract a first video frame and a second video frame in each of the image groups; based on a preset sensitive target, the first video frame and the second video frame are respectively identified by using a preset target detection model to obtain a sensitive target identification result corresponding to each of the image groups; based on the sensitive target identification result, the sensitive target quantity corresponding to each of the image groups is determined.

[0170] Further, when the sensitive target processing module 220 is used to steganographically embed the flag bit corresponding to the sensitive target quantity into each of the image groups, the sensitive target processing module 220 is used to: for each of the image groups, the sensitive target quantity corresponding to the image group is compared with a first preset quantity threshold and a second preset quantity threshold respectively to obtain a comparison result; wherein the first preset quantity threshold is greater than the second preset quantity threshold; based on the comparison result, the flag bit information corresponding to each of the image groups is determined; based on the flag bit information, the flag bit corresponding to each of the image groups is generated, and the flag bit corresponding to each of the image groups is embedded into the sideband compensation syntax element included in each of the image groups.

[0171] Further, when the sensitive target processing module 220 is used to determine the security level corresponding to each of the image groups based on the sensitive target quantity corresponding to each of the image groups, the sensitive target processing module 220 is used to: for each of the image groups, the sensitive target quantity corresponding to the image group is compared with a first preset quantity threshold and a second preset quantity threshold respectively to obtain a comparison result; wherein the first preset quantity threshold is greater than the second preset quantity threshold; when the comparison result is that the sensitive target quantity is greater than the first preset quantity threshold, it is determined that the security level corresponding to the image group is a first security level; when the comparison result is that the sensitive target quantity is less than or equal to the first preset quantity threshold and the sensitive target quantity is greater than the second preset quantity threshold, it is determined that the security level corresponding to the image group is a second security level; when the comparison result is that the sensitive target quantity is equal to the second preset quantity threshold, it is determined that the security level corresponding to the image group is a third security level.

[0172] Further, when the syntax element encryption module 230 is used to generate an encryption key stream from the input key information, the syntax element encryption module 230 is used to: obtaining key information input by a user, and performing iteration in a chaotic system with the key information as an initial value in the chaotic system, and obtaining a chaotic state value output by the chaotic system when the iteration reaches a preset number of times; generating a key stream element group corresponding to each of the encryption modes based on a Latin square element generated in advance, the chaotic state value, and a quantization level corresponding to each of the encryption modes, wherein the encryption modes at least include quantization syntax element encryption, filter coefficient encryption, and motion information syntax element encryption; continuing to iterate the chaotic system based on the key stream element group until all syntax elements to be encrypted in the chaotic system are encrypted, and obtaining an encryption key stream generated by the chaotic system corresponding to each of the encryption modes.

[0173] Further, when the syntax element encryption module 230 is used to encrypt syntax elements in an entropy encoding process of the image group by using the encryption key stream generated from the input key information according to the security level to obtain ciphertext syntax elements corresponding to each of the image groups, the syntax element encryption module 230 is configured to: when the security level of the image group is a first security level, encrypting quantization syntax elements, filter coefficients, and motion information syntax elements in the image group in an entropy encoding process by using the encryption key stream corresponding to each of the encryption modes respectively to obtain first ciphertext syntax elements corresponding to the image group; wherein the first ciphertext syntax elements include quantization syntax encryption elements, filter encryption elements, and motion information syntax encryption elements; when the security level of the image group is a second security level, encrypting filter coefficients and motion information syntax elements in the image group in an entropy encoding process by using the encryption key stream corresponding to each of the encryption modes respectively to obtain second ciphertext syntax elements corresponding to the image group; wherein the second ciphertext syntax elements include filter encryption elements and motion information syntax encryption elements; when the security level of the image group is a third security level, encrypting motion information syntax elements in the image group in an entropy encoding process by using the encryption key stream corresponding to each of the encryption modes respectively to obtain third ciphertext syntax elements corresponding to the image group; wherein the third ciphertext syntax elements include motion information syntax encryption elements.

[0174] Further, when the encryption mode is quantization syntax element encryption, the syntax element encryption module 230 is configured to, when used to encrypt quantization syntax elements in the image group in an entropy encoding process by using the encryption key stream corresponding to each of the encryption modes: obtaining a plurality of non-zero AC coefficients generated in a binary arithmetic coding process in an entropy coding process of the image group, and determining suffix information and sign bit information corresponding to each of the non-zero AC coefficients, and obtaining quantization parameter prediction error sign bit information corresponding to the image group; obtaining a first encryption key stream corresponding to the suffix information, and encrypting the amplitudes in the suffix information by using the first encryption key stream to obtain a first ciphertext value; obtaining a second encryption key stream corresponding to the sign bit information, and encrypting the sign bit information by using a preset flipping formula based on the second encryption key stream to obtain a second ciphertext value; obtaining a third encryption key stream corresponding to the quantization parameter prediction error sign bit information, and encrypting the quantization parameter prediction error sign bit information by using the third encryption key stream to obtain a third ciphertext value; determining the first ciphertext value, the second ciphertext value and the third ciphertext value as the quantization syntax encryption element.

[0175] Further, when the encryption mode is filter coefficient encryption, the syntax element encryption module 230 is configured to, when encrypting filter coefficients in the image group in an entropy coding process by using the encryption key stream corresponding to each of the encryption modes: obtaining a fourth key stream corresponding to the filter coefficients, and obtaining a plurality of boundary compensation values in the filter coefficients in the image group; encrypting each of the boundary compensation values by using the fourth key stream to obtain a fourth ciphertext value, and determining the fourth ciphertext value as the filter encryption element.

[0176] Further, when the encryption mode is motion information syntax element encryption, the syntax element encryption module 230 is configured to, when encrypting motion information syntax elements in the image group in an entropy coding process by using the encryption key stream corresponding to each of the encryption modes: obtaining a motion vector difference value, a merge index value and a reference frame index value corresponding to the image group, and determining whether the motion vector difference value belongs to a preset value range; if the motion vector difference value belongs to the preset value range, obtaining a fifth key stream corresponding to the motion vector difference value, and encrypting the motion vector difference value by using the fifth key stream to obtain a fifth ciphertext value; determining whether the merge index value is any one of a plurality of first preset values; If the merge index value is any one of a plurality of first preset values, a sixth key stream corresponding to the merge index value is obtained, and the merge index value is encrypted by using the sixth key stream to obtain a sixth ciphertext value; It is judged whether the reference frame index value is any one of a plurality of second preset values. If the reference frame index value is any one of a plurality of second preset values, a seventh key stream corresponding to the reference frame index value is obtained, and the reference frame index value is encrypted by using the seventh key stream to obtain a seventh ciphertext value. The fifth ciphertext value, the sixth ciphertext value and the seventh ciphertext value are determined as the motion information syntax encryption elements.

[0177] The video compression encryption device provided by the embodiment of the application has content perception capability in the process of compressing and encrypting the video by using video encryption, sensitive target detection and flag bit steganography, and determines the security level of each image group in the video to be compressed according to the number of sensitive targets in the image group, and then determines the encryption mode corresponding to the image group, so that the encryption key stream is used to encrypt the syntax elements without code rate expansion, thereby improving the efficiency and security of video compression encryption, and achieving the effect of keeping the video code rate unchanged after the video is compressed and encrypted, which is beneficial to the storage and transmission of video data.

[0178] Please refer to Figure 3 , Figure 3 The electronic device 300 includes a processor 310, a memory 320 and a bus 330. Figure 3 The processor 310, the memory 320 and the bus 330 are connected to each other.

[0179] The memory 320 stores machine readable instructions executable by the processor 310. When the electronic device 300 is running, the processor 310 and the memory 320 communicate with each other through the bus 330. The machine readable instructions can be executed by the processor 310 to perform the steps of the video compression encryption method in the method embodiment shown in the above Figure 1 The specific implementation can be referred to the method embodiment, and will not be described here.

[0180] The embodiment of the application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program. When the computer program is run by the processor, the steps of the video compression encryption method in the method embodiment shown in the above Figure 1 The specific implementation can be referred to the method embodiment, and will not be described here.

[0181] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

[0182] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some communication interfaces, devices or units, and can be electrical, mechanical or other forms.

[0183] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0184] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.

[0185] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a nonvolatile computer readable storage medium executable by a processor. Based on this understanding, the technical solutions of the present application or the essential part or part of the technical solutions that make contributions to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and various program code storage media.

[0186] Finally, it should be noted that the above-described embodiments are merely specific embodiments of the present application, which are used to illustrate the technical solutions of the present application, but not to limit the same. The protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those skilled in the art that any skilled person in the art can still modify or easily think of changes to the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some of the technical features, within the technical scope disclosed by the present application. The modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for compressing and encrypting video, characterized in that, The compression and encryption method includes: For multiple image groups in the input video to be compressed, a preset target detection model is used to identify sensitive targets in each image group, determine the number of sensitive targets corresponding to each image group, and in response to the determination of the number of sensitive targets, the compression encoding of the video to be compressed begins. During the compression encoding process, the flag bits corresponding to the number of sensitive targets are steganographically embedded into each of the image groups, and the security level corresponding to each image group is determined based on the number of sensitive targets corresponding to each image group. According to the security level, the syntax elements of the entropy encoding process of the image group are encrypted using the encryption key stream generated by the input key information to obtain the ciphertext syntax elements corresponding to each image group, and the ciphertext syntax elements are written into the output bitstream corresponding to the video to be compressed. Based on the output bitstream including the flag bits and the ciphertext syntax elements, a target compressed video is obtained by compressing and encoding the video to be compressed.

2. The method according to claim 1, characterized in that, The step of identifying sensitive targets in each image group using a preset target detection model and determining the number of sensitive targets corresponding to each image group includes: Extract the first and second video frames from each of the image groups; Based on preset sensitive targets, the preset target detection model is used to identify the sensitive targets in the first video frame and the second video frame respectively, and the sensitive target identification result corresponding to each image group is obtained; Based on the results of the sensitive target identification, the number of sensitive targets corresponding to each image group is determined.

3. The method according to claim 1, characterized in that, The step of steganographically embedding the flag bits corresponding to the number of sensitive targets into each of the image groups includes: For each image group, the number of sensitive targets corresponding to the image group is compared with a first preset number threshold and a second preset number threshold to obtain a comparison result; wherein, the first preset number threshold is greater than the second preset number threshold. Based on the comparison results, the flag bit information corresponding to each image group is determined; Based on the flag information, a flag corresponding to each image group is generated, and the flag corresponding to each image group is embedded into the sideband compensation syntax element included in each image group.

4. The method according to claim 1, characterized in that, The step of determining the security level for each image group based on the number of sensitive targets corresponding to each image group includes: For each image group, the number of sensitive targets corresponding to the image group is compared with a first preset number threshold and a second preset number threshold to obtain a comparison result; wherein, the first preset number threshold is greater than the second preset number threshold. When the comparison result shows that the number of sensitive targets is greater than the first preset number threshold, the security level corresponding to the image group is determined to be the first security level; When the comparison result is that the number of sensitive targets is less than or equal to the first preset number threshold and the number of sensitive targets is greater than the second preset number threshold, the security level corresponding to the image group is determined to be the second security level. When the comparison result shows that the number of sensitive targets is equal to the second preset number threshold, the security level corresponding to the image group is determined to be the third security level.

5. The method according to claim 1, characterized in that, The following steps generate an encryption key stream from the input key information: The system obtains key information input by the user and uses the key information as an initial value in a preset chaotic system to iterate in the chaotic system. When the iteration reaches a preset number of times, the system obtains the chaotic state value output by the chaotic system. Based on the pre-generated Latin square elements, the chaotic state values, and the quantization level corresponding to each encryption method, a key stream element group corresponding to each encryption method is generated; wherein, the encryption method includes at least quantization syntax element encryption, filter coefficient encryption, and motion information syntax element encryption; Based on the key stream element group, the chaotic system is iterated until all the syntax elements to be encrypted in the chaotic system are encrypted, thereby obtaining the encryption key stream corresponding to each encryption method generated by the chaotic system.

6. The method according to claim 5, characterized in that, The step of encrypting the syntax elements of the entropy encoding process of the image group using an encryption key stream generated from the input key information according to the security level, to obtain the ciphertext syntax elements corresponding to each image group, includes: When the security level of the image group is the first security level, the quantization syntax elements, filter coefficients and motion information syntax elements in the image group are encrypted in the entropy coding process using the encryption key stream corresponding to each encryption method to obtain the first ciphertext syntax element corresponding to the image group; wherein, the first ciphertext syntax element includes quantization syntax encryption elements, filter encryption elements and motion information syntax encryption elements. When the security level of the image group is the second security level, the filter coefficients and motion information syntax elements in the image group are encrypted in the entropy coding process using the encryption key stream corresponding to each encryption method to obtain the second ciphertext syntax element corresponding to the image group; wherein, the second ciphertext syntax element includes filter encryption elements and motion information syntax encryption elements; When the security level of the image group is the third security level, the motion information syntax elements in the image group are encrypted in the entropy coding process using the encryption key stream corresponding to each encryption method to obtain the third ciphertext syntax element corresponding to the image group; wherein, the third ciphertext syntax element includes the motion information syntax encryption element.

7. The method according to claim 6, characterized in that, When the encryption method is quantized syntax element encryption, the quantized syntax elements in the image group are encrypted during entropy encoding using the encryption key stream corresponding to each encryption method through the following steps: The image group is obtained by acquiring multiple non-zero AC coefficients generated during the binary arithmetic coding process of the entropy coding process, and the suffix information and sign bit information corresponding to each non-zero AC coefficient are determined. The quantization parameter prediction error sign bit information corresponding to the image group is also acquired. Obtain the first encryption key stream corresponding to the suffix information, and use the first encryption key stream to encrypt the amplitude value in the suffix information to obtain the first ciphertext value; Obtain the second encryption key stream corresponding to the symbol bit information, and encrypt the symbol bit information using a preset flip formula based on the second encryption key stream to obtain the second ciphertext value; Obtain the third encryption key stream corresponding to the quantization parameter prediction error sign bit information, and use the third encryption key stream to encrypt the quantization parameter prediction error sign bit information to obtain the third ciphertext value; The first ciphertext value, the second ciphertext value, and the third ciphertext value are determined as the quantization syntax encryption elements.

8. The method according to claim 6, characterized in that, When the encryption method is filter coefficient encryption, the filter coefficients in the image group are encrypted during entropy coding using the encryption key stream corresponding to each encryption method through the following steps: Obtain the fourth key stream corresponding to the filter coefficients, and obtain multiple boundary compensation values ​​from the filter coefficients in the image group; Each boundary compensation value is encrypted using the fourth key stream to obtain a fourth ciphertext value, and the fourth ciphertext value is determined as the encryption element of the filter.

9. The method according to claim 6, characterized in that, When the encryption method is motion information syntax element encryption, the motion information syntax elements in the image group are encrypted during entropy coding using the encryption key stream corresponding to each encryption method through the following steps: Obtain the motion vector difference, merge index value, and reference frame index value corresponding to the image group, and determine whether the motion vector difference belongs to a preset value range; If the motion vector difference falls within a preset value range, then the fifth key stream corresponding to the motion vector difference is obtained, and the motion vector difference is encrypted using the fifth key stream to obtain the fifth ciphertext value. Determine whether the merged index value is any one of a plurality of first preset values; If the merge index value is any one of a plurality of first preset values, then the sixth key stream corresponding to the merge index value is obtained, and the merge index value is encrypted using the sixth key stream to obtain the sixth ciphertext value; Determine whether the reference frame index value is any one of a plurality of second preset values; If the reference frame index value is any one of a plurality of second preset values, then the seventh key stream corresponding to the reference frame index value is obtained, and the reference frame index value is encrypted using the seventh key stream to obtain the seventh ciphertext value; The fifth ciphertext value, the sixth ciphertext value, and the seventh ciphertext value are determined as the motion information syntax encryption elements.

10. A video compression and encryption device, characterized in that, The compression encryption device includes: The sensitive target detection module is used to identify sensitive targets in each of the multiple image groups in the input video to be compressed using a preset target detection model, determine the number of sensitive targets corresponding to each image group, and start compression encoding of the video to be compressed in response to the determination of the number of sensitive targets. A sensitive target processing module is used to embed the flag bits corresponding to the number of sensitive targets into each of the image groups during the compression encoding process, and to determine the security level of each image group based on the number of sensitive targets corresponding to each image group. The syntax element encryption module is used to encrypt the syntax elements of the image group in the entropy encoding process according to the security level using the encryption key stream generated by the input key information, to obtain the ciphertext syntax element corresponding to each image group, and write the ciphertext syntax element into the output bitstream corresponding to the video to be compressed. The video compression encoding module is used to obtain a target compressed video generated by compressing and encoding the video to be compressed based on the output bitstream including the flag bits and the ciphertext syntax elements.