Multi-protocol multi-standard encryption method and system, storage medium and electronic equipment
By analyzing and separating media streams, acquiring and applying suitable DRM standards and encryption protocols, the media streams are encrypted frame by frame, and encrypted content that complies with multiple DRM standards is solved, which solves the problem of difficulty in compatible with multiple DRM standards in the prior art, and achieves efficient multiplexing and secure distribution.
Patent Information
- Application Number
- CN202510377431.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-04-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to support the generation of encrypted content files that are compatible with a variety of mainstream DRM standards, resulting in complex content encryption process and difficult to achieve efficient reuse and secure distribution.
By parsing the container format of the input media file, separating the media stream, and using the pre-set target DRM standard and its encryption protocol, interacting with the server to obtain the encryption key and initialization vector, encrypting the media stream frame by frame, generating media shards that meet the target DRM standard, and creating an index description file.
The compatibility of multi-protocol and multi-standard encryption technology is achieved, and the multiplexing efficiency and secure distribution capabilities of encrypted content are improved, so that the same encrypted content can adapt to multiple usage scenarios.
Smart Images

Figure CN119893172A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of multimedia technology, and in particular to a multi-protocol and multi-standard encryption method, system, storage medium and electronic equipment. Background Art
[0002] Currently, digital rights management (DRM) technology has formed standards including Widevine, PlayReady, FairPlay and ChinaDRM. However, the technical implementations of different manufacturers vary greatly (such as encryption protocols and key management), making it difficult for a single DRM standard to meet all business needs and terminal devices. As a key module in the DRM system architecture, the importance of content encryption services is self-evident. Encryption is the most basic and critical step in the entire DRM process.
[0003] However, despite the existence of a variety of open source encryption tools, such as Shaka Packager, Bento4, MP42HLS, DASHencrypt, GPAC, Manifest and Unified Packager, these tools do not support all mainstream DRM standards and cannot generate encrypted content files compatible with various DRM standards.
[0004] Therefore, how to design an encryption technology solution that is compatible with multiple protocols and multiple standards to achieve efficient reuse and secure distribution of encrypted content has become a technical problem that technical personnel in this field urgently need to solve. Summary of the invention
[0005] In view of the above problems, the present invention provides a multi-protocol multi-standard encryption method, system, storage medium and electronic device that overcome the above problems or at least partially solve the above problems. The technical solution is as follows:
[0006] A multi-protocol multi-standard encryption method, comprising:
[0007] Parsing the container format of the input media file and separating the media stream of the media file;
[0008] Using the preset target DRM standard and its corresponding encryption protocol, interact with the server to obtain the encryption key and initialization vector;
[0009] Encrypting the media stream frame by frame using the encryption key and the initialization vector to obtain encrypted content;
[0010] Slicing the encrypted content to generate media segments that comply with the target DRM standard;
[0011] Each of the media segments is encapsulated according to the target DRM standard, and an index description file is created, wherein the index description file includes description field information that complies with the target DRM standard.
[0012] Optionally, after parsing the container format of the input media file and separating the media stream of the media file, the method further includes:
[0013] It is determined whether the media stream is in a non-standard encoding format, and if so, the media stream is converted from the non-standard encoding format to a DRM compatible format that complies with the target DRM standard.
[0014] Optionally, the target DRM standard includes at least one of the FairPlay standard, the ChinaDRM standard, the Marlin standard, the Widevine standard and the PlayReady standard.
[0015] Optionally, the encryption algorithms supported by the encryption protocol include: AES-128-CTR mode full sample encryption, AES-CBC mode full sample and NAL subsample encryption, AES-CTR mode partial NAL encryption, AES-CBC mode partial NAL encryption and SM4 national encryption algorithm.
[0016] Optionally, the media segment complies with the standard of at least one of the HLS-TS protocol, the HLS-fMP4 protocol and the MPEG-DASH protocol.
[0017] Optionally, the index description file includes a PSSH identifier of each DRM standard, slice-level key identification information, an encryption algorithm parameter description field, and a multi-DRM compatibility declaration tag.
[0018] A multi-protocol and multi-standard encryption system, comprising: a pre-processing module, an encryption processing module and a post-processing module, wherein the pre-processing module comprises: a decapsulation unit, the encryption processing module comprises: a DRM standard configuration unit, an encryption protocol selection unit, a key management unit and a frame-by-frame encryption unit, and the post-processing module comprises: an adaptive slicing unit and a multi-standard encapsulation unit;
[0019] The pre-processing module is used to parse the container format of the input media file, wherein the decapsulation unit is used to implement media stream separation;
[0020] The encryption processing module is used to support the collaborative work of multiple encryption protocols and multiple DRM standards, wherein the DRM standard configuration unit is used to implement multi-standard parallel configuration, the encryption protocol selection unit supports protocol selection of multiple encryption algorithms, the key management unit interacts with the server to obtain encryption keys and initialization vectors, and the frame-by-frame encryption unit implements frame-level encryption on the media stream according to the selected protocol;
[0021] The post-processing module is used to implement slice encapsulation of encrypted content, wherein the adaptive slicing unit generates media segments that comply with the target DRM standard, and the multi-standard encapsulation unit creates an index description file containing description field information that complies with each target DRM standard.
[0022] Optionally, the preprocessing module further includes: a transcoding processing unit, wherein the transcoding processing unit converts the non-standard encoding format into a DRM compatible format.
[0023] A computer-readable storage medium stores a program, which implements the multi-protocol and multi-standard encryption method when executed by a processor.
[0024] An electronic device comprises at least one processor, at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other via the bus; and the processor is used to call program instructions in the memory to execute the multi-protocol multi-standard encryption method.
[0025] By means of the above technical scheme, the present invention provides a multi-protocol multi-standard encryption method, system, storage medium and electronic device, the method comprising: parsing the container format of the input media file and separating the media stream of the media file; using the pre-set target DRM standard and its corresponding encryption protocol to interact with the server to obtain the encryption key and initialization vector; using the encryption key and initialization vector to encrypt the media stream frame by frame to obtain the encrypted content; slicing the encrypted content to generate media segments that meet the target DRM standard; encapsulating each media segment according to the target DRM standard, and creating an index description file, wherein the index description file includes description field information that meets the target DRM standard. The present invention is compatible with multiple encryption protocols and multiple DRM standards through unified logic, which greatly improves the reuse efficiency of encrypted content, enables the same encrypted content to adapt to multiple usage scenarios, and enhances the ability of secure distribution.
[0026] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0028] Figure 1 The overall architecture diagram of the FFmpeg framework provided by the embodiment of the present invention is shown;
[0029] Figure 2 A schematic diagram of the system structure of a multi-protocol and multi-standard encryption system provided by an embodiment of the present invention is shown;
[0030] Figure 3 Another schematic diagram of the system structure of the multi-protocol and multi-standard encryption system provided by an embodiment of the present invention is shown;
[0031] Figure 4 A logic block diagram of content encryption of a multi-protocol multi-standard encryption system provided by an embodiment of the present invention is shown;
[0032] Figure 5 A schematic diagram showing a flow chart of an implementation of a multi-protocol and multi-standard encryption method provided by an embodiment of the present invention;
[0033] Figure 6 A schematic flow chart of another implementation of the multi-protocol multi-standard encryption method provided by an embodiment of the present invention is shown;
[0034] Figure 7 A schematic structural diagram of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0035] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0036] There are multiple DRM standards in the field of Digital Rights Management (DRM), and each standard recommends a specific content encryption tool, which makes it challenging for developers to choose the right tool. Common open source encryption tools include Shaka Packager, Bento4, MP42HLS, DASHencrypt, GPAC, Manifest, and Unified Packager. These tools each support different DRM standards, making the content encryption process complicated, especially when multiple mainstream DRM standards need to be met at the same time.
[0037] Mainstream DRM standards include Marlin, Widevine, FairPlay, PlayReady and ChinaDRM standards. Diverse DRM standards have established different content consumption methods and business models. Each standard differs in implementation, security level and license management options, and the support for different platforms, browsers and devices also varies significantly. Therefore, when enterprises are protecting digital copyrights, they must choose the appropriate encryption standard based on their business needs. However, there is still no DRM standard that can cover all business types and support all platforms and devices. In addition, historical issues have led to the coexistence of multiple DRM standards in the same business, which requires the back-end content encryption service to rely on multiple encryption tools, which has an adverse impact on the function development, upgrade and maintenance of the system.
[0038] In this context, FFmpeg, as an open source cross-platform video framework, provides audio and video encoding and decoding, transcoding and streaming media processing functions, and should be an ideal choice for content encryption. However, the current FFmpeg framework only supports the CENC (AES-128-CTR) encryption protocol and has not yet implemented support for some mainstream DRM standards at home and abroad. In particular, the lack of support for the ChinaDRM standard limits its application in digital copyright protection.
[0039] In order to solve the problem of logical unification of content encryption tools, the present invention proposes a multi-protocol and multi-standard encryption system and method. The system aims to expand the encryption protocol support of FFmpeg, covering multiple encryption protocols such as CBC1, CENS, CBCS and SM4 national encryption algorithm, and supports streaming media transmission protocols such as HLS-TS, HLS-FPM4 and MPEG-DASH at the encapsulation protocol level. Through these improvements, content encryption tools can effectively achieve compatibility with multiple DRM standards, reduce the complexity of enterprises in the content encryption process, and improve the security and reusability of content.
[0040] Figure 1The overall architecture diagram of the FFmpeg framework provided by the embodiment of the present invention is shown. The overall architecture diagram of FFmpeg can be divided into two main parts: the upper layer tool and the lower layer basic library. The upper layer contains three core tools: ffmpeg, ffplay and ffprobe, which are used for audio and video processing, playback and analysis respectively; the lower layer provides a variety of basic libraries, including the audio and video encoding and decoding library AVCodec, the filter processing library AVFilter, the input and output device library AVDevice, the audio and image conversion library SWResample and SWScale, and the post-processing library PostProc. In addition, the AVFormat and AVUtil libraries involved in the transformation requirements of the present invention have been deepened and marked. AVFormat needs to transform the encapsulation and packaging protocol, and the AVUtil library needs to be expanded to support encryption protocols. At the API interface layer, compatibility processing ensures that users can quickly call FFmpeg through the command line to perform complex encryption tasks. When calling the command line of FFmpeg, multiple functions can be realized through command parameters. For example: encrypting TS format files into HLS-FMP4 slice files that comply with Marlin and Widevine standards, and realizing fine control of DRM standards by setting relevant parameters, enhancing the flexibility and functionality of FFmpeg.
[0041] like Figure 2 As shown, a system structure diagram of a multi-protocol and multi-standard encryption system provided by an embodiment of the present invention, the system may include: a pre-processing module M1, an encryption processing module M2 and a post-processing module M3, wherein the pre-processing module M1 includes: a decapsulation unit, the encryption processing module M2 includes: a DRM standard configuration unit, an encryption protocol selection unit, a key management unit and a frame-by-frame encryption unit, and the post-processing module M3 includes: an adaptive slicing unit and a multi-standard encapsulation unit.
[0042] The preprocessing module M1 is used to parse the container format of the input media file.
[0043] The preprocessing module M1 parses various container formats of the input media files and processes the related transpackaging I / O process. In addition, for encoding formats that do not support the DRM standard, the preprocessing module M1 also needs to transcode the source files to ensure compatibility and playback effect.
[0044] The decapsulation unit is used to separate the media streams.
[0045] Specifically, the decapsulation unit calls the I / O protocol module of the libavformat library to separate the media streams. During the decapsulation process, the decapsulation unit calls the I / O protocol module of the libavformat library in the FFmpeg framework to read the input media file into the memory. Then, the decapsulation module (demuxing) of the libavformat library is used to separate the audio stream and the video stream in the source file (input media file) so that each media stream can be processed independently later.
[0046] The encryption processing module M2 is used to support the collaborative work of multiple encryption protocols and multiple DRM standards.
[0047] The encryption processing module M2 is responsible for encrypting the media stream files to support the collaboration of multiple encryption protocols and DRM standards. The encryption processing module M2 configures the corresponding DRM standard services according to business needs and sets the encryption protocol accordingly. Subsequently, the key and initialization vector are obtained from the Key Management Service (KMS) server in the DRM system framework to initialize the entire encryption module, and finally realize the frame-by-frame encryption of the media stream files.
[0048] The DRM standard configuration unit is used to implement multi-standard parallel configuration.
[0049] Specifically, the DRM standard configuration unit implements parallel configuration of multiple standards through the command line parameter multidrm. The DRM standard configuration unit implements parallel configuration of multiple DRM standards through the command line parameter multidrm. According to business needs, the system can generate a single content encryption file for multiple DRM standards. Users only need to configure the parameter "multidrm=wiseplay,marlin,widevine,playready" in the FFmpeg command line to simultaneously generate content encryption files that meet multiple standards.
[0050] Among them, the encryption protocol selection unit supports protocol selection of multiple encryption algorithms.
[0051] Users can configure the corresponding encryption protocol and encryption level according to the set DRM standard. At the same time, users need to determine whether to use full sample encryption or sub-sample encryption. Choosing sub-sample encryption, that is, only encrypting key frames and not encrypting audio data, can effectively reduce the cost of terminal decryption.
[0052] The key management unit interacts with the server to obtain the encryption key and initialization vector.
[0053] Specifically, the key management unit interacts with the KMS server to obtain the encryption key and initialization vector. For security reasons, the key and its corresponding key ID are stored in the DRM license server. The content production server must request the encryption key and IV from the KMS server in order to perform encryption operations.
[0054] The frame-by-frame encryption unit implements frame-level encryption on the media stream according to the selected protocol.
[0055] The frame-by-frame encryption unit implements frame-level encryption on the media stream according to the selected protocol. After completing all necessary preparations, the frame-by-frame encryption unit can encrypt the media stream file frame by frame.
[0056] The post-processing module M3 is used to implement slicing encapsulation of encrypted content.
[0057] The post-processing module M3 is responsible for slicing and encapsulating the media stream that has completed frame-level encryption, so as to prepare for the subsequent content delivery network (CDN) nodes and ensure that the encrypted content can be efficiently distributed and transmitted.
[0058] The adaptive slicing unit generates media segments that comply with the target DRM standard.
[0059] The adaptive slicing unit is responsible for cutting the encrypted media stream file into media segments of equal duration or size, and packaging these segments into a packaging format that complies with the DRM standard.
[0060] The multi-standard encapsulation unit creates an index description file containing description field information that complies with each target DRM standard.
[0061] The multi-standard encapsulation unit generates an index description file containing detailed description field information according to different DRM standard requirements. The index description file contains slice information and media packaging information, and can also include PSSH (Protection System Specific Header) information and key ID information that support various DRM standards. This information is used to identify the supported DRM system and help the player request the appropriate content decryption license from the backend license server.
[0062] The present invention provides a multi-protocol and multi-standard encryption system, which includes: a pre-processing module M1, an encryption processing module M2 and a post-processing module M3, wherein the pre-processing module M1 includes: a decapsulation unit, the encryption processing module M2 includes: a DRM standard configuration unit, an encryption protocol selection unit, a key management unit and a frame-by-frame encryption unit, and the post-processing module M3 includes: an adaptive slicing unit and a multi-standard encapsulation unit; the pre-processing module M1 is used to parse the container format of the input media file, wherein the decapsulation unit calls the I / O protocol module of the libavformat library to realize media stream separation; the encryption processing module M2 uses The invention is used to support the collaborative work of multiple encryption protocols and multiple DRM standards, wherein the DRM standard configuration unit realizes the parallel configuration of multiple standards through the command line parameter multidrm, the encryption protocol selection unit supports the protocol selection of multiple encryption algorithms, the key management unit interacts with the KMS server to obtain the encryption key and initialization vector, and the frame-by-frame encryption unit implements frame-level encryption on the media stream according to the selected protocol; the post-processing module M3 is used to realize the slicing encapsulation of encrypted content, wherein the adaptive slicing unit generates media segments that meet the target DRM standard, and the multi-standard encapsulation unit creates description field information that meets each target DRM standard. The present invention is compatible with multiple encryption protocols and multiple DRM standards through unified logic, thereby improving the reuse efficiency and secure distribution capability of encrypted content.
[0063] Optional, based on Figure 2 The system structure shown in Figure 3 As shown, another system structure diagram of the multi-protocol multi-standard encryption system provided by an embodiment of the present invention, the pre-processing module M1 may also include: a transcoding processing unit, wherein the transcoding processing unit converts the non-standard encoding format into a DRM compatible format.
[0064] Specifically, the transcoding processing unit converts the non-standard encoding format into a DRM-compatible format through the libavcodec library. During the transcoding process, the transcoding processing unit calls the libavcodec library in the FFmpeg framework for encoding formats that do not comply with the DRM standard. First, the media stream is decoded and then converted into an encoding format that complies with the DRM standard requirements, such as H.264 or H.265, for subsequent encryption operations.
[0065] The embodiment of the present invention can effectively improve the compatibility and protection of media content through the transcoding processing unit in the preprocessing module M1. The libavcodec library is used to convert non-standard encoding formats into DRM-compatible formats, ensuring that all media streams meet industry standards after decoding, which not only optimizes the quality and playback performance of media content, but also lays the foundation for subsequent encryption operations, thereby enhancing the copyright protection of content, reducing compatibility issues between playback devices and platforms, and providing users with a smoother and safer viewing experience.
[0066] Optionally, the encryption algorithms supported by the encryption protocol selection unit include: AES-128-CTR mode full sample encryption, AES-CBC mode full sample and NAL subsample encryption, AES-CTR mode partial NAL encryption, AES-CBC mode partial NAL encryption and SM4 national encryption algorithm.
[0067] Among them, AES-128-CTR mode full sample encryption, also known as CENC aes-ctr full sample encryption. This mode uses a counter (CTR) method to encrypt the entire media sample. The advantage of the CTR mode is that it has fast encryption and decryption speeds, supports random access, and is suitable for streaming media transmission. Since the FFmpeg framework natively supports CENC (AES-128-CTR), this encryption method can achieve good cross-platform compatibility.
[0068] Among them, AES-CBC mode full sample and NAL subsample encryption is also called CBC1 aes-cbc full sample encryption. In this mode, the entire media stream or a specific NAL (network abstraction layer) unit will be encrypted using AES-CBC (cipher block chaining mode). This encryption method provides chain encryption for each data block to ensure data integrity and security, and is suitable for scenarios with high protection requirements.
[0069] Among them, AES-CTR mode partial NAL encryption, also known as CENS aes-ctr subsample encryption. This mode allows encryption of some NAL units in the video stream instead of processing the entire stream. This flexibility allows specific content to be protected during playback while maintaining the availability of other parts, improving the efficiency of the system.
[0070] Among them, AES-CBC mode partial NAL encryption is also called CBCS aes-cbc subsample encryption. Similar to the above partial NAL encryption, this method also only performs AES-CBC encryption on specific NAL units. This mode can implement more detailed encryption strategies based on the sensitivity of the content, making it easier to achieve refined content protection.
[0071] Among them, the SM4 national encryption algorithm, also known as the SM4 software and hardware national encryption algorithm, is specifically designed to meet domestic information security requirements. It can be implemented in both software and hardware, providing a flexible encryption solution to ensure compliance with national standards.
[0072] By extending support for multiple mainstream encryption protocols, the embodiment of the present invention can more comprehensively meet content protection requirements, provide users with a safe and stable media playback experience, and ensure compliance and content security.
[0073] Optionally, the encapsulation protocols supported by the multi-standard encapsulation unit include: M3U8 index and TS fragment format of the HLS-TS protocol, M3U8 index and Fragmented MP4 fragment format of the HLS-fMP4 protocol, and MPD index and ISOBMFF fragment format of the MPEG-DASH protocol.
[0074] The M3U8 index is an index file format used in the HLS (HTTP Live Streaming) protocol, which contains a list of media files and the order in which they are played. It instructs the player on how to obtain and play subsequent media segments.
[0075] The TS (Transport Stream) segment format is a file format used for streaming media transmission, which is suitable for real-time playback in an unstable network environment. The HLS-TS protocol uses TS format files for segmentation to facilitate downloading and playback one by one.
[0076] Among them, the Fragmented MP4 format is a specially processed MP4 format that allows fragmented processing in MP4 files. By replacing the traditional TS format with the fMP4 format, HLS-fMP4 can improve multimedia processing efficiency and playback performance.
[0077] The MPD index is the core of the MPEG-DASH protocol, which contains description information of each media segment, such as the URL, duration, and bit rate of the segment, and guides the player on how to select and play the media stream.
[0078] Among them, the ISOBMFF (ISO Base Media File Format) fragment format is a standard file format for storing multimedia content. MPEG-DASH usually uses fragments of this format (such as mp4 / cmfv / cmfa / m4s) to improve playback flexibility and compatibility.
[0079] The embodiment of the present invention expands the support for multiple standards at the FFmpeg encapsulation protocol packaging layer, so that the system can flexibly process various streaming media forms, improve the adaptability and playback performance of media transmission, and meet the diverse needs of the market for streaming media content.
[0080] Optionally, the combination of DRM standards supported by the DRM standard configuration unit through command line parameters includes: FairPlay standard, ChinaDRM standard, Marlin standard, Widevine standard and PlayReady standard.
[0081] In production application environments, due to the compatibility of CDN streaming media transmission protocols and the support of the encapsulation format for encoding formats (such as H.264 and H.265), a combination of the HLS-FMP4 encapsulation protocol and the cbcs encryption protocol is usually used to generate content encryption files. For example: in some self-developed digital copyright protection systems, the back-end content encryption service can use this combination, covering multiple DRM standards such as ChinaDRM, Marlin, Widevine and PlayReady, but not the FairPlay standard.
[0082] Since commercial CDNs have a high degree of support for HLS, combined with the flexibility and compatibility of HLS-FMP4, this encapsulation format can be preferred in actual operations. The FFmpeg framework supports both HLS-FMP4 and MPEG-DASH encapsulation layers, but the HLS-FMP4 format is mainly used in specific implementations.
[0083] In terms of encryption standard protocols, in order to achieve the reuse of encrypted content files, the FFmpeg encryption protocol layer can uniformly adopt the cbcs encryption protocol to ensure that the generated encrypted files are compatible with multiple DRM standards, simplifying the logic of content encryption tools and improving maintenance efficiency.
[0084] The DRM standard configuration unit is compatible with multiple mainstream DRM standards within the same code logic, effectively solving the logical unification of content encryption tools and reducing the cost of future function upgrades and version maintenance. In addition, in the same business scenario, content encryption files of multiple DRM standards can be reused, further improving resource utilization efficiency.
[0085] The DRM standard configuration unit provided by the embodiment of the present invention can meet the content protection requirements of different markets and users by supporting and flexibly combining multiple standards, while simplifying the development and maintenance process.
[0086] Optionally, the index description file includes PSSH identifiers of various DRM standards, key identification information at the slice level, encryption algorithm parameter description fields, and multi-DRM compatibility declaration tags.
[0087] The PSSH identifier is a structure containing DRM system information, which is used to identify a specific DRM system. In the index description file, the PSSH identifier provides specific information about the supported DRM standards so that the player can identify which DRM technology is used for content protection. The player requests the corresponding decryption license from the backend license server through the PSSH identifier to ensure that the content can be correctly decrypted and played.
[0088] Each media segment may use a different encryption key during content transmission. The segment-level key identification information (Key&ID) contained in the index description file specifies the encryption key associated with each segment. This enables the player to clearly inform the server of the specific key required when requesting decryption permission, thereby ensuring the security and accuracy of the decryption process.
[0089] The encryption algorithm parameter description field describes the encryption algorithm used and its specific parameters (for example, the encryption standard used, key length, encryption mode, etc.). Because different DRM standards may use different encryption strategies and algorithms, the encryption algorithm parameter description helps the player use the correct method when decrypting.
[0090] The Multi-DRM Compatibility Declaration tag is used to declare the multi-DRM compatibility of the content, indicating that the content supports multiple DRM standards. In the case where the same content may use different DRM technologies on different devices or platforms, the Multi-DRM Compatibility Declaration tag ensures that the player can select the appropriate decryption solution based on the user's device and environment.
[0091] The index description file provided by the embodiment of the present invention not only provides key information about media segments, but also provides necessary support for ensuring content protection and coordination of various parts in the playback process, so that the player can effectively interact with the back-end license server, obtain decryption licenses, and smoothly play protected content.
[0092] Figure 4The figure shows a logical block diagram of content encryption of a multi-protocol, multi-standard encryption system provided by an embodiment of the present invention. First, in the pre-processing module M1, the system parses various media container formats of the source file and performs necessary transpackaging and I / O operations. If the encoding format used by the source file does not meet the standard, transcoding will be performed. Next, the encryption processing module M2 is responsible for encrypting the processed media stream. First, the required DRM standard and related encryption protocol are set according to business needs, and then the key (Key) and initialization vector (IV) required for encryption are obtained from the KMS server, and finally frame-by-frame encryption operations are implemented. Finally, in the post-processing module M3, after completing the frame-level encryption of the media stream, the encrypted data is sliced and packaged to facilitate subsequent processing and transmission of the content distribution network (CDN) nodes. The entire process ensures the secure encryption and efficient distribution of content under multiple DRM standards.
[0093] Figure 5 The figure is a flow chart of an implementation of a multi-protocol multi-standard encryption method provided by an embodiment of the present invention. The method is applied to a multi-protocol multi-standard encryption system. The method may include:
[0094] S500: Parse the container format of the input media file and separate the media stream of the media file.
[0095] Specifically, the embodiment of the present invention first parses the input media file to identify its container format, reads the input file into memory by calling the I / O protocol module of the libavformat library in the FFmpeg framework, and uses the demuxing module to decapsulate and separate the audio stream and the video stream, so that the audio and video streams can be processed separately.
[0096] S510: Utilize the preset target DRM standard and its corresponding encryption protocol to interact with the server to obtain the encryption key and initialization vector.
[0097] Specifically, the embodiment of the present invention sets the target DRM standard and its encryption protocol according to business requirements, and communicates with the KMS to obtain the required encryption key and initialization vector to ensure the security and reliability of the subsequent encryption process.
[0098] S520: Encrypt the media stream frame by frame using the encryption key and the initialization vector to obtain encrypted content.
[0099] Specifically, after obtaining the encryption key and initialization vector, the embodiment of the present invention can encrypt the media stream frame by frame. This means that each frame of video and audio data will be encrypted under the guidance of the encryption key and initialization vector, thereby generating encrypted content to ensure that it is not accessed by unauthorized persons during transmission and storage.
[0100] S530: Slice the encrypted content to generate media segments that comply with the target DRM standard.
[0101] Specifically, after completing frame-by-frame encryption, the embodiment of the present invention divides the encrypted content into multiple small segments, namely media segments. These segments usually have equal duration or size, meet the requirements of the target DRM standard, and facilitate subsequent content distribution and management.
[0102] S540: Encapsulate each media segment according to the target DRM standard and create an index description file, wherein the index description file includes description field information that complies with the target DRM standard.
[0103] Specifically, the embodiment of the present invention encapsulates the generated media segments and creates an index description file. The index description file not only contains the segment information, but also includes description fields that comply with the target DRM standard, such as PSSH information and key ID information, to help the player correctly request content decryption permission.
[0104] The embodiment of the present invention achieves compatibility with multiple protocols and multiple DRM standards through a unified processing flow. First, based on the media stream separation and format parsing capabilities of libavformat, native support for different container formats is ensured; second, by dynamically interacting with the KMS server to obtain keys and frame-by-frame encryption mechanisms, the differentiated requirements of different DRM standards for encryption granularity are met under the premise of ensuring security (such as avoiding the risk of single-point key leakage); finally, through adaptive slicing and multi-standard encapsulation mechanisms, the encrypted content is reconstructed into segments and index files according to the target DRM specification, which not only avoids resource loss caused by repeated encryption, but also realizes the distribution adaptation of a single encrypted content on different DRM terminals through the multi-DRM metadata of the index file (such as PSSH, key identification, etc.). This method significantly improves the reuse efficiency of cross-platform content distribution, reduces the complexity of multi-DRM system integration through standardized processes, and ensures the security and controllability of the encryption process and distribution path.
[0105] Optional, based on Figure 5 The method shown, such as Figure 6 As shown, a flowchart of another implementation of the multi-protocol multi-standard encryption method provided by an embodiment of the present invention is shown. After step S500, the method may further include:
[0106] S600: Determine whether the media stream is in a non-standard encoding format. If yes, execute step S610.
[0107] Specifically, after completing the analysis of the input media file, the embodiment of the present invention will check the encoding format of the media stream to determine whether it complies with the DRM standard. If it is found that the encoding format does not comply, subsequent transcoding processing is required.
[0108] S610: Convert the media stream from the non-standard encoding format to a DRM compatible format that complies with the target DRM standard.
[0109] Specifically, in the embodiment of the present invention, when the encoding format of the media stream does not meet the requirements of the target DRM standard, the libavcodec library in the FFmpeg framework will be called for decoding, and the media stream will be transcoded into an encoding format that meets the target DRM standard (such as H.264 or H.265) to ensure that subsequent encryption operations can be performed in an appropriate encoding format.
[0110] After parsing and separating the media stream, the embodiment of the present invention will automatically determine and convert the non-standard encoding format into a compatible format that meets the target DRM standard, ensuring that the encrypted content can be seamlessly played on different devices and platforms. This automatic conversion optimizes the user experience, reduces manual intervention, and improves the stability and security of the encryption process, making the distribution of encrypted content more efficient and extensive, and effectively improving the compatibility and playability of encrypted content.
[0111] Optionally, the target DRM standard includes at least one of the FairPlay standard, the ChinaDRM standard, the Marlin standard, the Widevine standard and the PlayReady standard.
[0112] Optionally, the encryption protocol supports the following encryption algorithms: AES-128-CTR mode full sample encryption, AES-CBC mode full sample and NAL subsample encryption, AES-CTR mode partial NAL encryption, AES-CBC mode partial NAL encryption and SM4 national encryption algorithm.
[0113] Optionally, the media segment complies with the standard of at least one of the HLS-TS protocol, the HLS-fMP4 protocol, and the MPEG-DASH protocol.
[0114] Optionally, the index description file includes PSSH identifiers of various DRM standards, key identification information at the slice level, encryption algorithm parameter description fields, and multi-DRM compatibility declaration tags.
[0115] Although operations are depicted in a particular order, this should not be understood as requiring that the operations be performed in the particular order shown or in a sequential order.Multitasking and parallel processing may be advantageous under certain circumstances.
[0116] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0117] The embodiment of the present invention provides a multi-protocol multi-standard encryption method and system, which aims to realize the logical unification of content encryption tools of many mainstream DRM standards in the back-end content server, support the production of encrypted content that complies with the ChinaDRM standard, and maximize the reuse of content encryption files between multiple DRM standards. The system has three major advantages: first, it is secondary developed based on the FFmpeg framework, making full use of its powerful audio and video processing capabilities, theoretically supporting all transmission protocols, packaging formats and common encoding formats, and can realize encryption and other processing of different audio and video source data through a single FFmpeg command line, simplifying the calling process of content encryption services, and realizing fine control of the encryption production process through command line parameters; second, it supports multiple mainstream DRM standards in a unified code logic, reducing the cost of subsequent function upgrades and version maintenance; finally, in the same business environment, it realizes the reuse of content encryption files between multiple DRM standards as much as possible, reducing the consumption of server resources and storage space, and facilitating subsequent CDN distribution and P2P sharing.
[0118] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the multi-protocol multi-standard encryption method is implemented.
[0119] An embodiment of the present invention provides a processor, which is used to run a program, wherein the multi-protocol multi-standard encryption method is executed when the program is running.
[0120] like Figure 7 As shown, an embodiment of the present invention provides an electronic device 1000, which includes at least one processor 1001, at least one memory 1002 connected to the processor 1001, and a bus 1003; wherein the processor 1001 and the memory 1002 communicate with each other through the bus 1003; the processor 1001 is used to call the program instructions in the memory 1002 to execute the above-mentioned multi-protocol multi-standard encryption method. The electronic device in this article can be a server, a PC, a PAD, a mobile phone, etc.
[0121] The present invention also provides a computer program product, which, when executed on an electronic device, is suitable for executing a program for initializing the steps of a multi-protocol and multi-standard encryption method.
[0122] The present invention is described with reference to flowcharts and / or block diagrams of systems, methods, electronic devices, and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0123] In a typical configuration, an electronic device includes one or more processors (CPU), a memory, and a bus. The electronic device may also include an input / output interface, a network interface, and the like.
[0124] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
[0125] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0126] In the description of the present invention, it should be understood that the terms "up", "down", "front", "back", "left" and "right" etc. indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings. They are only for the convenience of describing the present invention and simplifying the description. They do not indicate or imply that the positions or elements referred to must have specific directions, be constructed and operate in specific directions. Therefore, they should not be understood as limitations of the present invention.
[0127] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. It should also be noted that the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0128] It should be understood by those skilled in the art that the embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0129] The above are only embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the present invention.
Claims
1. A multi-protocol multi-standard encryption method, characterized in that: include: Parsing the container format of the input media file and separating the media stream of the media file; Using the preset target DRM standard and its corresponding encryption protocol, interact with the server to obtain the encryption key and initialization vector; Encrypting the media stream frame by frame using the encryption key and the initialization vector to obtain encrypted content; Slicing the encrypted content to generate media segments that comply with the target DRM standard; Each of the media segments is encapsulated according to the target DRM standard, and an index description file is created, wherein the index description file includes description field information that complies with the target DRM standard.
2. The method according to claim 1, characterized in that After parsing the container format of the input media file and separating the media stream of the media file, the method further includes: It is determined whether the media stream is in a non-standard encoding format, and if so, the media stream is converted from the non-standard encoding format to a DRM compatible format that complies with the target DRM standard.
3. The method according to claim 1, characterized in that The target DRM standard includes: at least one of the FairPlay standard, the ChinaDRM standard, the Marlin standard, the Widevine standard and the PlayReady standard.
4. The method according to claim 1, characterized in that: The encryption algorithms supported by the encryption protocol include: AES-128-CTR mode full sample encryption, AES-CBC mode full sample and NAL subsample encryption, AES-CTR mode partial NAL encryption, AES-CBC mode partial NAL encryption and SM4 national encryption algorithm.
5. The method according to claim 1, characterized in that The media segments comply with the standard of at least one of the HLS-TS protocol, the HLS-fMP4 protocol and the MPEG-DASH protocol.
6. The method according to claim 1, characterized in that The index description file includes PSSH identifiers of various DRM standards, key identification information at the slice level, encryption algorithm parameter description fields and multi-DRM compatibility declaration tags.
7. A multi-protocol multi-standard encryption system, characterized in that: include: A pre-processing module, an encryption processing module and a post-processing module, wherein the pre-processing module includes: a decapsulation unit, the encryption processing module includes: a DRM standard configuration unit, an encryption protocol selection unit, a key management unit and a frame-by-frame encryption unit, and the post-processing module includes: an adaptive slicing unit and a multi-standard encapsulation unit; The pre-processing module is used to parse the container format of the input media file, wherein the decapsulation unit is used to implement media stream separation; The encryption processing module is used to support the collaborative work of multiple encryption protocols and multiple DRM standards, wherein the DRM standard configuration unit is used to implement multi-standard parallel configuration, the encryption protocol selection unit supports protocol selection of multiple encryption algorithms, the key management unit interacts with the server to obtain encryption keys and initialization vectors, and the frame-by-frame encryption unit implements frame-level encryption on the media stream according to the selected protocol; The post-processing module is used to implement slice encapsulation of encrypted content, wherein the adaptive slicing unit generates media segments that comply with the target DRM standard, and the multi-standard encapsulation unit creates an index description file containing description field information that complies with each target DRM standard.
8. The system according to claim 7, characterized in that The pre-processing module further includes: a transcoding processing unit, wherein the transcoding processing unit converts the non-standard encoding format into a DRM compatible format.
9. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the multi-protocol and multi-standard encryption method according to any one of claims 1 to 6 is implemented.
10. An electronic device, characterized in that: The electronic device includes at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the multi-protocol multi-standard encryption method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Multimedia file processing method and device, electronic equipment, program and medium
CN107959896A
Streaming media data encryption method and device, streaming media data decryption method and device, electronic equipment and storage medium
CN111093097A
Video encryption and decryption method and device
CN114040229A
Encryption method and encryption device compatible with multiple encryption algorithms, and storage medium
CN114697094A
Multimedia file playing method and device, electronic equipment and storage medium
CN114791960A