WO2021072878A1 - 基于rtmp的音视频数据加解密方法、装置及可读存储介质 - Google Patents

基于rtmp的音视频数据加解密方法、装置及可读存储介质 Download PDF

Info

Publication number
WO2021072878A1
WO2021072878A1 PCT/CN2019/118438 CN2019118438W WO2021072878A1 WO 2021072878 A1 WO2021072878 A1 WO 2021072878A1 CN 2019118438 W CN2019118438 W CN 2019118438W WO 2021072878 A1 WO2021072878 A1 WO 2021072878A1
Authority
WO
WIPO (PCT)
Prior art keywords
rtmp
encryption
video data
audio
data
Prior art date
Application number
PCT/CN2019/118438
Other languages
English (en)
French (fr)
Inventor
林国雄
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021072878A1 publication Critical patent/WO2021072878A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/65Network streaming protocols, e.g. real-time transport protocol [RTP] or real-time control protocol [RTCP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/75Media network packet handling
    • H04L65/762Media network packet handling at the source 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/75Media network packet handling
    • H04L65/764Media network packet handling at the destination 
    • 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/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/4405Processing 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 decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols

Definitions

  • This application relates to the field of data processing technology, and in particular to a method, system, device, and readable storage medium for encrypting and decrypting audio and video data based on rtmp.
  • the stream address can easily be obtained in plain text or be obtained by hackers using cracking methods and used Direct broadcast by third-party tools poses the risk of being eavesdropped on, causing huge losses to the company’s live broadcast operations and revenue.
  • rtmp Real Time Messaging Protocol
  • Anti-theft link Add relevant parameters to the rtmp url.
  • the rtmp server performs verification based on the parameters.
  • the defect is that the transmitted audio and video data packets are not encrypted. As long as the rtmp packet is parsed, it can be decoded and played.
  • the disadvantage is that users are required to build a streaming media server platform by themselves, which increases system complexity, data cannot be cached, and users occupy server bandwidth every time they play. It is not easy to combine CDN acceleration and increase servers. Bandwidth pressure.
  • the video is physically divided into pieces. Each piece of video uses a different encryption algorithm.
  • the same video segment can be encrypted using multiple encryption algorithms at the same time; the disadvantage is that the encryption process is too complicated, and the implementation is increased. Difficulty, and will increase the processing time before the transmission of each video frame, which consumes the computing performance of the client.
  • This application provides an audio and video data encryption and decryption method, system, electronic device, and readable storage medium and readable storage medium.
  • the main purpose of the method is to encrypt video data and audio data by using byte obfuscation methods to solve the encryption.
  • the method is complicated and avoids the problem of low data security caused by theft of the video stream.
  • this application provides a method for encrypting and decrypting audio and video data, including:
  • Collect video data and audio data and encode the collected video data and audio data to form an rtmp stream; add an encryption flag field encrypt to the rtmp metadata data element, and judge the rtmp stream according to the encryption flag field encrypt If the encryption setting is effective; if the encryption setting is effective, the video data and audio data of the rtmp stream are respectively encrypted by byte obfuscation; the encrypted rtmp stream is uploaded to the multimedia server through the client of the multimedia server Read the encrypted rtmp stream; read the encryption flag field encrypt in the rtmp meta data data element, and determine whether the encryption setting of the rtmp stream is valid; if the encryption setting is valid, decrypt the read encrypted rtmp stream ; Decode the decrypted rtmp stream to obtain a clear rtmp stream.
  • this application provides an audio and video data encryption and decryption system, including:
  • the acquisition and encoding module is used to collect video data and audio data, and to encode the collected video data and audio data to form an rtmp stream;
  • the first judgment module is used to add an encryption flag field encrypt to the rtmp metadata data element, According to the encryption flag field encrypt, it is determined whether the encryption setting of the rtmp stream is effective;
  • the rtmp stream encryption module is used to separately perform the respective operations on the video data and audio data of the rtmp stream when the encryption setting takes effect.
  • Encryption by means of byte obfuscation Encryption by means of byte obfuscation; an rtmp stream upload module for uploading the encrypted rtmp stream to the multimedia server; an rtmp stream reading module for reading the encrypted rtmp stream through the client of the multimedia server;
  • the second judgment module is used to read the encryption flag bit field encrypt in the rtmp metadata data element and judge whether the encryption setting of the rtmp stream is valid;
  • the rtmp stream decryption module is used to perform the encryption setting when the encryption setting takes effect , Decrypt the encrypted rtmp stream after reading;
  • the rtmp stream decoding module is used to decode the decrypted rtmp stream to obtain a clear rtmp stream.
  • the present application also provides an electronic device, which includes a memory, a processor, and a camera, the memory includes an rtmp-based audio and video data encryption and decryption program, and the rtmp-based audio
  • the video data encryption and decryption program is executed by the processor, the following steps are implemented:
  • the present application also provides a computer-readable storage medium, the computer-readable storage medium includes an rtmp-based audio and video data encryption and decryption program, the rtmp-based audio and video data encryption and decryption program is When the processor is executed, any step in the method for encrypting and decrypting audio and video data as described above is realized.
  • the rtmp-based audio and video data encryption and decryption method, electronic device, and computer-readable storage medium proposed in this application encrypt the rtmp stream by using byte obfuscation on H.264 video data and AAC audio data; playing on the client
  • the terminal obtains the encrypted rtmp stream, before decoding and playing, the data is complemented by byte obfuscation, and then the XOR specific byte decryption method is used to decrypt the H.264 video data frame I and P in the rtmp stream.
  • the audio specification config in the frame and AAC audio data is decrypted; the encryption and decryption is performed by byte obfuscation, the implementation process is simple, it will not bring additional bandwidth pressure to the server, and the encryption and decryption can be performed without consuming the computing performance of the client.
  • the rtmp stream or the stream address url is intercepted, the picture and sound played out are not valid information, thereby improving the security of the data.
  • FIG. 1 is a schematic diagram of an application environment of a preferred embodiment of a method for encrypting and decrypting audio and video data based on rtmp in this application;
  • FIG. 2 is a schematic diagram of modules of a preferred embodiment of the rtmp-based audio and video data encryption and decryption program in FIG. 1;
  • FIG. 3 is a flowchart of a preferred embodiment of a method for encrypting and decrypting audio and video data based on rtmp according to this application;
  • Figure 4 is a block diagram of the logical structure of the rtmp-based audio and video data encryption and decryption system of this application.
  • This application provides a method for encrypting and decrypting audio and video data based on rtmp, which is applied to an electronic device 1.
  • FIG. 1 it is a schematic diagram of an application environment of a preferred embodiment of a method for encrypting and decrypting audio and video data based on rtmp in this application.
  • the electronic device 1 may be a terminal device with arithmetic function, such as a server, a smart phone, a tablet computer, a portable computer, a desktop computer, and the like.
  • the electronic device 1 includes a processor 12, a memory 11, a camera device 13, a network interface 14, and a communication bus 15.
  • the memory 11 includes at least one type of readable storage medium.
  • the at least one type of readable storage medium may be a non-volatile storage medium such as flash memory, hard disk, multimedia card, card-type memory 11, and the like.
  • the readable storage medium may be an internal storage unit of the electronic device 1, such as a hard disk of the electronic device 1.
  • the readable storage medium may also be the external memory 11 of the electronic device 1, such as a plug-in hard disk or a smart memory card (Smart Media Card, SMC) equipped on the electronic device 1. , Secure Digital (SD) card, Flash Card, etc.
  • SD Secure Digital
  • the readable storage medium of the memory 11 is generally used to store the rtmp-based audio and video data encryption and decryption method program 10 and the like installed in the electronic device 1.
  • the memory 11 can also be used to temporarily store data that has been output or will be output.
  • the processor 12 may be a central processing unit (CPU), a microprocessor or other data processing chip, which is used to run program codes or process data stored in the memory 11, such as performing character emotion analysis. Procedure 10 and so on.
  • CPU central processing unit
  • microprocessor or other data processing chip, which is used to run program codes or process data stored in the memory 11, such as performing character emotion analysis. Procedure 10 and so on.
  • the imaging device 13 may be a part of the electronic device 1 or may be independent of the electronic device 1.
  • the electronic device 1 is a terminal device with a camera such as a smart phone, a tablet computer, or a portable computer, and the camera device 13 is the camera of the electronic device 1.
  • the electronic device 1 may be a server, and the camera device 13 is independent of the electronic device 1 and is connected to the electronic device 1 via a network.
  • the camera device 13 is installed in a specific place, such as an office. , Monitoring area, real-time shooting of the target entering the specific place to obtain real-time images, and the real-time images obtained by shooting are transmitted to the processor 12 through the network.
  • the network interface 14 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface), and is generally used to establish a communication connection between the electronic device 1 and other electronic devices.
  • the communication bus 15 is used to realize connection and communication between these components.
  • Fig. 1 only shows the electronic device 1 with components 11-15, but it should be understood that it is not required to implement all of the illustrated components, and more or fewer components may be implemented instead.
  • the electronic device 1 may also include a user interface, a display, a touch sensor, a radio frequency (RF) circuit, a sensor, an audio circuit, and so on.
  • RF radio frequency
  • the memory 11 as a computer storage medium may include an operating system and an rtmp-based audio and video data encryption and decryption program 10; the processor 12 executes the rtmp-based data stored in the memory 11
  • the audio and video data encryption and decryption program 10 implements the following steps:
  • the video data and audio data of the rtmp stream are respectively encrypted by byte obfuscation;
  • the rtmp metadata data element is the attribute name and value of the code stream, specifically including: video width, video height, video encoding format, video frame rate, audio encoding format, and audio sampling rate.
  • the step of adding an encryption flag field encrypt to the rtmp metadata data element, and judging whether the encryption setting for the rtmp stream is effective according to the encryption flag field encrypt includes the following steps:
  • the video data is H.264 video data, which is formed by encoding and compressing H.264;
  • the audio data is AAC audio data, which is formed by encoding and compressing AAC.
  • the step of separately encrypting the video data and audio data of the rtmp stream in a byte obfuscation manner includes:
  • the first encryption formula is used to confuse the random number single bytes in the I frame and P frame RBSP array of the H.264 video data NAL layer, where the first encryption formula is as follows:
  • NALU[NALU_Length%10] ⁇ NALU[NALU_Length%10+1] ⁇ NALU[11]
  • the random number is NALU_Length% 10;
  • NALU_Length is the total length of the NALU structure.
  • the step of separately encrypting the video data and audio data of the rtmp stream in a byte obfuscation manner further includes:
  • the double-byte header information of each frame of AAC is encrypted by a second encryption formula, where the second encryption formula is as follows:
  • AAC sequence header[2] ⁇ AAC sequence header[2] ⁇ 0xAAAA
  • the AAC sequence header is header information of each frame of the AAC.
  • the step of reading the encrypted rtmp stream for decryption includes:
  • the steps of decrypting the encrypted video data of the rtmp stream include:
  • the first decryption formula is used to decrypt the random number single bytes in the I frame and P frame RBSP array of the H.264 video data NAL layer, where the first decryption formula is as follows:
  • NALU[NALU_Length%10] ⁇ NALU[NALU_Length%10+1] ⁇ NALU[11]
  • the random number is NALU_Length% 10;
  • NALU_Length is the total length of the NALU structure.
  • the step of decrypting the encrypted audio data of the rtmp stream includes:
  • the double-byte header information of each frame of AAC is decrypted by the second decryption formula, where the second decryption formula is as follows:
  • AAC sequence header[2] ⁇ AAC sequence header[2] ⁇ 0xAAAA
  • the AAC sequence header is header information of each frame of the AAC.
  • the electronic device 1 proposed in the above embodiment encrypts the rtmp stream by using byte obfuscation methods on H.264 video data and AAC audio data respectively; the encrypted rtmp stream is obtained at the playback end of the client, and before decoding and playing, it uses
  • the byte obfuscation method takes the complement of the data and then uses the exclusive-or specific byte decryption method to decrypt the I frame and P frame of the H.264 video data data frame in the rtmp stream and the audio specification config in the AAC audio data; in
  • the encryption and decryption by byte obfuscation is simple to implement, does not bring additional bandwidth pressure to the server, and can perform encryption and decryption without consuming the computing performance of the client.
  • even if the rtmp stream or The stream address url is intercepted, and the picture and sound played out are not valid information, thereby improving the security of the data.
  • the rtmp-based audio and video data encryption and decryption program 10 can also be divided into one or more modules, and the one or more modules are stored in the memory 11 and executed by the processor 12 to complete the application .
  • the module referred to in this application refers to a series of computer program instruction segments that can complete specific functions.
  • FIG. 2 it is a program module diagram of a preferred embodiment of the rtmp-based audio and video data encryption and decryption program 10 in FIG. 1.
  • the rtmp-based audio and video data encryption and decryption program 10 can be divided into: a collection and encoding module 110, a first judgment module 120, an rtmp stream encryption module 130, an rtmp stream upload module 140, an rtmp stream read module 150, and a second judgment Module 160, rtmp stream decryption module 170, and rtmp stream decoding module 180.
  • the functions or operation steps implemented by the modules 110-180 are all similar to the above, and will not be described in detail here. Illustratively, for example, where:
  • the collection and encoding module 110 is used to collect video data and audio data, and encode the collected video data and audio data to form an rtmp stream;
  • the first judgment module 120 is configured to add an encryption flag bit field encrypt to the rtmp metadata data element, and judge whether the encryption setting for the rtmp stream is effective according to the encryption flag bit field encrypt;
  • the rtmp stream encryption module 130 is configured to encrypt the video data and audio data of the rtmp stream by byte obfuscation if the encryption setting takes effect;
  • the rtmp stream upload module 140 is used to upload the encrypted rtmp stream to the multimedia server;
  • the rtmp stream reading module 150 is configured to read the encrypted rtmp stream through the client terminal of the multimedia server;
  • the second judgment module 160 is configured to read the encryption flag bit field encrypt in the rtmp metadata data element, and judge whether the encryption setting of the rtmp stream is valid;
  • the rtmp stream decryption module 170 is used to decrypt the encrypted rtmp stream if the encryption setting takes effect;
  • the rtmp stream decoding module 180 is used to decode the decrypted rtmp stream to obtain a clear rtmp stream.
  • this application also provides a method for encrypting and decrypting audio and video data based on rtmp.
  • FIG. 3 it is a flowchart of a preferred embodiment of a method for encrypting and decrypting audio and video data based on rtmp according to this application.
  • the method can be executed by a device, and the device can be implemented by software and/or hardware.
  • the method for encrypting and decrypting audio and video data based on rtmp includes: step S10 to step S70.
  • Step S10 Collect video data and audio data, and encode the collected video data and audio data to form an rtmp stream;
  • Step S20 Add an encryption flag field encrypt to the rtmp metadata data element, and judge whether the encryption setting for the rtmp stream is effective according to the encryption flag field encrypt;
  • Step S30 If the encryption setting is effective, the video data and audio data of the rtmp stream are respectively encrypted by byte obfuscation;
  • Step S40 Upload the encrypted rtmp stream to the multimedia server, and read the encrypted rtmp stream through the client terminal of the multimedia server;
  • Step S50 Read the encryption flag field encrypt in the rtmp metadata data element, and determine whether the encryption setting of the rtmp stream is effective;
  • Step S60 if the encryption setting takes effect, decrypt the encrypted rtmp stream after reading;
  • Step S70 Decode the decrypted rtmp stream to obtain a clear rtmp stream.
  • the use of the encryption and decryption method of this application is mainly based on the following considerations: 1.
  • the client side uses a variety of soft and hard coding methods for streaming, which is inconvenient to encrypt and encode process parameters.
  • the streaming protocol adopts the popular public real-time message transmission protocol, and CDN (Content Delivery Network) does not support the real-time message transmission protocol. Processing at the protocol layer will affect CDN distribution. 3. If the SPS (Software Product Specification, Chinese name: Software Product Specification) and PPS (Programmable Power Supply, Chinese name: Fast Charging Technical Specification) header information is encrypted, the CDN will record and transcode errors, which is not easy to distinguish and extract errors. 4. Try not to encrypt every audio and video data to avoid encryption consuming client computing performance.
  • this application adopts steps S10 to S70 to solve the above-mentioned problems.
  • the collected video data refers to image data collected from data input sources such as camera devices, files, screens, etc., and the image data is expressed in yuv or rgb format.
  • image data can compose video data.
  • the collected audio data refers to the audio data collected from data input sources such as microphones and files, and the format of the audio data is pcm.
  • encoding the collected data refers to encoding audio data and video data.
  • Encoding video data is to compress video pixel data (rgb, yuv, etc.) into a video stream, thereby reducing the amount of video data and saving video storage and transmission bandwidth.
  • H.264 is one of the video encoding compression schemes. The application uses the H.264 video coding and compression scheme.
  • H.264 is a high-performance video coding and decoding technology. It is a new digital video coding standard formulated by the Joint Video Team (JVT) jointly established by two organizations, so it is both an ITU- T’s H.264 is also ISO/IEC’s MPEG-4 Advanced Video Coding (AVC).
  • JVT Joint Video Team
  • Encoding audio data is to compress audio sample data (pcm, etc.) into an audio code stream, thereby reducing the amount of audio data and saving audio storage and transmission bandwidth.
  • AAC is one of the audio coding compression schemes, which is used in this application It is the AAC audio coding compression scheme.
  • AAC Advanced Audio Coding, Chinese name: Advanced Audio Coding
  • the video data transmitted by rtmp (real time messaging protocol, the Chinese name is: Real-time Information Transmission Protocol) is encoded and compressed using H.264, and the transmitted audio data is encoded and compressed using AAC.
  • rtmp is a protocol
  • the rtmp stream refers to a live stream, including the transmitted video data and audio data, that is, the video data and audio data are encapsulated into a playable rtmp stream.
  • the content encapsulated by rtmp includes metadata and encoded video data and audio data.
  • the rtmp protocol usually encapsulates the metadata first, and then encapsulates the encoded video data and audio data.
  • Metadata is generally the name and value of some attributes of the stream, such as video width and height, video encoding format, video frame rate, audio encoding format, audio sampling rate, and so on.
  • the step of adding an encryption flag field encrypt to the rtmp metadata data element, and judging whether the encryption setting for the rtmp stream is effective according to the encryption flag field encrypt includes the following steps:
  • step S30 the encoded rtmp stream is encrypted, where the encryption method is byte obfuscation, and some data is XORed with specific bytes and then complemented.
  • the encryption method is byte obfuscation
  • some data is XORed with specific bytes and then complemented.
  • this part of the data refers to the data whose RBSP data subscript is NALU_Length%10 in the NALU structure.
  • this part of data refers to the data whose subscript is 2 in the header information of each frame.
  • the first encryption formula is used to confuse the random number single byte in the I frame and P frame RBSP array of the NAL layer of the H.264 encoded data, where the random number is NALU_Length%10.
  • the first encryption formula is as follows:
  • NALU[NALU_Length%10] ⁇ (NALU[NALU_Length%10+1] ⁇ NALU[11])
  • H.264 is a new digital video coding standard developed by the joint video team (JVT: joint video team) of VCEG (Video Coding Expert Group) of ITU-T and MPEG (Moving Picture Coding Expert Group) of ISO/IEC.
  • JVT joint video team
  • VCEG Video Coding Expert Group
  • MPEG Motion Picture Coding Expert Group
  • H.264 compressed and encoded data is composed of NALU one after another, and its function is divided into two layers: video coding layer (VCL, Video Coding Layer) and network abstraction layer (NAL, Network Abstraction Layer).
  • VCL Video Coding Layer
  • NAL Network Abstraction Layer
  • VCL data is the output of the encoding process, which represents the video data sequence after compression encoding.
  • the encoded VCL data is first mapped or encapsulated into a NAL unit (hereinafter referred to as NALU, Nal Unit).
  • NALU NAL unit
  • Each NALU includes a raw byte sequence payload (RBSP, Raw Byte Sequence Payload) and a set of NALU header information corresponding to video encoding.
  • the video encryption formula is explained as follows: Encrypt and modify the data with the RBSP data subscript as NALU_Length%10 in the NALU structure, where NALU_Length is the total length of the NALU structure, and the data is modified to its next data ( Subscript +1) and subscript 11 data are XORed and then inverted.
  • the second encryption formula for the audio data of the rtmp stream is as follows:
  • AAC sequence header[2] ⁇ AAC sequence header[2] ⁇ 0xAAAA
  • the AAC sequence header is header information of each frame of the AAC.
  • the audio encryption formula is used to encrypt the audio data after each audio data frame is compressed and encoded by AAC.
  • AAC Advanced Audio Coding
  • Chinese name: Advanced Audio Coding appeared in 1997, based on MPEG-2 audio coding technology. It was jointly developed by Fraunhofer IIS, Dolby Laboratories, AT&T, Sony and other companies to replace the MP3 format.
  • the header information of each frame of AAC is AAC sequence header.
  • the encryption formula is explained as follows.
  • the data with subscript 2 of the header information of each frame is encrypted and modified, and its value becomes the original value and the hexadecimal number 0xAAAA After the XOR of the inverted value.
  • step S50 when the user starts to pull the rtmp stream, read the encryption flag field encrypt in rtmp meta data; determine that the rtmp meta data encryption flag field encrypt is valid, decrypt the encoded data, and realize the dynamic judgment of the encryption and decryption status; the specific process as follows:
  • step S60 if the encryption is effective, decrypt the encrypted rtmp stream; the decryption of the encrypted rtmp stream includes: decrypting the encrypted video data of the rtmp stream, and decrypting the encrypted rtmp stream The audio data of the rtmp stream is decrypted.
  • the decryption method is to use byte obfuscation, and the data is complemented and then exclusive or specific bytes are used.
  • this part of the data refers to the data whose RBSP data subscript is NALU_Length%10 in the NALU structure.
  • this part of data refers to the data whose subscript is 2 in the header information of each frame.
  • the first decryption formula is used to decrypt the random number single bytes in the I frame and P frame RBSP array of the NAL layer of the H.264 encoded data, where the first decryption formula is as follows:
  • NALU[NALU_Length%10] ⁇ NALU[NALU_Length%10+1] ⁇ NALU[11]
  • NALU_Length is the total length of the NALU structure. Modify the data whose RBSP data subscript in the NALU structure is NALU_Length%10, where NALU_Length represents the length of the NALU data. Modified to the next data (subscript + 1) after the inverted value XOR the result of the RBSP data with subscript 11.
  • the double-byte header information of each frame of AAC is decrypted by the second decryption formula, where the second decryption formula is as follows:
  • AAC sequence header[2] ⁇ AAC sequence header[2] ⁇ 0xAAAA
  • the AAC sequence header is header information of each frame of the AAC.
  • the data with subscript 2 of the header information of each frame is decrypted and modified, and its value becomes the result of the exclusive OR hexadecimal number 0xAAAA after the original value is reversed.
  • decoding refers to an operation of decompressing compressed audio and video data.
  • Decoding is an inverse process of encoding, similar to compression and decompression.
  • Video decoding is to decompress the video stream into video pixel data (rgb or yuv format).
  • hardware decoding some device clients have hardware decoders, which can be used to decode the video Decoding
  • software decoding open source third-party libraries such as ffmpeg can be used for software decoding.
  • Audio decoding is to decompress the audio code stream into audio sample data (pcm format). Audio decoding can also be decoded in two ways: hardware decoding (some device clients have a hardware decoder, which can be used to decode the video); software decoding (open source third-party libraries such as ffmpeg can be used for software decoding.
  • the method for encrypting and decrypting audio and video data based on rtmp encrypts the rtmp stream by using byte obfuscation on H.264 video data and AAC audio data respectively; the encrypted rtmp stream is obtained at the playback end of the client, Before decoding and playing, the data is complemented by byte obfuscation, and then the decryption method of XOR specific bytes is used to decrypt the I frame and P frame of the H.264 video data in the rtmp stream and the audio in the AAC audio data.
  • the specification config is decrypted; in the embodiment of this application, the encryption and decryption is performed through byte obfuscation, which is simple to implement, does not bring additional bandwidth pressure to the server, and can perform encryption and decryption without consuming client computing performance.
  • byte obfuscation which is simple to implement, does not bring additional bandwidth pressure to the server, and can perform encryption and decryption without consuming client computing performance.
  • the picture and sound played out are not valid information, thereby improving the security of the data.
  • this application also provides an rtmp-based audio and video data encryption and decryption system, the logical structure of which corresponds to the segmented structure of the aforementioned rtmp-based audio and video data encryption and decryption program 10.
  • Figure 4 shows the logical framework of the rtmp-based audio and video data encryption and decryption system according to this embodiment.
  • the system also corresponds to the rtmp-based audio and video data encryption and decryption method, and can be set in an rtmp-based audio and video data encryption and decryption electronic device in.
  • the rtmp-based audio and video data encryption and decryption system includes a collection and encoding module 110, a first judgment module 120, an rtmp stream encryption module 130, an rtmp stream upload module 140, an rtmp stream reading module 150, and a second judgment Module 160, rtmp stream decryption module 170, and rtmp stream decoding module 180.
  • the functions or operation steps implemented by the modules 110-180 are the same as those of the collection and encoding module 110, the first judgment module 120, the rtmp stream encryption module 130, the rtmp stream upload module 140, the rtmp stream read module 150, and the second judgment of the foregoing embodiment.
  • Module 160, rtmp stream decryption module 170, and rtmp stream decoding module 180 The functions or operation steps implemented by the modules 110-180 are similar to the above.
  • the collection and encoding module 110 is used to collect video data and audio data, and encode the collected video data and audio data to form an rtmp stream;
  • the first judgment module 120 is configured to add an encryption flag bit field encrypt to the rtmp metadata data element, and judge whether the encryption setting for the rtmp stream is effective according to the encryption flag bit field encrypt;
  • the rtmp stream encryption module 130 is configured to encrypt the video data and audio data of the rtmp stream in a byte obfuscation manner when the encryption setting takes effect;
  • the rtmp stream upload module 140 is used to upload the encrypted rtmp stream to the multimedia server;
  • the rtmp stream reading module 150 is configured to read the encrypted rtmp stream through the client terminal of the multimedia server;
  • the second judgment module 160 is configured to read the encryption flag bit field encrypt in the rtmp metadata data element, and judge whether the encryption setting of the rtmp stream is valid;
  • the rtmp stream decryption module 170 is configured to decrypt the encrypted rtmp stream when the encryption setting is in effect;
  • the rtmp stream decoding module 180 is used to decode the decrypted rtmp stream to obtain a clear rtmp stream.
  • the video data collected by the collection and coding module is image data in yuv or rgb format collected from the data input source; the audio data collected by the collection and coding module is the audio data in pcm format collected from the data input source.
  • the video data is video data formed by encoding and compressing using H.264; the audio data is audio data formed by encoding and compressing using AAC.
  • the rtmp metadata data element is the attribute name and value of the stream, which can include: video width, video height, video encoding format, video frame rate, audio encoding format, and audio sampling rate.
  • the rtmp stream encryption module uses the first encryption formula to confuse the random number single bytes in the I frame and P frame RBSP array of the H.264 video data NAL layer, where:
  • the first encryption formula is as follows:
  • NALU[NALU_Length%10] ⁇ (NALU[NALU_Length%10+1] ⁇ NALU[11])
  • the random number is NALU_Length% 10;
  • NALU_Length is the total length of the NALU structure.
  • the encryption module encrypts the double-byte header information of each frame of the AAC using a second encryption formula, where the second encryption formula is as follows:
  • AAC sequence header[2] ⁇ AAC sequence header[2] ⁇ 0xAAAA
  • the AAC sequence header is header information of each frame of the AAC.
  • the rtmp stream decryption module respectively decrypts the encrypted video data of the rtmp stream and the encrypted audio data of the rtmp stream;
  • the rtmp stream decryption module uses the first decryption formula to decrypt the random number single bytes in the I frame and P frame RBSP array of the H.264 video data NAL layer, where the first decryption formula is as follows:
  • NALU[NALU_Length%10] ⁇ NALU[NALU_Length%10+1] ⁇ NALU[11]
  • the random number is NALU_Length% 10;
  • NALU_Length is the total length of the NALU structure.
  • the rtmp stream decryption module decrypts the double-byte header information of each frame of AAC through the second decryption formula, where the second decryption formula is as follows:
  • AAC sequence header[2] ⁇ AAC sequence header[2] ⁇ 0xAAAA
  • AAC sequence header is the header information of each frame of AAC.
  • the data with subscript 2 of the header information of each frame is decrypted and modified, and its value becomes the result of the exclusive OR hexadecimal number 0xAAAA after the original value is reversed.
  • the rtmp-based audio and video data encryption and decryption system proposed in the above embodiment uses byte obfuscation to encrypt and decrypt, the implementation process is simple, does not bring additional bandwidth pressure to the server, and can be encrypted without consuming client computing performance Decryption, in addition, even if the rtmp stream or the stream address url is intercepted, the picture and sound played out are not valid information, thereby improving the security of the data.
  • an embodiment of the present application also proposes a computer-readable storage medium, the computer-readable storage medium includes an rtmp-based audio and video data encryption and decryption program, and the rtmp-based audio and video data encryption and decryption sequence is executed by a processor When realizing the steps of the rtmp-based audio and video data encryption and decryption method as described above.
  • the specific implementation of the computer-readable storage medium of the present application is substantially the same as the specific implementation of the rtmp-based audio and video data encryption and decryption method, system, and electronic device, and will not be repeated here.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

一种基于rtmp的音视频数据加解密方法、装置及可读存储介质,涉及数据处理技术领域,其中方法包括:采集视频数据和音频数据,并将采集到的视频数据和音频数据进行编码,形成rtmp流(S10);在rtmp meta data添加加密标志位字段encrypt,判断加密设置是否生效(S20);如果加密设置生效,对rtmp流的视频数据和音频数据分别采用字节混淆的方式加密(S30);读取加密后的rtmp流(S40);读取rtmp meta data中的加密标志位字段encrypt,判断加密设置是否生效(S50);如果加密设置生效,对读取加密后的rtmp流进行解密(S60);对解密后的rtmp流进行解码,获取清晰的rtmp流(S70)。通过对视频数据和音频数据分别使用字节混淆方式进行加密,能够解决加密方式复杂以及避免视频流被盗取造成数据安全性低的问题。

Description

基于rtmp的音视频数据加解密方法、装置及可读存储介质
本申请要求申请号为201910978214.9,申请日为2019年10月15日,发明创造名称为“基于rtmp的音视频数据加解密方法、装置及可读存储介质”的专利申请的优先权。
技术领域
本申请涉及数据处理技术领域,尤其涉及一种基于rtmp的音视频数据加解密方法、系统、装置及可读存储介质。
背景技术
在各种业务场景下,例如直播时主播在推送rtmp(Real Time Messaging Protocol,实时消息传输协议)多媒体流的过程中,流地址很容易被明文获取,或者被黑客使用破解手段获取到,并使用第三方工具直接播放,存在被窃听风险,对企业直播运营、营收等方面造成巨大损失。
申请人意识到,现在常规的rtmp防盗播的解决方案有如下几种:
1、防盗链:给rtmp url增加相关参数,rtmp server根据参数做验证,缺陷在于,没有对传输的音视频数据包做加密,只要截取到rtmp包解析后就能解码播放。
2、使用rtmp加密协议rtmpe协议,不足之处在于,要求用户自行搭流媒体服务器平台,增加系统复杂度,数据不能缓存,用户每次播放都要占用服务器带宽,不容易结合CDN加速,增加服务器带宽压力。
3、使用分布式编码技术,将视频物理分片,每一片视频采用不同的加密算法,同一个视频片段能同时使用多种加密算法混合型加密;不足之处在于,加密过程过于复杂,增加实现难度,并且还会增加每一个视频帧的传输前的处理时间,消耗客户端计算性能。
基于上述问题,亟需一种能够避免被盗取并且加减密过程简单的方法。
发明内容
本申请提供一种音视频数据加解密方法、系统、电子装置及可读存储介质及可读存储介质,其主要目的在于通过对视频数据和音频数据分别使用字 节混淆方式进行加密,能够解决加密方式复杂以及避免视频流被盗取造成数据安全性低的问题。
为实现上述目的,本申请提供一种音视频数据加解密方法,包括:
采集视频数据和音频数据,并将采集到的视频数据和音频数据进行编码,形成rtmp流;在rtmp meta data数据元添加加密标志位字段encrypt,并根据加密标志位字段encrypt判断对所述rtmp流的加密设置是否生效;如果加密设置生效,对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密;将加密后的rtmp流上传至多媒体服务器,通过所述多媒体服务器的客户端读取加密后的rtmp流;读取rtmp meta data数据元中的加密标志位字段encrypt,并判断所述rtmp流的加密设置是否生效;如果加密设置生效,对读取加密后的rtmp流进行解密;对解密后的rtmp流进行解码,获取清晰的rtmp流。
为实现上述目的,本申请提供一种音视频数据加解密系统,包括:
采集编码模块,用于采集视频数据和音频数据,并将采集到的视频数据和音频数据进行编码,形成rtmp流;第一判断模块,用于在rtmp meta data数据元添加加密标志位字段encrypt,并根据所述加密标志位字段encrypt判断对所述rtmp流的加密设置是否生效;rtmp流加密模块,用于在所述加密设置生效的情况下,对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密;rtmp流上传模块,用于将加密后的rtmp流上传至多媒体服务器;rtmp流读取模块,用于通过所述多媒体服务器的客户端读取加密后的rtmp流;第二判断模块,用于读取rtmp meta data数据元中的加密标志位字段encrypt,并判断所述rtmp流的加密设置是否生效;rtmp流解密模块,用于在所述加密设置生效的情况下,对读取加密后的rtmp流进行解密;rtmp流解码模块,用于对解密后的rtmp流进行解码,获取清晰的rtmp流。
此外,为实现上述目的,本申请还提供一种电子装置,该电子装置包括:存储器、处理器及摄像装置,所述存储器中包括基于rtmp的音视频数据加解密程序,所述基于rtmp的音视频数据加解密程序被所述处理器执行时实现如下步骤:
采集视频数据和音频数据,并将采集到的视频数据和音频数据进行编码,形成rtmp流;在rtmp meta data数据元添加加密标志位字段encrypt,并根据加密标志位字段encrypt判断对所述rtmp流的加密设置是否生效;如果加密设 置生效,对rtmp流的视频数据和音频数据分别采用字节混淆的方式加密;将加密后的rtmp流上传至多媒体服务器,通过所述多媒体服务器的客户端读取加密后的rtmp流;读取rtmp meta data数据元中的加密标志位字段encrypt,并判断所述rtmp流的加密设置是否生效;如果加密设置生效,对读取加密后的rtmp流进行解密;对解密后的rtmp流进行解码,获取清晰的rtmp流。
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中包括基于rtmp的音视频数据加解密程序,所述基于rtmp的音视频数据加解密程序被处理器执行时,实现如上所述的音视频数据加解密方法中的任意步骤。
本申请提出的基于rtmp的音视频数据加解密方法、电子装置及计算机可读存储介质,通过对H.264视频数据和AAC音频数据分别使用字节混淆方式对rtmp流进行加密;在客户端播放端获取加密后的rtmp流,进行解码播放前,采用字节混淆方式对数据取补码后再采用异或特定字节的解密方法对rtmp流中的H.264视频数据数据帧I帧、P帧以及AAC音频数据中的audio specification config进行解密;通过字节混淆方式加解密,实现过程简单,不会对服务器带来额外的带宽压力,并且不需要消耗客户端计算性能就能进行加密解密,此外,即使rtmp流或者流地址url被截取,播放出来的画面和声音都不是有效的信息,从而提高数据的安全性。
附图说明
图1为本申请基于rtmp的音视频数据加解密方法较佳实施例的应用环境示意图;
图2为图1中基于rtmp的音视频数据加解密程序较佳实施例的模块示意图;
图3为本申请基于rtmp的音视频数据加解密方法较佳实施例的流程图;
图4为本申请基于rtmp的音视频数据加解密系统的逻辑结构框图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请提供一种基于rtmp的音视频数据加解密方法,应用于一种电子装 置1。参照图1所示,为本申请基于rtmp的音视频数据加解密方法较佳实施例的应用环境示意图。
在本实施例中,电子装置1可以是服务器、智能手机、平板电脑、便携计算机、桌上型计算机等具有运算功能的终端设备。
该电子装置1包括:处理器12、存储器11、摄像装置13、网络接口14及通信总线15。
存储器11包括至少一种类型的可读存储介质。所述至少一种类型的可读存储介质可为如闪存、硬盘、多媒体卡、卡型存储器11等的非易失性存储介质。在一些实施例中,所述可读存储介质可以是所述电子装置1的内部存储单元,例如该电子装置1的硬盘。在另一些实施例中,所述可读存储介质也可以是所述电子装置1的外部存储器11,例如所述电子装置1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。
在本实施例中,所述存储器11的可读存储介质通常用于存储安装于所述电子装置1的基于rtmp的音视频数据加解密方法程序10等。所述存储器11还可以用于暂时地存储已经输出或者将要输出的数据。
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU),微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行人物情绪分析程序10等。
摄像装置13既可以是所述电子装置1的一部分,也可以独立于电子装置1。在一些实施例中,所述电子装置1为智能手机、平板电脑、便携计算机等具有摄像头的终端设备,则所述摄像装置13即为所述电子装置1的摄像头。在其他实施例中,所述电子装置1可以为服务器,所述摄像装置13独立于该电子装置1、与该电子装置1通过网络连接,例如,该摄像装置13安装于特定场所,如办公场所、监控区域,对进入该特定场所的目标实时拍摄得到实时图像,通过网络将拍摄得到的实时图像传输至处理器12。
网络接口14可选地可以包括标准的有线接口、无线接口(如WI-FI接口),通常用于在该电子装置1与其他电子设备之间建立通信连接。
通信总线15用于实现这些组件之间的连接通信。
图1仅示出了具有组件11-15的电子装置1,但是应理解的是,并不要求 实施所有示出的组件,可以替代的实施更多或者更少的组件。
可选地,该电子装置1还可以包括用户接口、显示器、触摸传感器以及射频(Radio Frequency,RF)电路,传感器、音频电路等等。
在图1所示的装置实施例中,作为一种计算机存储介质的存储器11中可以包括操作系统、以及基于rtmp的音视频数据加解密程序10;处理器12执行存储器11中存储的基于rtmp的音视频数据加解密程序10时实现如下步骤:
通过摄像装置13采集视频数据和音频数据,并将采集到的视频数据和音频数据进行编码,形成rtmp流;
在rtmp meta data数据元添加加密标志位字段encrypt,并根据所述加密标志位字段encrypt判断对所述rtmp流的加密设置是否生效;
如果加密设置生效,对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密;
将加密后的rtmp流上传至多媒体服务器,通过所述多媒体服务器的客户端读取加密后的rtmp流;
读取rtmp meta data数据元中的加密标志位字段encrypt,并判断所述rtmp流的加密设置是否生效;
如果加密设置生效,对读取加密后的rtmp流进行解密;
对解密后的rtmp流进行解码,获取清晰的rtmp流。
其中,优选地,所述rtmp meta data数据元为码流的属性名称及其值,具体包括:视频宽、视频高、视频编码格式、视频帧率、音频编码格式、音频采样率。
优选地,所述在rtmp meta data数据元添加加密标志位字段encrypt,并根据所述加密标志位字段encrypt判断对所述rtmp流的加密设置是否生效的步骤包括如下:
在rtmp meta data数据元添加加密标志位字段encrypt;
若所述加密标志位字段encrypt为true,对所述rtmp流的加密设置则生效;
若所述加密标志位字段encrypt为false,对所述rtmp流的加密设置则不生效。
优选地,所述视频数据为H.264视频数据,采用H.264进行编码压缩形成的;
所述音频数据为AAC音频数据,采用AAC进行编码压缩形成的。
优选地,对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密的步骤包括:
通过第一加密公式对H.264视频数据NAL层的I帧及P帧RBSP数组中的随机数个位单字节进行混淆,其中,所述第一加密公式如下:
NALU[NALU_Length%10]=~NALU[NALU_Length%10+1]^NALU[11]
其中,随机数为NALU_Length%10;
NALU_Length为NALU结构体的总长度。
优选地,对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密的步骤还包括:
通过第二加密公式对AAC每一帧的头部信息双字节进行加密,其中,所述第二加密公式如下:
AAC sequence header[2]=~AAC sequence header[2]^0xAAAA
其中,所述AAC sequence header为所述AAC每一帧的头部信息。
优选地,所述读取加密后的rtmp流进行解密的步骤包括:
对加密后的rtmp流的视频数据进行解密,以及,对加密后的rtmp流的音频数据进行解密;
其中,对加密后的rtmp流的视频数据进行解密的步骤包括:
通过第一解密公式对H.264视频数据NAL层的I帧及P帧RBSP数组中的随机数个位单字节进行解密,其中,所述第一解密公式如下:
NALU[NALU_Length%10]=~NALU[NALU_Length%10+1]^NALU[11]
其中,随机数为NALU_Length%10;
NALU_Length为NALU结构体的总长度。
优选地,所述对加密后的rtmp流的音频数据进行解密的步骤包括:
通过第二解密公式对AAC每一帧的头部信息双字节进行解密,其中,所述第二解密公式如下:
AAC sequence header[2]=~AAC sequence header[2]^0xAAAA
其中,所述AAC sequence header为所述AAC每一帧的头部信息。
上述实施例提出的电子装置1,通过对H.264视频数据和AAC音频数据分别使用字节混淆方式对rtmp流进行加密;在客户端播放端获取加密后的 rtmp流,进行解码播放前,采用字节混淆方式对数据取补码后再采用异或特定字节的解密方法对rtmp流中的H.264视频数据数据帧I帧、P帧以及AAC音频数据中的audio specification config进行解密;在本申请的实施例中,通过字节混淆方式加解密,实现过程简单,不会对服务器带来额外的带宽压力,并且不需要消耗客户端计算性能就能进行加密解密,此外,即使rtmp流或者流地址url被截取,播放出来的画面和声音都不是有效的信息,从而提高数据的安全性。
在其他实施例中,基于rtmp的音视频数据加解密程序10还可以被分割为一个或者多个模块,一个或者多个模块被存储于存储器11中,并由处理器12执行,以完成本申请。本申请所称的模块是指能够完成特定功能的一系列计算机程序指令段。参照图2所示,为图1中基于rtmp的音视频数据加解密程序10较佳实施例的程序模块图。所述基于rtmp的音视频数据加解密程序10可以被分割为:采集编码模块110、第一判断模块120、rtmp流加密模块130、rtmp流上传模块140、rtmp流读取模块150、第二判断模块160、rtmp流解密模块170和rtmp流解码模块180。所述模块110-180所实现的功能或操作步骤均与上文类似,此处不再详述,示例性地,例如其中:
采集编码模块110,用于采集视频数据和音频数据,并将采集到的视频数据和音频数据进行编码,形成rtmp流;
第一判断模块120,用于在rtmp meta data数据元添加加密标志位字段encrypt,并根据所述加密标志位字段encrypt判断对所述rtmp流的加密设置是否生效;
rtmp流加密模块130,用于如果加密设置生效,对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密;
rtmp流上传模块140,用于将加密后的rtmp流上传至多媒体服务器;
rtmp流读取模块150,用于通过所述多媒体服务器的客户端读取加密后的rtmp流;
第二判断模块160,用于读取rtmp meta data数据元中的加密标志位字段encrypt,并判断所述rtmp流的加密设置是否生效;
rtmp流解密模块170,用于如果加密设置生效,对读取加密后的rtmp流进行解密;
rtmp流解码模块180,用于对解密后的rtmp流进行解码,获取清晰的rtmp流。
此外,本申请还提供一种基于rtmp的音视频数据加解密方法。参照图3所示,为本申请基于rtmp的音视频数据加解密方法较佳实施例的流程图。该方法可以由一个装置执行,该装置可以由软件和/或硬件实现。
在本实施例中,基于rtmp的音视频数据加解密方法包括:步骤S10-步骤S70。
步骤S10:采集视频数据和音频数据,并将采集到的视频数据和音频数据进行编码,形成rtmp流;
步骤S20:在rtmp meta data数据元添加加密标志位字段encrypt,并根据加密标志位字段encrypt判断对rtmp流的加密设置是否生效;
步骤S30:如果加密设置生效,对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密;
步骤S40:将加密后的rtmp流上传至多媒体服务器,通过所述多媒体服务器的客户端读取加密后的rtmp流;
步骤S50:读取rtmp meta data数据元中的加密标志位字段encrypt,并判断所述rtmp流的加密设置是否生效;
步骤S60:如果加密设置生效,对读取加密后的rtmp流进行解密;
步骤S70:对解密后的rtmp流进行解码,获取清晰的rtmp流。
采用本申请的加解密方法主要基于以下原因的考虑:1.客户端推流采用多种软硬编码方式,不便于加密编码过程参数。2.流传输协议采用现在流行的公有实时消息传输协议,且CDN(Content Delivery Network,内容分发网络)不支持实时消息传输协议协议,在协议层处理会影响CDN分发。3.如果加密SPS(Software Product Specification,中文名称:软件产品规格说明)和PPS(Programmable Power Supply,中文名称:快速充电技术规范)头信息会CDN录制转码生成错误,不便于区分错误及提取。4.尽量不要对每个音视频数据都进行加密,避免加密消耗客户端计算性能。
基于上述问题,本申请采用步骤S10至步骤S70解决上述问题。
在步骤S10中,采集的视频数据是指从摄像装置、文件、屏幕等数据输入源采集到的图像数据,该图像数据是yuv或rgb格式表示的。若干个图像数 据就能组成视频数据。采集的音频数据是指从麦克风、文件等数据输入源采集到的音频数据,该音频数据的格式是pcm。
其中,对采集出来的数据进行编码,是指对音频数据和视频数据进行编码。对视频数据进行编码是对视频像素数据(rgb,yuv等)压缩成视频码流,从而降低视频的数据量,节省视频存储和传输带宽,而H.264就是其中一种视频编码压缩方案,本申请采用的就是H.264视频编码压缩方案。
其中,需要说明的是,H.264是一种高性能的视频编解码技术,它是由两个组织联合组建的联合视频组(JVT)共同制定的新数字视频编码标准,所以它既是ITU-T的H.264,又是ISO/IEC的MPEG-4高级视频编码(Advanced Video Coding,AVC)。
对音频数据进行编码是是对音频采样数据(pcm等)压缩成为音频码流,从而降低音频的数据量,节省音频存储和传输带宽,而AAC就是其中一种音频编码压缩方案,本申请采用的就是AAC音频编码压缩方案。
其中,需要说明的是,AAC(Advanced Audio Coding,中文名称:高级音频编码),最早出现于1997年,基于MPEG-2的音频编码技术,在2000年MPEG-4标准出现后,AAC重新集成了其特性,加入了SBR技术和PS技术,为了区别于传统的MPEG-2,AAC又称为MPEG-4AAC。
其中,rtmp(real time messaging protocol,中文名称为:实时信息传输协议)传输的视频数据就是使用H.264进行编码压缩的,传输的音频数据就是使用AAC进行编码压缩的。
其中,rtmp是一种协议,rtmp流就是指直播流,包括传输的视频数据和音频数据,也就是说,将视频数据和音频数据封装成可以播放的rtmp流。
在步骤S20中,rtmp封装的内容有meta data元数据以及编码后的视频数据和音频数据,其中,rtmp协议通常情况下会先封装meta data元数据,然后再封装编码后的视频数据和音频数据。meta data元数据一般是码流的一些属性名称及其值,例如视频宽高,视频编码格式,视频帧率、音频编码格式、音频采样率等等。
所述在rtmp meta data数据元添加加密标志位字段encrypt,并根据所述加密标志位字段encrypt判断对所述rtmp流的加密设置是否生效的步骤包括如下:
在rtmp meta data数据元添加加密标志位字段encrypt;
若所述加密meta dataencrypt为true,对所述rtmp流的加密设置则生效;
若所述加密标志位字段encrypt为false,对所述rtmp流的加密设置加密则不生效。
在步骤S30中,对编码后的rtmp流进行加密,其中,加密方式是采用字节混淆的方式,对部分数据采用异或特定字节后取补码。对于视频数据而言,这部分数据是指NALU结构体中RBSP数据下标为NALU_Length%10的数据。对于音频而言,这部分数据是指每一帧的头部信息的下标为2的数据。
对编码后的视频数据加密:
通过第一加密公式对H.264编码数据NAL层的I帧及P帧RBSP数组中的随机数个位单字节进行混淆,其中随机数为NALU_Length%10。第一加密公式如下:
NALU[NALU_Length%10]=~(NALU[NALU_Length%10+1]^NALU[11])
具体地,使用该视频加密公式对每一帧使用H.264压缩编码后的视频进行加密。而H.264是ITU-T的VCEG(视频编码专家组)和ISO/IEC的MPEG(活动图像编码专家组)的联合视频组(JVT:joint video team)开发的一个新的数字视频编码标准。H.264压缩编码数据是有一个接一个的NALU组成的,而它的功能分为两层:视频编码层(VCL,Video Coding Layer)和网络提取层(NAL,Network Abstraction Layer)。
VCL数据即编码处理的输出,它表示被压缩编码后的视频数据序列。在VCL数据传输或存储之前,这些编码的VCL数据,先被映射或封装进NAL单元(以下简称NALU,Nal Unit)中。每个NALU包括一个原始字节序列负荷(RBSP,Raw Byte Sequence Payload)、一组对应于视频编码的NALU头部信息。
基于上述概念介绍后,视频加密公式解释如下:对NALU结构体中RBSP数据下标为NALU_Length%10的数据进行加密修改,其中NALU_Length为NALU结构体的总长度,该数据修改为它下一个数据(下标+1)和下标11的数据进行异或后取反的值。
其中,对rtmp流的音频数据进行加密的方式为:
通过第二加密公式对AAC每一帧的头部信息的下标为2的数据进行加密修改,其值变为原始值和十六进制数0xAAAA的异或后取反的值;
对所述rtmp流的音频数据的第二加密公式如下:
AAC sequence header[2]=~AAC sequence header[2]^0xAAAA
其中,所述AAC sequence header为所述AAC每一帧的头部信息。
使用该音频加密公式对每一个音频数据帧使用AAC压缩编码后的音频数据进行加密。
其中AAC(Advanced Audio Coding),中文名:高级音频编码,出现于1997年,基于MPEG-2的音频编码技术。由Fraunhofer IIS、杜比实验室、AT&T、Sony等公司共同开发,目的是取代MP3格式。
AAC每一帧的头部信息为AAC sequence header,加密公式解释如下,对每一帧的头部信息的下标为2的数据进行加密修改,其值变为原始值和十六进制数0xAAAA的异或后取反的值。
在步骤S50中,用户开始拉rtmp流时,读取rtmp meta data中的加密标志位字段encrypt;判断rtmp meta data加密标志位字段encrypt生效,对编码数据解密,实现动态判断加解密状态;具体过程如下:
读取rtmp meta data中的加密标志位字段encrypt;
若所述加密标志位字段encrypt为true,对所述rtmp流的加密设置则生效;
若所述加密标志位字段encrypt为false,对所述rtmp流的加密设置则不生效。
在步骤S60中,如果加密生效,对读取加密后的rtmp流进行解密;所述对读取加密后的rtmp流进行解密包括:对加密后的rtmp流的视频数据进行解密,以及对加密后的rtmp流的音频数据进行解密。
其中,解密方式是采用字节混淆方式,对数据取补码后再采用异或特定字节。对于视频数据而言,这部分数据是指NALU结构体中RBSP数据下标为NALU_Length%10的数据。对于音频而言,这部分数据是指每一帧的头部信息的下标为2的数据。
对视频数据解密方式为:
通过第一解密公式对H.264编码数据NAL层的I帧及P帧RBSP数组中的随机数个位单字节进行解密,其中,第一解密公式如下:
NALU[NALU_Length%10]=~NALU[NALU_Length%10+1]^NALU[11]
其中,NALU_Length为NALU结构体的总长度。修改NALU结构体中 RBSP数据下标为NALU_Length%10的数据,其中NALU_Length表示NALU数据的长度。修改为下一个数据(下标+1)取反后的值异或下标为11的RBSP数据后的结果。
对音频数据解密方式为:
通过第二解密公式对AAC每一帧的头部信息双字节进行解密,其中,第二解密公式如下:
AAC sequence header[2]=~AAC sequence header[2]^0xAAAA
其中,所述AAC sequence header为所述AAC每一帧的头部信息。对每一帧的头部信息的下标为2的数据进行解密修改,其值变为原始值取反后异或十六进制数0xAAAA的结果。
在步骤S70中,解码是指将音视频压缩后的数据解压缩的操作。解码是编码的一个反过程,类似压缩和解压缩。视频解码是将视频码流解压缩成视频像素数据(rgb或yuv格式),视频解码有两种方式进行解码:硬件解码(有的设备客户端带有硬件解码器,使用该解码器可以对视频进行解码);软件解码(可使用开源的第三方库如ffmpeg进行软件解码)。
音频解码是将音频码流解压缩成音频采样数据(pcm格式)。音频解码也有两种方式进行解码:硬件解码(有的设备客户端带有硬件解码器,使用该解码器可以对视频进行解码);软件解码(可使用开源的第三方库如ffmpeg进行软件解码。
在本申请的实施例中,如果用户直接拉取加密后的rtmp流,不经过解密处理的话,就会出现画面无法辨认,声音无法听到有效信息的现象,从一定程度上保障了rtmp流的安全性。
上述实施例提出的基于rtmp的音视频数据加解密方法,通过对H.264视频数据和AAC音频数据分别使用字节混淆方式对rtmp流进行加密;在客户端播放端获取加密后的rtmp流,进行解码播放前,采用字节混淆方式对数据取补码后再采用异或特定字节的解密方法对rtmp流中的H.264视频数据数据帧I帧、P帧以及AAC音频数据中的audio specification config进行解密;在本申请的实施例中,通过字节混淆方式加解密,实现过程简单,不会对服务器带来额外的带宽压力,并且不需要消耗客户端计算性能就能进行加密解密,此外,即使rtmp流或者流地址url被截取,播放出来的画面和声音都不是有 效的信息,从而提高数据的安全性。
相应的,本申请还提供一种基于rtmp的音视频数据加解密系统,该系统的逻辑结构与前述基于rtmp的音视频数据加解密程序10的分割结构相对应。
图4示出了根据本实施例的基于rtmp的音视频数据加解密系统逻辑框架,该系统也对应于基于rtmp的音视频数据加解密方法,可以设置于基于rtmp的音视频数据加解密电子装置中。
如图4所示,该基于rtmp的音视频数据加解密系统包括采集编码模块110、第一判断模块120、rtmp流加密模块130、rtmp流上传模块140、rtmp流读取模块150、第二判断模块160、rtmp流解密模块170和rtmp流解码模块180。模块110-180所实现的功能或操作步骤均与前述实施例的采集编码模块110、第一判断模块120、rtmp流加密模块130、rtmp流上传模块140、rtmp流读取模块150、第二判断模块160、rtmp流解密模块170和rtmp流解码模块180。所述模块110-180所实现的功能或操作步骤均与上文类似。
比如,采集编码模块110,用于采集视频数据和音频数据,并将采集到的视频数据和音频数据进行编码,形成rtmp流;
第一判断模块120,用于在rtmp meta data数据元添加加密标志位字段encrypt,并根据所述加密标志位字段encrypt判断对所述rtmp流的加密设置是否生效;
rtmp流加密模块130,用于在所述加密设置生效的情况下,对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密;
rtmp流上传模块140,用于将加密后的rtmp流上传至多媒体服务器;
rtmp流读取模块150,用于通过所述多媒体服务器的客户端读取加密后的rtmp流;
第二判断模块160,用于读取rtmp meta data数据元中的加密标志位字段encrypt,并判断所述rtmp流的加密设置是否生效;
rtmp流解密模块170,用于在所述加密设置生效的情况下,对读取加密后的rtmp流进行解密;
rtmp流解码模块180,用于对解密后的rtmp流进行解码,获取清晰的rtmp流。
其中采集编码模块采集的视频数据为从数据输入源采集到的yuv或rgb 格式的图像数据;所述采集编码模块采集的音频数据为从数据输入源采集到的pcm格式的音频数据。在本申请的一个具体实施方式中,视频数据为采用H.264进行编码压缩形成的视频数据;所述音频数据为采用AAC进行编码压缩形成的音频数据。
rtmp meta data数据元为码流的属性名称及其值,可以包括:视频宽、视频高、视频编码格式、视频帧率、音频编码格式、音频采样率。
在本实施例的一个优选实施方式中,rtmp流加密模块通过第一加密公式对H.264视频数据NAL层的I帧及P帧RBSP数组中的随机数个位单字节进行混淆,其中,所述第一加密公式如下:
NALU[NALU_Length%10]=~(NALU[NALU_Length%10+1]^NALU[11])
其中,随机数为NALU_Length%10;
NALU_Length为NALU结构体的总长度。
对于rtmp流的音频数据rtmp流,加密模块通过第二加密公式对AAC每一帧的头部信息双字节进行加密,其中,所述第二加密公式如下:
AAC sequence header[2]=~AAC sequence header[2]^0xAAAA
其中,所述AAC sequence header为所述AAC每一帧的头部信息。
在解密阶段,rtmp流解密模块分别对加密后的rtmp流的视频数据和加密后的rtmp流的音频数据进行解密;
其中,rtmp流解密模块通过第一解密公式对H.264视频数据NAL层的I帧及P帧RBSP数组中的随机数个位单字节进行解密,其中,第一解密公式如下:
NALU[NALU_Length%10]=~NALU[NALU_Length%10+1]^NALU[11]
其中,随机数为NALU_Length%10;
NALU_Length为NALU结构体的总长度。
另一方面,rtmp流解密模块通过第二解密公式对AAC每一帧的头部信息双字节进行解密,其中,第二解密公式如下:
AAC sequence header[2]=~AAC sequence header[2]^0xAAAA
其中,AAC sequence header为AAC每一帧的头部信息。对每一帧的头部信息的下标为2的数据进行解密修改,其值变为原始值取反后异或十六进制数0xAAAA的结果。上述实施例提出的基于rtmp的音视频数据加解密系统, 通过字节混淆方式加解密,实现过程简单,不会对服务器带来额外的带宽压力,并且不需要消耗客户端计算性能就能进行加密解密,此外,即使rtmp流或者流地址url被截取,播放出来的画面和声音都不是有效的信息,从而提高数据的安全性。
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质中包括基于rtmp的音视频数据加解密程序,所述基于rtmp的音视频数据加解密序被处理器执行时实现如前所述的基于rtmp的音视频数据加解密方法的步骤。
本申请之计算机可读存储介质的具体实施方式与上述基于rtmp的音视频数据加解密方法、系统、电子装置的具体实施方式大致相同,在此不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种基于rtmp的音视频数据加解密方法,应用于电子装置,其特征在于,所述方法包括如下步骤:
    S10:采集视频数据和音频数据,并将采集到的视频数据和音频数据进行编码,形成rtmp流;
    S20:在rtmp meta data数据元添加加密标志位字段encrypt,并根据所述加密标志位字段encrypt判断对所述rtmp流的加密设置是否生效;
    S30:如果加密设置生效,对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密;
    S40:将加密后的rtmp流上传至多媒体服务器,通过所述多媒体服务器的客户端读取加密后的rtmp流;
    S50:读取rtmp meta data数据元中的加密标志位字段encrypt,并判断所述rtmp流的加密设置是否生效;
    S60:如果加密设置生效,对读取加密后的rtmp流进行解密;
    S70:对解密后的rtmp流进行解码,获取清晰的rtmp流。
  2. 根据权利要求1所述的基于rtmp的音视频数据加解密方法,其特征在于,
    所述视频数据为从数据输入源采集到的yuv或rgb格式的图像数据;
    所述音频数据为从数据输入源采集到的pcm格式的音频数据。
  3. 根据权利要求1所述的基于rtmp的音视频数据加解密方法,其特征在于,所述rtmp meta data数据元为码流的属性名称及其值,包括:视频宽、视频高、视频编码格式、视频帧率、音频编码格式、音频采样率。
  4. 根据权利要求1所述的基于rtmp的音视频数据加解密方法,其特征在于,所述步骤S20中断对所述rtmp流的加密设置是否生效的方法包括:
    若所述加密标志位字段encrypt为true,对所述rtmp流的加密设置生效;
    若所述加密标志位字段encrypt为false,对所述rtmp流的加密设置不生效。
  5. 根据权利要求1所述的基于rtmp的音视频据加解密方法,其特征在于,所述视频数据为采用H.264进行编码压缩形成的视频数据;所述音频数 据为采用AAC进行编码压缩形成的音频数据。
  6. 根据权利要求5所述的基于rtmp的音视频数据加解密方法,其特征在于,在所述步骤S30中对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密的步骤包括:
    通过第一加密公式对H.264视频数据NAL层的I帧及P帧RBSP数组中的随机数个位单字节进行混淆,其中,所述第一加密公式如下:
    NALU[NALU_Length%10]=~(NALU[NALU_Length%10+1]^NALU[11])
    其中,随机数为NALU_Length%10;
    NALU_Length为NALU结构体的总长度。
  7. 根据权利要求6所述的基于rtmp的音视频数据加解密方法,其特征在于,在所述步骤S30中对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密的步骤还包括:
    通过第二加密公式对AAC每一帧的头部信息双字节进行加密,其中,所述第二加密公式如下:
    AAC sequence header[2]=~AAC sequence header[2]^0xAAAA
    其中,所述AAC sequence header为所述AAC每一帧的头部信息。
  8. 根据权利要求1所述的基于rtmp的音视频数据加解密方法,其特征在于,在所述步骤S50中断所述rtmp流的加密设置是否生效的方法包括:
    若所述加密标志位字段encrypt为true,对所述rtmp流的加密设置则生效;
    若所述加密标志位字段encrypt为false,对所述rtmp流的加密设置则不生效。
  9. 根据权利要求5所述的基于rtmp的音视频数据加解密方法,其特征在于,在所述步骤S60中对所述读取加密后的rtmp流进行解密的步骤包括:
    对加密后的rtmp流的视频数据进行解密,以及,对加密后的rtmp流的音频数据进行解密;
    其中,对加密后的rtmp流的视频数据进行解密的步骤包括:
    通过第一解密公式对H.264视频数据NAL层的I帧及P帧RBSP数组中的随机数个位单字节进行解密,其中,所述第一解密公式如下:
    NALU[NALU_Length%10]=~NALU[NALU_Length%10+1]^NALU[11] 其中,随机数为NALU_Length%10;
    NALU_Length为NALU结构体的总长度。
  10. 根据权利要求9所述的基于rtmp的音视频数据加解密方法,其特征在于,所述对加密后的rtmp流的音频数据进行解密的步骤包括:
    通过第二解密公式对AAC每一帧的头部信息双字节进行解密,其中,所述第二解密公式如下:
    AAC sequence header[2]=~AAC sequence header[2]^0xAAAA
    其中,所述AAC sequence header为所述AAC每一帧的头部信息。
  11. 一种基于rtmp的音视频数据加解密系统,其特征在于,包括:
    采集编码模块,用于采集视频数据和音频数据,并将采集到的视频数据和音频数据进行编码,形成rtmp流;
    第一判断模块,用于在rtmp meta data数据元添加加密标志位字段encrypt,并根据所述加密标志位字段encrypt判断对所述rtmp流的加密设置是否生效;
    rtmp流加密模块,用于在所述加密设置生效的情况下,对所述rtmp流的视频数据和音频数据分别采用字节混淆的方式加密;
    rtmp流上传模块,用于将加密后的rtmp流上传至多媒体服务器;
    rtmp流读取模块,用于通过所述多媒体服务器的客户端读取加密后的rtmp流;
    第二判断模块,用于读取rtmp meta data数据元中的加密标志位字段encrypt,并判断所述rtmp流的加密设置是否生效;
    rtmp流解密模块,用于在所述加密设置生效的情况下,对读取加密后的rtmp流进行解密;
    rtmp流解码模块,用于对解密后的rtmp流进行解码,获取清晰的rtmp流。
  12. 根据权利要求11所述的基于rtmp的音视频数据加解密系统,其特征在于,所述采集编码模块采集的视频数据为从数据输入源采集到的yuv或rgb格式的图像数据;所述采集编码模块采集的音频数据为从数据输入源采集到的pcm格式的音频数据。
  13. 根据权利要求11所述的基于rtmp的音视频数据加解密系统,其特征在于,所述rtmp meta data数据元为码流的属性名称及其值,包括:视频宽、 视频高、视频编码格式、视频帧率、音频编码格式、音频采样率。
  14. 根据权利要求11所述的基于rtmp的音视频数据加解密系统,其特征在于,所述视频数据为采用H.264进行编码压缩形成的视频数据;所述音频数据为采用AAC进行编码压缩形成的音频数据。
  15. 根据权利要求14所述的基于rtmp的音视频数据加解密系统,其特征在于,所述rtmp流加密模块通过第一加密公式对H.264视频数据NAL层的I帧及P帧RBSP数组中的随机数个位单字节进行混淆,其中,所述第一加密公式如下:
    NALU[NALU_Length%10]=~(NALU[NALU_Length%10+1]^NALU[11])
    其中,随机数为NALU_Length%10;
    NALU_Length为NALU结构体的总长度。
  16. 根据权利要求15所述的基于rtmp的音视频数据加解密系统,其特征在于,所述rtmp流加密模块通过第二加密公式对AAC每一帧的头部信息双字节进行加密,其中,所述第二加密公式如下:
    AAC sequence header[2]=~AAC sequence header[2]^0xAAAA
    其中,所述AAC sequence header为所述AAC每一帧的头部信息。
  17. 根据权利要求14所述的基于rtmp的音视频数据加解密系统,其特征在于,所述rtmp流解密模块分别对加密后的rtmp流的视频数据和加密后的rtmp流的音频数据进行解密;
    其中,所述rtmp流解密模块通过第一解密公式对H.264视频数据NAL层的I帧及P帧RBSP数组中的随机数个位单字节进行解密,其中,所述第一解密公式如下:
    NALU[NALU_Length%10]=~NALU[NALU_Length%10+1]^NALU[11]
    其中,随机数为NALU_Length%10;
    NALU_Length为NALU结构体的总长度。
  18. 根据权利要求17所述的基于rtmp的音视频数据加解密系统,其特征在于,所述rtmp流解密模块通过第二解密公式对AAC每一帧的头部信息双字节进行解密,其中,所述第二解密公式如下:
    AAC sequence header[2]=~AAC sequence header[2]^0xAAAA
    其中,所述AAC sequence header为所述AAC每一帧的头部信息。
  19. 一种电子装置,其特征在于,该电子装置包括:存储器、处理器及摄像装置,所述存储器中包括基于rtmp的音视频数据加解密程序,所述基于rtmp的音视频数据加解密程序被所述处理器执行时实现如权利要求1至10中任一项所述的基于rtmp的音视频数据加解密方法的步骤。
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中包括基于rtmp的音视频数据加解密程序,所述基于rtmp的音视频数据加解密程序被处理器执行时,实现如权利要求1至10中任一项所述的基于rtmp的音视频数据加解密方法的步骤。
PCT/CN2019/118438 2019-10-15 2019-11-14 基于rtmp的音视频数据加解密方法、装置及可读存储介质 WO2021072878A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910978214.9 2019-10-15
CN201910978214.9A CN110881142A (zh) 2019-10-15 2019-10-15 基于rtmp的音视频数据加解密方法、装置及可读存储介质

Publications (1)

Publication Number Publication Date
WO2021072878A1 true WO2021072878A1 (zh) 2021-04-22

Family

ID=69727999

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118438 WO2021072878A1 (zh) 2019-10-15 2019-11-14 基于rtmp的音视频数据加解密方法、装置及可读存储介质

Country Status (2)

Country Link
CN (1) CN110881142A (zh)
WO (1) WO2021072878A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114039959A (zh) * 2021-11-05 2022-02-11 北京奇艺世纪科技有限公司 一种ts流的传输方法及装置
CN115802049A (zh) * 2023-02-09 2023-03-14 深流微智能科技(深圳)有限公司 视频数据编解码方法、装置以及视频数据传输系统
CN117459763A (zh) * 2023-12-22 2024-01-26 杭州海康威视数字技术股份有限公司 基于动态编排的音视频安全保护方法、设备和系统

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112351065A (zh) * 2020-09-21 2021-02-09 视联动力信息技术股份有限公司 一种数据传输方法、装置、终端设备和存储介质
CN113630426B (zh) * 2021-10-12 2022-03-08 广州市保伦电子有限公司 一种基于同声传译的私有加密方法和系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103533315A (zh) * 2013-09-11 2014-01-22 天脉聚源(北京)传媒科技有限公司 一种音视频数据的处理方法和装置
CN104506793A (zh) * 2015-01-16 2015-04-08 东北大学 一种基于互联网的安全视频会议系统及方法
CN105847238A (zh) * 2016-03-16 2016-08-10 杭州狮说教育科技有限公司 一种基于rtmp连接的数据安全传输方法
CN106331853A (zh) * 2016-08-31 2017-01-11 福建星网视易信息系统有限公司 多媒体解封装方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2309745A1 (en) * 2009-09-09 2011-04-13 Alcatel-Lucent España, S.A. Encryption procedure and device for an audiovisual data stream
CN102306262A (zh) * 2011-08-31 2012-01-04 深圳芯智汇科技有限公司 数据加密方法及数据加密系统
CN102843558B (zh) * 2012-08-21 2015-12-09 中国电子科技集团公司第三十八研究所 H.264/avc压缩域视频加密/解密装置及其加密/解密方法
CN105704515A (zh) * 2015-06-03 2016-06-22 深圳Tcl数字技术有限公司 媒体文件的快速启播方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103533315A (zh) * 2013-09-11 2014-01-22 天脉聚源(北京)传媒科技有限公司 一种音视频数据的处理方法和装置
CN104506793A (zh) * 2015-01-16 2015-04-08 东北大学 一种基于互联网的安全视频会议系统及方法
CN105847238A (zh) * 2016-03-16 2016-08-10 杭州狮说教育科技有限公司 一种基于rtmp连接的数据安全传输方法
CN106331853A (zh) * 2016-08-31 2017-01-11 福建星网视易信息系统有限公司 多媒体解封装方法及装置

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114039959A (zh) * 2021-11-05 2022-02-11 北京奇艺世纪科技有限公司 一种ts流的传输方法及装置
CN114039959B (zh) * 2021-11-05 2024-04-09 北京奇艺世纪科技有限公司 一种ts流的传输方法及装置
CN115802049A (zh) * 2023-02-09 2023-03-14 深流微智能科技(深圳)有限公司 视频数据编解码方法、装置以及视频数据传输系统
CN115802049B (zh) * 2023-02-09 2023-04-14 深流微智能科技(深圳)有限公司 视频数据编解码方法、装置以及视频数据传输系统
CN117459763A (zh) * 2023-12-22 2024-01-26 杭州海康威视数字技术股份有限公司 基于动态编排的音视频安全保护方法、设备和系统
CN117459763B (zh) * 2023-12-22 2024-03-01 杭州海康威视数字技术股份有限公司 基于动态编排的音视频安全保护方法、设备和系统

Also Published As

Publication number Publication date
CN110881142A (zh) 2020-03-13

Similar Documents

Publication Publication Date Title
WO2021072878A1 (zh) 基于rtmp的音视频数据加解密方法、装置及可读存储介质
US9641322B2 (en) Container agnostic decryption device and methods for use therewith
US10154014B2 (en) Method and system for efficient encryption, transmission, and decryption of video data
US8838954B2 (en) Media processing devices for adaptive delivery of on-demand media, and methods thereof
US20050193205A1 (en) Method and system for session based watermarking of encrypted content
US8850498B1 (en) Media adaptive distribution system and method
US7249264B2 (en) Secure IP based streaming in a format independent manner
JP2007526507A (ja) スケーラブルメディアを記述するデータを生成するための方法
JP2007534230A (ja) プログレッシブ暗号化されたスケーラブルデータ列をスケーリングするための方法
Tew et al. Separable authentication in encrypted hevc video
CN100581100C (zh) 防止跳过数字媒体流中特殊内容片段的回放的方法和系统
KR101145782B1 (ko) 모바일 컨텐츠 서비스를 제공하기 위한 경량화된 비디오 컨텐츠 암호화 및 복호화 방법
CN115225977B (zh) 一种视频稀疏非对称加密方法
JP2009100265A (ja) データ処理装置、データ処理方法、データ処理プログラム、およびそのデータ処理プログラムを記録した記録媒体、並びに集積回路
JP2012257196A (ja) 画面の共有に基づくストリーミングメディア転送システム及びその方法
KR102586709B1 (ko) 영상 보호 송신 장치, 수신 장치 및 방법
JP2013150147A (ja) 暗号化装置、復号装置、暗号化プログラム、および復号プログラム
JP2018007200A (ja) コンテンツ復号装置、コンテンツ復号方法、受信装置及びプログラム
WO2017035018A1 (en) Method and system for efficient encryption, transmission, and decryption of video data
KR20120138940A (ko) 모바일 단말기용 영상 데이터의 선택적 암호화 구현 시스템 및 방법
CN111698534B (zh) 视频处理方法、装置、电子设备及存储介质
CN109561345B (zh) 基于avs+编码格式的数字电影打包方法
WO2024087208A1 (zh) 视频播放方法、系统及存储介质
CN118573955A (zh) 一种基于hls协议的加密方法及系统
Ling et al. The Video Encryption is Selectively Conducted Utilizing the SM2 Algorithm

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19948879

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19948879

Country of ref document: EP

Kind code of ref document: A1