[go: up one dir, main page]

CN110035319B - A kind of audio and video data encryption, decryption method, device and playback device - Google Patents

A kind of audio and video data encryption, decryption method, device and playback device Download PDF

Info

Publication number
CN110035319B
CN110035319B CN201910263400.4A CN201910263400A CN110035319B CN 110035319 B CN110035319 B CN 110035319B CN 201910263400 A CN201910263400 A CN 201910263400A CN 110035319 B CN110035319 B CN 110035319B
Authority
CN
China
Prior art keywords
data
frame
audio
characteristic
frame data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910263400.4A
Other languages
Chinese (zh)
Other versions
CN110035319A (en
Inventor
彭泽波
朱玉荣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anhui Wenxiang Information Technology Co Ltd
Original Assignee
Beijing Wenxiang Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Wenxiang Information Technology Co ltd filed Critical Beijing Wenxiang Information Technology Co ltd
Priority to CN201910263400.4A priority Critical patent/CN110035319B/en
Publication of CN110035319A publication Critical patent/CN110035319A/en
Application granted granted Critical
Publication of CN110035319B publication Critical patent/CN110035319B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/172Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/439Processing of audio elementary streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/439Processing of audio elementary streams
    • H04N21/4394Processing of audio elementary streams involving operations for analysing the audio stream, e.g. detecting features or characteristics in audio streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/4408Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video stream encryption, e.g. re-encrypting a decrypted video stream for redistribution in a home network

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

本发明公开一种音视频数据的加密、解密方法、装置及播放设备,其中加密方法包括:获取音视频流数据,并对音视频流数据编码;从编码后的音视频流数据中提取特征帧数据;获取当前帧的特征帧数据的加密规则;按照当前帧的特征帧数据的加密规则,对特征帧数据逐帧进行加密直到尾帧的特征帧数据完成加密。本发明利用当前帧的特征帧数据的加密规则逐帧对已编码的音视频流数据实时加密,在很大程度上,可以增加音视频流数据的安全性,以免音视频流数据被轻易解析,同时,无需涉及复杂的加密算法占用过多的数据内存,因此,还可节约数据加密内存,进而可提高音视频流数据的传输速度。

Figure 201910263400

The invention discloses a method, device and playback device for encrypting and decrypting audio and video data, wherein the encryption method comprises: acquiring audio and video stream data, and encoding the audio and video stream data; extracting feature frames from the encoded audio and video stream data data; obtain the encryption rule of the feature frame data of the current frame; according to the encryption rule of the feature frame data of the current frame, encrypt the feature frame data frame by frame until the feature frame data of the last frame is encrypted. The invention utilizes the encryption rules of the characteristic frame data of the current frame to encrypt the encoded audio and video stream data in real time frame by frame, which can increase the security of the audio and video stream data to a large extent, so as to prevent the audio and video stream data from being easily parsed, At the same time, there is no need to involve complicated encryption algorithms to occupy too much data memory, therefore, data encryption memory can also be saved, thereby improving the transmission speed of audio and video stream data.

Figure 201910263400

Description

Audio and video data encryption and decryption methods and devices and playing equipment
Technical Field
The invention relates to the technical field of audio and video security, in particular to an encryption and decryption method and device for audio and video data and playing equipment.
Background
With the rapid development of network and multimedia technologies, more and more audio and video data are beginning to be widely applied to the internet, and meanwhile, with the continuous enhancement of copyright awareness of people, people begin to pay attention to the copyright protection and security and confidentiality problems of the audio and video data. Therefore, the encryption protection of audio-video data is increasingly important in internet communication transmission.
At present, in an encryption mode of audio and video data in the prior art, all data information of a recorded audio and video file is generally encrypted as a whole at the same time, and therefore, all data of the audio and video file are subjected to security protection by using the same key.
Disclosure of Invention
In view of this, the embodiment of the present invention provides an encryption method for audio and video data, so as to solve the problems of poor security and low encryption efficiency of an encryption method for audio and video data in the prior art.
According to a first aspect, an embodiment of the present invention provides an encryption method for audio and video data, including the following steps:
acquiring audio and video stream data and coding the audio and video stream data;
extracting characteristic frame data from the coded audio and video stream data;
acquiring an encryption rule of the characteristic frame data of the current frame;
and encrypting the characteristic frame data frame by frame according to the encryption rule of the characteristic frame data of the current frame until the characteristic frame data of the tail frame is encrypted.
With reference to the first aspect, in a first implementation manner of the first aspect, the step of obtaining an encryption rule of the feature frame data of the current frame further includes:
acquiring the data size of the characteristic frame data of the current frame;
acquiring a first encryption identifier generated by the characteristic frame data of the previous frame of the current frame;
acquiring the identification byte number of the first encryption identification;
setting a preset byte alignment digit;
and generating a second encryption identifier of the characteristic frame data of the current frame according to the sum of the calculated data size, the identifier byte number and the preset byte alignment number.
With reference to the first aspect or the first implementation manner of the first aspect, in a second implementation manner of the first aspect, the characteristic frame data includes: intra-coded frames, forward predicted frames, and bi-directional predicted frames.
With reference to the first implementation manner of the first aspect, in a third implementation manner of the first aspect, the identification byte number is 32 bits, 64 bits, 128 bits, or 256 bits.
According to a second aspect, an embodiment of the present invention provides a method for decrypting audio/video data, including:
acquiring encrypted characteristic frame data;
acquiring a decryption rule of the characteristic frame data of the current frame;
according to the decryption rule of the characteristic frame data of the current frame, decrypting the characteristic frame data frame by frame until the characteristic frame data of the tail frame is decrypted;
and decoding the decrypted characteristic frame data to obtain the audio and video stream data.
With reference to the second aspect, in a first embodiment of the second aspect, the step of obtaining a decryption rule of the feature frame data of the current frame further includes:
acquiring the data size of the characteristic frame data of the current frame;
acquiring a first decryption identifier generated by the characteristic frame data of the previous frame of the current frame;
acquiring the identification byte number of the first decryption identification;
setting a preset byte alignment digit;
and generating a second decryption identifier for decrypting the characteristic frame data of the current frame according to the sum of the calculated data size, the identification byte number and the preset byte alignment number.
With reference to the second aspect or the first embodiment of the second aspect, in a second embodiment of the second aspect, the characteristic frame data includes: intra-coded frames, forward predicted frames, and bi-directional predicted frames.
With reference to the first embodiment of the second aspect, in a third embodiment of the second aspect, the feature frame data includes: intra-coded frames, forward predicted frames, and bi-directional predicted frames.
According to a third aspect, an embodiment of the present invention provides an apparatus for encrypting audio/video data, including:
the first acquisition module is used for acquiring audio and video stream data and encoding the audio and video stream data;
the extraction module is used for extracting characteristic frame data from the coded audio and video stream data;
the second acquisition module is used for acquiring the encryption rule of the characteristic frame data of the current frame;
and the encryption module is used for encrypting the characteristic frame data frame by frame according to the encryption rule of the characteristic frame data of the current frame until the characteristic frame data of the tail frame is encrypted.
According to a fourth aspect, an embodiment of the present invention provides a device for decrypting audio/video data, including:
the third acquisition module is used for acquiring the encrypted characteristic frame data;
the fourth obtaining module is used for obtaining a decryption rule of the characteristic frame data of the current frame;
the decryption module is used for decrypting the characteristic frame data frame by frame according to the decryption rule of the characteristic frame data of the current frame until the characteristic frame data of the tail frame is decrypted;
and the decoding module is used for decoding the decrypted characteristic frame data to obtain the audio and video stream data.
According to a fifth aspect, an embodiment of the present invention provides a storage medium, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method for encrypting audio and video data described in the first aspect or any one of the embodiments of the first aspect are implemented; or, implementing the steps of the decryption method for audio-video data described in the second aspect or any one of the embodiments of the second aspect.
According to a sixth aspect, an embodiment of the present invention provides a playback device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method for encrypting audio and video data according to the first aspect or any implementation manner of the first aspect when executing the program; or, implementing the steps of the decryption method of the audio-video data described in the second aspect or any embodiment of the second aspect.
The technical scheme of the embodiment of the invention has the following advantages:
the invention provides an encryption and decryption method, device and playing equipment of audio and video data, wherein the encryption method comprises the following steps: acquiring audio and video stream data and coding the audio and video stream data; extracting characteristic frame data from the coded audio and video stream data; acquiring an encryption rule of characteristic frame data of a current frame; and encrypting the characteristic frame data frame by frame according to the encryption rule of the characteristic frame data of the current frame until the characteristic frame data of the tail frame is encrypted. The invention utilizes the encryption rule of the characteristic frame data of the current frame to encrypt the coded audio and video stream data frame by frame in real time, can increase the security of the audio and video stream data to a great extent so as to prevent the audio and video stream data from being easily analyzed, and simultaneously, does not need to involve complicated encryption algorithm to occupy excessive data memory, thereby saving the data encryption memory and further improving the transmission speed of the audio and video stream data.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a first flowchart of an encryption method of audio-video data according to an embodiment of the present invention;
fig. 2 is a second flowchart of the encryption method of the audio-video data in the embodiment of the present invention;
FIG. 3 is a diagram illustrating an arrangement structure of feature frame data according to an embodiment of the present invention;
fig. 4 is a first flowchart of a decryption method of audio-video data according to an embodiment of the present invention;
fig. 5 is a second flowchart of the decryption method of the audio-video data in the embodiment of the present invention;
fig. 6 is a block diagram of an encryption apparatus for audio/video data according to an embodiment of the present invention;
fig. 7 is a block diagram of a decryption apparatus for audio/video data according to an embodiment of the present invention;
fig. 8 is a schematic diagram of a hardware structure of a playback device in the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1
The embodiment of the invention provides an encryption method of audio and video data, which comprises the following steps as shown in figure 1:
step S1: and acquiring audio and video stream data and coding the audio and video stream data. The audio-video stream data herein refers to audio data and/or video data that is being recorded and continuous by the streaming media device, and is not audio-video data that has been recorded by the streaming media device. Therefore, the audio/video stream data in this embodiment is audio data and/or video data recorded in real time, for example: the audio-video streaming data may be MP3 audio data or MP4 video data. In order to better transmit audio and video stream data, the audio and video stream data needs to be encoded, that is, the audio and video stream data is converted into encoded data in a binary form, the encoding in the embodiment adopts an h264 encoding format, and the audio and video stream data is encoded in real time by using the h264 encoding format and then encrypted.
Step S2: and extracting characteristic frame data from the coded audio and video stream data. The characteristic frame data here are an intra-frame coded frame, a forward predicted frame and a bidirectional predicted frame, wherein the intra-frame coded frame is an I frame in the h264 coding format, the forward predicted frame is a P frame in the h264 format, and the bidirectional predicted frame is a B frame in the h264 coding format. And extracting the I frame, the P frame and the B frame of each frame of audio and video stream data according to the frame identification of each frame of audio and video stream data. The characteristic frame data is used as important information in the audio and video stream data, the safety of the audio and video stream data can be ensured as long as the important information is effectively encrypted, and all content information of the audio and video stream data does not need to be encrypted, so that the data encryption size of the audio and video stream data can be reduced to a great extent, and the data transmission speed can be improved.
Step S3: and acquiring an encryption rule of the characteristic frame data of the current frame. The encryption rule here is the encryption mode of the current frame.
In an embodiment, the step S3 may specifically include, as shown in fig. 2, the following steps in the execution process:
step S31: and acquiring the data size of the characteristic frame data of the current frame. The audio and video stream data are arranged in the frame rate queue frame by frame in sequence, so the characteristic frame data extracted from the audio and video stream data are also arranged frame by frame in sequence. As shown in fig. 3, the audio/video stream data are arranged in the frame rate queue in order, for example: the feature frame data No. 5 in fig. 3 is taken as the feature frame data of the current frame, and the data Size of the feature frame data No. 5 is set to Size, and the data Size of the feature frame data No. 5 is set to 1000KB, that is, Size5=1000KB。
Step S32: and acquiring a first encryption identifier generated by the characteristic frame data of the previous frame of the current frame. For example: and taking the No. 5 characteristic frame data as current frame data, taking the characteristic frame data of the previous frame as No. 4 characteristic frame data, and acquiring a first encryption identifier generated by the No. 4 characteristic frame data, wherein the first encryption identifier can be different types of letters or numbers or different types of letter or number combinations.
Step S33: and acquiring the identification byte number of the first encryption identification. The number of bits of the identification byte of the first encryption identifier may be 32 bits, 64 bits, 128 bits, or 256 bits, preferably 32 bits, but the number of bits of the identification byte of the first encryption identifier may also be 64 bits, 128 bits, or 256 bits, but the higher the number of bits is, the larger the size of the data memory occupied by the first encryption identifier is, so that an appropriate number of bits of the byte is selected as the byte length of the first encryption identifier, so as to prevent the data size of the first encryption identifier from excessively affecting the data transmission of the audio/video stream.
Step S34: and setting a preset byte alignment digit. The preset byte alignment bit number here is a bit number set to achieve byte data alignment on the storage space, that is, an alignment value of a specified data structure or class. The predetermined byte alignment bit number in this embodiment is 2nIn this embodiment, n ≧ 3 is preferred, that is, the number of preset byte alignment bits is preferably 8, and may of course be 16, but the number of preset byte alignment bits is preferably 8 for byte data alignment and for ensuring a proper size of data.
Step S35: and generating a second encryption identifier of the characteristic frame data of the current frame according to the sum of the calculated data size, the first encryption identifier and the preset byte alignment digit. For example: the first encryption identifier is the identifier generated by the feature frame data of the previous frame of the feature frame data No. 5, i.e. the key identifier generated by the feature frame data No. 4, and the data Size of the feature frame data No. 55The number of bits of the predetermined byte alignment is 8, and the number of bits of the identification byte of the first encryption identifier is 32, so that the second encryption identifier is 1040 according to the calculation 1000+8+ 32. For example: the first encryption identifier is the identifier of the generation of the characteristic frame data of the frame before the characteristic frame data No. 2, i.e. the identifier of the key generated by the characteristic frame data No. 1, and the data Size of the characteristic frame data No. 22The number of bits of the predetermined byte alignment is 8, and the number of bits of the identification byte of the first encryption identifier is 32, so that the number of bits of the identification byte of 500+8+32 is 540 according to the calculation, that is, the number of bits of the second encryption identifier is 540.
And generating a second encryption identifier according to the steps from the step S31 to the step S35, namely, the encryption rule of the characteristic frame data of the current frame. The encryption rule is based on SM4ECB mode encryption, the encryption rule is suitable for all frame data in the recording process of audio and video stream data, namely each frame data of the audio and video stream data can be encrypted according to the method, namely the encryption identifier of the characteristic frame data of the next frame depends on the encryption identifier of the characteristic frame data of the previous frame, the audio and video stream data has stronger safety according to the encryption rule, the encryption rule in the embodiment is utilized to encrypt each frame of characteristic frame data in the audio and video stream data, all the characteristic frame data are not easy to analyze, and the safety of the audio and video stream data is enhanced.
Step S4: and encrypting the characteristic frame data frame by frame according to the encryption rule of the characteristic frame data of the current frame until the characteristic frame data of the tail frame is encrypted.
Specifically, for example: in fig. 3, the number of bits of the first encryption flag generated by the data of feature frame number 1 is 32, and the data Size, of the data of feature frame number 2 is 322If the number of preset byte alignment bits is 8 and the number 2 of feature frame data is the current frame, the encryption identifier of the number 2 of feature frame data is 500+8+32, 540. By analogy, the number 3 feature frame data is taken as the current frame, the feature frame data of the previous frame is the number 2 feature frame data, the number of identification byte digits of the number 2 encryption identifier 540 is also 32 digits, and the data Size, and Size of the number 3 feature frame data are also 32 digits3700KB, the encrypted identifier of the frame data of feature number 3 is 700+8+32, 740. And by analogy, the number 4 characteristic frame data is taken as the current frame, the characteristic frame data of the previous frame is the number 3 characteristic frame data, the number of identification byte digits of the number 4 encryption identifier 740 is also 32 digits, and the data Size and Size of the number 3 characteristic frame data are Size3900KB, the encrypted identifier of the frame data of feature number 4 is 900+8+32, 940. By analogy, the feature frame data of number 5 is taken as the current frame, the feature frame data of the previous frame is the feature frame data of number 4, the number of identification byte digits of the encryption identifier 940 of number 4 is also 32, and the data Size of the feature frame data of number 5 is Size3The encryption identifier of the frame data of feature number 5 is 1000+8+ 32-1040 (100 KB). According to the encryption mode, the encryption identifier of the characteristic frame data of the next frame depends on the encryption identifier of the characteristic frame data of the previous frame, the characteristic frame data in the figure 3 is encrypted frame by frame until the N frames of the tail frame are encrypted, the real-time recorded audio and video stream data can be ensured not to be easily cracked, the safety of the audio and video stream data is obviously enhanced, and simultaneously, compared with the traditional method, the method for encrypting all recorded audio and video stream data is used for encrypting all recorded audio and video stream dataThe video data is encrypted by the same key based on a complex encryption algorithm, so that the data size of audio and video stream data transmission can be reduced to a great extent.
The method for encrypting the audio and video data in the embodiment of the invention encrypts the coded audio and video stream data frame by using the encryption rule of the characteristic frame data of the current frame in real time, can increase the safety of the audio and video stream data to a great extent so as to prevent the audio and video stream data from being easily analyzed, and simultaneously does not need to involve a complex encryption algorithm to occupy excessive data memory, so that the data encryption memory can be saved, and the transmission speed of the audio and video stream data can be further increased.
Example 2
An embodiment of the present invention provides a method for decrypting audio/video data, as shown in fig. 4, including:
step S41: and acquiring the encrypted characteristic frame data. The encrypted characteristic frame data is characteristic frame data of all encrypted frames, that is, characteristic frame data of all frames to which the key is added.
Step S42: and acquiring a decryption rule of the characteristic frame data of the current frame. The decryption rule here is the decryption mode of the current frame.
In an embodiment, the step S42 may specifically include, as shown in fig. 5, the following steps in the execution process:
step S51: and acquiring the data size of the characteristic frame data of the current frame. The audio and video stream data are arranged in the frame rate queue frame by frame in sequence, so the characteristic frame data extracted from the audio and video stream data are also arranged frame by frame in sequence. As shown in fig. 3, the audio/video stream data are arranged in the frame rate queue in order, for example: the feature frame data No. 5 in FIG. 3 is taken as the feature frame data of the current frame, and the data Size of the feature frame data No. 5 is set as Size5The data Size of the No. 5 feature frame data is 1000KB, i.e. Size5=1000KB。
Step S52: and acquiring a first decryption identifier generated by the characteristic frame data of the previous frame of the current frame. For example: and taking the No. 5 characteristic frame data as current frame data, taking the characteristic frame data of the previous frame as No. 4 characteristic frame data, and acquiring a first decryption identifier generated by the No. 4 characteristic frame data, wherein the first decryption identifier can be different types of letters or numbers or different types of combinations of letters or numbers.
Step S53: and acquiring the identification byte bit number of the first decryption identification. The number of identification byte bits of the first decryption identifier may be 32 bits, 64 bits, 128 bits, or 256 bits, preferably 32 bits, but the number of identification byte bits of the first decryption identifier may also be 64 bits, 128 bits, or 256 bits, but the higher the number of bits is, the larger the size of the data memory occupied by the first decryption identifier is, so that an appropriate number of byte bits is selected as the byte length of the first decryption identifier, so as to prevent the data size of the first decryption identifier from affecting the data transmission of the audio/video stream.
Step S54: and setting a preset byte alignment digit. The preset byte alignment bit number here is a bit number set to achieve byte data alignment on the storage space, that is, an alignment value of a specified data structure or class. The predetermined byte alignment bit number in this embodiment is 2nIn this embodiment, n ≧ 3 is preferred, that is, the number of preset byte alignment bits is preferably 8, and may of course be 16, but the number of preset byte alignment bits is preferably 8 for byte data alignment and for ensuring a proper size of data.
Step S55: and generating a second decryption identifier for decrypting the characteristic frame data of the current frame according to the sum of the calculated data size, the identification byte digit and the preset byte alignment digit. For example: the current frame is No. 5 characteristic frame data, and the data Size of No. 5 characteristic frame data5The feature frame data of the previous frame is the feature frame data No. 4, the number of the identification byte bits of the first decryption identifier generated by the feature frame data No. 4 is 32 bits, the preset byte alignment bit number is 8, that is, the sum of the data size of the feature frame data No. 5, the number of the identification byte bits and the preset byte alignment bit number is 1040, that is, the second decryption identifier is 1040, and the second decryption identifier of 1040 needs to be decrypted in the data storage space. Reversely shifting according to the identification byte number, the preset byte alignment number and the data size of the No. 5 characteristic frame data of the first decryption identification generated by the No. 4 characteristic frame dataAnd the byte position of the dynamic characteristic frame data further decrypts the second decryption identifier to obtain the coded audio/video stream data.
The second decryption flag generated according to the above steps S51-S55 is the decryption rule of the feature frame data of the current frame. The decryption rule is based on decryption in a SM4ECB mode, the decryption rule is suitable for all frame data of audio and video stream data in the recording process, namely, each frame data of the audio and video stream data can be decrypted in the mode, namely, decryption identification of feature frame data of a next frame depends on decryption identification of feature frame data of a previous frame, and the feature frame data can be quickly decrypted in the mode.
Step S43: and decrypting the characteristic frame data frame by frame according to the decryption rule of the characteristic frame data of the current frame until the decryption of the characteristic frame data of the tail frame is completed. Specifically, for example: in fig. 3, the number of bits of the first decryption identifier generated by the number 1 of feature frame data is 32, and the data Size, of the number 2 of feature frame data is2If the number of the preset byte alignment bits is 8 and the number 2 of the feature frame data is the current frame, the decryption identifier of the number 2 of the feature frame data is 500+8+32, which is 540, and the second decryption identifier of 540 needs to be decrypted on the data storage space. By analogy, the data of the feature frame data # 3 is taken as the current frame, the feature frame data of the previous frame is the feature frame data # 2, the number of identification byte bits of the decryption identifier # 2 540 is also 32, and the data Size, of the feature frame data # 3 is also 323700KB, the decryption identifier of the data of feature frame No. 3 is 700+8+32, 740, and the second decryption identifier of 740 needs to be decrypted on the data storage space. And by analogy, the number 4 feature frame data is taken as the current frame, the feature frame data of the previous frame is the number 3 feature frame data, the number of identification byte digits of the number 4 decryption identifier 740 is also 32 digits, and the data Size and Size of the number 3 feature frame data are Size3When the decryption identifier of the number 4 characteristic frame data is 900+8+32, 940, the second decryption identifier of 940 needs to be decrypted on the data storage space. By analogy, the No. 5 characteristic frame data is taken as the current frame, the characteristic frame data of the previous frame is the No. 4 characteristic frame data,the number of bits of the identifier byte of the decryption identifier 940 # 4 is also 32 bits, and the data Size of the data of the feature frame # 5 is Size3When the decryption identifier of the frame data of feature number 5 is 1000+8+32, 1040, the second decryption identifier of 1040 needs to be decrypted on the data storage space. According to the decryption mode, namely the decryption identifier of the characteristic frame data of the next frame depends on the decryption identifier of the characteristic frame data of the previous frame, the characteristic frame data in the figure 3 is decrypted frame by frame until the N frames of the tail frame are decrypted, the decoding of the coded audio and video stream data can be rapidly realized, and the safety of the audio and video stream data is ensured.
Step S44: and decoding the decrypted characteristic frame data to obtain audio and video stream data. And decoding the characteristic frame data stored in the decrypted binary form to restore the recorded audio and video picture, wherein the audio and video picture can be normally played by using the streaming media playing equipment.
Example 3
An embodiment of the present invention provides an encryption apparatus for audio and video data, as shown in fig. 6, including:
the first obtaining module 61 is configured to obtain audio/video stream data and encode the audio/video stream data.
And the extracting module 62 is configured to extract characteristic frame data from the encoded audio/video stream data.
And a second obtaining module 63, configured to obtain an encryption rule of the feature frame data of the current frame.
And an encryption module 64, configured to encrypt the feature frame data frame by frame according to an encryption rule of the feature frame data of the current frame until the feature frame data of the last frame is encrypted.
In the encryption apparatus of audio/video data in the embodiment of the present invention, in fig. 6, the second obtaining module 63 further includes:
the first obtaining sub-module 631 is configured to obtain a data size of the feature frame data of the current frame;
the second obtaining submodule 632 is configured to obtain a first encryption identifier generated by the feature frame data of the previous frame of the current frame;
a third obtaining submodule 633, configured to obtain an identifier byte number of the first encryption identifier;
a first setting sub-module 634 for setting the preset byte alignment digit number;
the generating submodule 635 is configured to generate a second encrypted identifier of the feature frame data of the current frame according to the sum of the calculated data size, the identifier byte number and the preset byte alignment number.
In the encryption device of audio/video data in the embodiment of the present invention, the characteristic frame data includes: intra-coded frames, forward predicted frames, and bi-directional predicted frames.
In the encryption device for audio and video data in the embodiment of the invention, the bit number of the identification byte is 32 bits or 64 bits or 128 bits or 256 bits.
The audio and video data encryption device in the embodiment of the invention encrypts the coded audio and video stream data frame by using the encryption rule of the characteristic frame data of the current frame in real time, can increase the security of the audio and video stream data to a great extent so as to prevent the audio and video stream data from being easily analyzed, and simultaneously does not need to involve a complex encryption algorithm to occupy excessive data memory, so that the data encryption memory can be saved, and the transmission speed of the audio and video stream data can be further improved.
Example 4
As shown in fig. 7, the apparatus for decrypting audio/video data in the embodiment of the present invention includes:
and a third obtaining module 71, configured to obtain the encrypted feature frame data.
A fourth obtaining module 72, configured to obtain a decryption rule of the feature frame data of the current frame.
And the decryption module 73 is configured to decrypt the feature frame data frame by frame according to the decryption rule of the feature frame data of the current frame until the feature frame data of the last frame is decrypted.
And the decoding module 74 is configured to decode the decrypted feature frame data to obtain audio/video stream data.
In the apparatus for decrypting audio/video data in the embodiment of the present invention, in fig. 7, the fourth obtaining module 72 further includes:
a first obtaining submodule 721 configured to obtain a data size of the feature frame data of the current frame;
the second obtaining submodule 722 is configured to obtain a first decryption identifier generated by feature frame data of a previous frame of the current frame;
a third obtaining sub-module 723, configured to obtain the first decrypted byte-identifying number;
the second setting submodule 724 is used for acquiring a preset alignment digit;
the decryption submodule 725 is configured to decrypt, according to the sum of the calculated data size, the identification byte number and the preset byte alignment number, the second decryption identification generated by the feature frame data of the current frame.
In the apparatus for decrypting audio/video data according to the embodiment of the present invention, the characteristic frame data includes: intra-coded frames, forward predicted frames, and bi-directional predicted frames.
In the decryption device for audio and video data in the embodiment of the invention, the identification byte bit number is 32 bits or 64 bits or 128 bits or 256 bits.
The audio and video data decryption device in the embodiment of the invention can quickly decrypt the characteristic frame data according to the way based on the decryption rule that the decryption of the decryption identification of the characteristic frame data of the next frame depends on the decryption of the decryption identification of the characteristic frame data of the previous frame.
Example 5
An embodiment of the present invention provides a storage medium having stored thereon computer instructions which, when executed by a processor, implement the steps of the method of embodiment 1 or embodiment 2. The storage medium is also stored with audio and video stream data, characteristic frame data, an encryption rule of the characteristic frame data of the current frame, a first encryption identifier, an identifier byte bit number of the first encryption identifier, a preset byte alignment bit number, a decryption rule and the like. The storage medium may be a magnetic Disk, an optical Disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a flash Memory (FlashMemory), a Hard Disk (Hard Disk Drive, abbreviated as HDD) or a Solid State Drive (SSD), etc.; the storage medium may also comprise a combination of memories of the kind described above.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a Random Access Memory (RAM), or the like.
Example 6
An embodiment of the present invention provides a playback device, as shown in fig. 8, including a memory 820, a processor 810, and a computer program stored on the memory 820 and being executable on the processor 810, where the processor 810 implements the steps of the method in embodiment 1 or embodiment 2 when executing the program.
Fig. 8 is a schematic diagram of a hardware structure of a playback device for executing a processing method for list item operations according to an embodiment of the present invention, as shown in fig. 8, the playback device includes one or more processors 810 and a memory 820, where one processor 810 is taken as an example in fig. 8.
The playing device executing the processing method of the list item operation may further include: an input device 830 and an output device 840.
The processor 810, the memory 820, the input device 830, and the output device 840 may be connected by a bus or other means, such as the bus connection in fig. 8.
Processor 810 may be a Central Processing Unit (CPU). The Processor 810 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, or combinations thereof.
It should be understood that the above examples are only for clarity of illustration and are not intended to limit the embodiments. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. And obvious variations or modifications therefrom are within the scope of the invention.

Claims (10)

1. A method for encrypting audio/video data is characterized by comprising the following steps:
acquiring audio and video stream data and coding the audio and video stream data;
extracting characteristic frame data from the coded audio and video stream data;
acquiring the data size of the characteristic frame data of the current frame;
acquiring a first encryption identifier generated by the characteristic frame data of the previous frame of the current frame;
acquiring the identification byte number of the first encryption identification;
setting a preset byte alignment digit;
generating a second encryption identifier of the characteristic frame data of the current frame according to the sum of the calculated data size, the identifier byte number and the preset byte alignment number;
and encrypting the characteristic frame data frame by frame according to the encryption rule of the characteristic frame data of the current frame until the characteristic frame data of the tail frame is encrypted.
2. The method for encrypting audio-visual data according to claim 1, wherein the characteristic frame data includes: intra-coded frames, forward predicted frames, and bi-directional predicted frames.
3. The method for encrypting audio-video data according to claim 1, wherein the number of bits of the identification byte is 32 bits, 64 bits, 128 bits or 256 bits.
4. A method for decrypting audio-video data, comprising:
acquiring encrypted characteristic frame data;
acquiring the data size of the characteristic frame data of the current frame;
acquiring a first decryption identifier generated by the characteristic frame data of the previous frame of the current frame;
acquiring the identification byte number of the first decryption identification;
setting a preset byte alignment digit;
generating a second decryption identifier for decrypting the characteristic frame data of the current frame according to the sum of the calculated data size, the identification byte number and the preset byte alignment number;
according to the decryption rule of the characteristic frame data of the current frame, decrypting the characteristic frame data frame by frame until the characteristic frame data of the tail frame is decrypted;
and decoding the decrypted characteristic frame data to obtain the audio and video stream data.
5. The method for decrypting audio-visual data according to claim 4, wherein the characteristic frame data includes: intra-coded frames, forward predicted frames, and bi-directional predicted frames.
6. The audio-video data decryption method of claim 4, wherein the identification byte number is 32 bits or 64 bits or 128 bits or 256 bits.
7. An apparatus for encrypting audio/video data, comprising:
the first acquisition module is used for acquiring audio and video stream data and encoding the audio and video stream data;
the extraction module is used for extracting characteristic frame data from the coded audio and video stream data;
the second acquisition module is used for acquiring the data size of the characteristic frame data of the current frame; acquiring a first encryption identifier generated by the characteristic frame data of the previous frame of the current frame; acquiring the identification byte number of the first encryption identification; setting a preset byte alignment digit; generating a second encryption identifier of the characteristic frame data of the current frame according to the sum of the calculated data size, the identifier byte number and the preset byte alignment number;
and the encryption module is used for encrypting the characteristic frame data frame by frame according to the encryption rule of the characteristic frame data of the current frame until the characteristic frame data of the tail frame is encrypted.
8. An apparatus for decrypting audio-video data, comprising:
the third acquisition module is used for acquiring the encrypted characteristic frame data;
the fourth obtaining module is used for obtaining the data size of the characteristic frame data of the current frame; acquiring a first decryption identifier generated by the characteristic frame data of the previous frame of the current frame; acquiring the identification byte number of the first decryption identification; setting a preset byte alignment digit; generating a second decryption identifier for decrypting the characteristic frame data of the current frame according to the sum of the calculated data size, the identification byte number and the preset byte alignment number;
the decryption module is used for decrypting the characteristic frame data frame by frame according to the decryption rule of the characteristic frame data of the current frame until the characteristic frame data of the tail frame is decrypted;
and the decoding module is used for decoding the decrypted characteristic frame data to obtain the audio and video stream data.
9. A storage medium having stored thereon computer instructions, characterized in that the instructions, when executed by a processor, implement the steps of the method of encrypting audiovisual data according to any of claims 1-3; or, implementing the steps of the decryption method of audiovisual data according to any of claims 4 to 6.
10. A playback device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method for encrypting audio-visual data according to any one of claims 1 to 3 when executing the program; or, implementing the steps of the decryption method of audiovisual data according to any of claims 4 to 6.
CN201910263400.4A 2019-04-02 2019-04-02 A kind of audio and video data encryption, decryption method, device and playback device Active CN110035319B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910263400.4A CN110035319B (en) 2019-04-02 2019-04-02 A kind of audio and video data encryption, decryption method, device and playback device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910263400.4A CN110035319B (en) 2019-04-02 2019-04-02 A kind of audio and video data encryption, decryption method, device and playback device

Publications (2)

Publication Number Publication Date
CN110035319A CN110035319A (en) 2019-07-19
CN110035319B true CN110035319B (en) 2020-05-15

Family

ID=67237331

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910263400.4A Active CN110035319B (en) 2019-04-02 2019-04-02 A kind of audio and video data encryption, decryption method, device and playback device

Country Status (1)

Country Link
CN (1) CN110035319B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111031353B (en) * 2019-12-11 2022-08-23 上海乐相科技有限公司 Video encryption method and device
CN111813965B (en) * 2020-05-14 2024-06-21 北京嘀嘀无限科技发展有限公司 Encryption method and decryption method for multimedia file, storage medium and electronic device
CN112333540B (en) * 2020-10-26 2022-06-24 浙江大华技术股份有限公司 Method and device for determining video encryption length
CN114363658B (en) * 2021-12-30 2022-09-02 慧之安信息技术股份有限公司 Method and device for encrypted transmission of audio and video stream

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102867153A (en) * 2012-08-30 2013-01-09 腾讯科技(深圳)有限公司 Methods and devices for encrypting and decrypting video file and mobile terminal
CN103338385A (en) * 2012-02-08 2013-10-02 Vixs系统公司 Video processing system and corresponding method
CN104918243A (en) * 2015-06-15 2015-09-16 上海交通大学 Mobile terminal secrecy system and method based on quantum true random number
CN105790925A (en) * 2014-12-24 2016-07-20 北京奇虎科技有限公司 Data encryption method, data decryption method, data encryption device and data decryption device
CN105850144A (en) * 2013-11-04 2016-08-10 耐瑞唯信有限公司 Device and method to mark digital audio or audio and/or video content
CN106303584A (en) * 2016-08-10 2017-01-04 北京蛙视通信技术股份有限公司 The audio, video data of transmission is carried out encipher-decipher method
CN106533652A (en) * 2015-09-15 2017-03-22 中兴通讯股份有限公司 XTS-SM4-based storage encryption and decryption method and device
CN106878013A (en) * 2017-03-20 2017-06-20 网宿科技股份有限公司 Method and device for encrypting and decrypting files
CN107276969A (en) * 2016-04-08 2017-10-20 杭州海康威视数字技术股份有限公司 The transmission method and device of a kind of data
CN108924099A (en) * 2018-06-15 2018-11-30 清华大学深圳研究生院 encryption method, encryption device, encryption performance analysis method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10045040B2 (en) * 2016-04-03 2018-08-07 Cisco Technology, Inc. Interleaved watermarking

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103338385A (en) * 2012-02-08 2013-10-02 Vixs系统公司 Video processing system and corresponding method
CN102867153A (en) * 2012-08-30 2013-01-09 腾讯科技(深圳)有限公司 Methods and devices for encrypting and decrypting video file and mobile terminal
CN105850144A (en) * 2013-11-04 2016-08-10 耐瑞唯信有限公司 Device and method to mark digital audio or audio and/or video content
CN105790925A (en) * 2014-12-24 2016-07-20 北京奇虎科技有限公司 Data encryption method, data decryption method, data encryption device and data decryption device
CN104918243A (en) * 2015-06-15 2015-09-16 上海交通大学 Mobile terminal secrecy system and method based on quantum true random number
CN106533652A (en) * 2015-09-15 2017-03-22 中兴通讯股份有限公司 XTS-SM4-based storage encryption and decryption method and device
CN107276969A (en) * 2016-04-08 2017-10-20 杭州海康威视数字技术股份有限公司 The transmission method and device of a kind of data
CN106303584A (en) * 2016-08-10 2017-01-04 北京蛙视通信技术股份有限公司 The audio, video data of transmission is carried out encipher-decipher method
CN106878013A (en) * 2017-03-20 2017-06-20 网宿科技股份有限公司 Method and device for encrypting and decrypting files
CN108924099A (en) * 2018-06-15 2018-11-30 清华大学深圳研究生院 encryption method, encryption device, encryption performance analysis method and device

Also Published As

Publication number Publication date
CN110035319A (en) 2019-07-19

Similar Documents

Publication Publication Date Title
CN110035319B (en) A kind of audio and video data encryption, decryption method, device and playback device
US12294731B2 (en) Detection of video tampering
CN101073238A (en) Protection of digital data content
US9450748B2 (en) Decryption of content including partial-block discard
CN102187682A (en) Encryption device and decoding device, and encryption method and decoding method
US20130129079A1 (en) System And Method For Decryption Of Content Including Disconnected Encryption Chains
CN113422882B (en) Hierarchical encryption method, system, equipment and storage medium for image compression coding
Torrubia et al. Perceptual cryptography on MPEG Layer III bit-streams
WO2021072878A1 (en) Audio/video data encryption and decryption method and apparatus employing rtmp, and readable storage medium
CN100581100C (en) Method and system for preventing skipped playback of a particular segment of content in a digital media stream
CN103414733A (en) HLS (HTTP Live Streaming) streaming media playing method and HLS streaming media playing system
CN108322750B (en) Encrypted domain HEVC video data hiding method based on residual coefficient modulation
CN104794673B (en) Utilize the encrypted domain reversible digital watermarking implementation method of highest significant position
CN104077541A (en) Selective encryption method and device based on multimedia data
CN107318045A (en) The method and device of playing video data stream
CN114938464A (en) Video encryption method and device and video decryption method and device
JP2025509015A (en) Data encryption and decryption system and method
CN108632663B (en) Method and system for processing digitized audio/video and subtitles
CN112887800A (en) Method for encrypting and protecting PVR (personal video recorder) of set top box
Agarwal et al. Data hiding using lazy wavelet transform strategy
CN109743592B (en) Real-time code stream encryption method based on two-dimensional codebook
CN116484407B (en) Data security protection method and device, electronic equipment and storage medium
Li et al. An Effective Reversible Data Hiding Scheme Used in Compressible Encryption Which Can Prevent Loss
CN107896143A (en) Joint coding method based on high-dimension chaotic system and arithmetic coding
KR20120138940A (en) System and method implementing a selective encryption for mobile terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20200604

Address after: 247100 workshop C2, science and Technology Incubation Park, Jiangnan industrial concentration zone, Chizhou City, Anhui Province

Patentee after: Anhui Wenxiang Information Technology Co.,Ltd.

Address before: 100176 11th Floor, Block B, Zhonghang Technology Plaza, 15 Ronghua South Road, Daxing Economic and Technological Development Zone, Beijing

Patentee before: BEIJING WENXIANG INFORMATION TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A method, device, and playback device for encrypting and decrypting audio and video data

Granted publication date: 20200515

Pledgee: Anhui Jiangnan Industrial Concentration Zone Construction Investment Development (Group) Co.,Ltd.

Pledgor: Anhui Wenxiang Information Technology Co.,Ltd.

Registration number: Y2024980010826

PE01 Entry into force of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Granted publication date: 20200515

Pledgee: Anhui Jiangnan Industrial Concentration Zone Construction Investment Development (Group) Co.,Ltd.

Pledgor: Anhui Wenxiang Information Technology Co.,Ltd.

Registration number: Y2024980010826

PC01 Cancellation of the registration of the contract for pledge of patent right