CN106331853A - Multimedia de-packaging method and apparatus - Google Patents

Multimedia de-packaging method and apparatus Download PDF

Info

Publication number
CN106331853A
CN106331853A CN201610785286.8A CN201610785286A CN106331853A CN 106331853 A CN106331853 A CN 106331853A CN 201610785286 A CN201610785286 A CN 201610785286A CN 106331853 A CN106331853 A CN 106331853A
Authority
CN
China
Prior art keywords
data
multimedia
media stream
video
video data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610785286.8A
Other languages
Chinese (zh)
Other versions
CN106331853B (en
Inventor
李靖禹
郑远
肖泽宝
林鎏娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Star Net eVideo Information Systems Co Ltd
Original Assignee
Fujian Star Net eVideo Information Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Star Net eVideo Information Systems Co Ltd filed Critical Fujian Star Net eVideo Information Systems Co Ltd
Priority to CN201610785286.8A priority Critical patent/CN106331853B/en
Publication of CN106331853A publication Critical patent/CN106331853A/en
Application granted granted Critical
Publication of CN106331853B publication Critical patent/CN106331853B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4405Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 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/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/434Disassembling of a multiplex stream, e.g. demultiplexing audio and video streams, extraction of additional data from a video stream; Remultiplexing of multiplex streams; Extraction or processing of SI; Disassembling of packetised elementary stream
    • H04N21/4341Demultiplexing of audio and video streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/439Processing of audio elementary streams
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/8547Content authoring involving timestamps for synchronizing content

Abstract

The invention belongs to the technical field of video playing, and specifically relates to a multimedia de-packaging method and apparatus. The multimedia de-packaging method comprises the following steps: acquiring a multimedia data packaging packet according to an input mode of multimedia streams; judging whether the multimedia data packaging packet is encrypted; if so, decrypting the multimedia data packaging packet, and then de-packaging the multimedia data packaging packet to acquire video data and audio data; and if not, directly de-packaging the multimedia data packaging packet to acquire the video data and the audio data, and judging whether the video data and the audio data are encrypted, and if so, separately decrypting the video data and the audio data. The technical scheme of the invention provides a multimedia de-packaging method, which can be used for carrying out unified decryption on audio and video streams to reduce the workload of secondary development.

Description

Multimedia de-encapsulation method and device
Technical field
The invention belongs to video display arts field, be specifically related to a kind of multimedia de-encapsulation method and device.
Background technology
Along with Internet technology and the development of multimedia technology, the important canal that Set Top Box represents as content of multimedia One of road, is increasingly widely used in family and sector application, it by receive wire cable, satellite antenna, broadband network with And the analogue signal of terrestrial broadcasting or digital signal, content of multimedia is presented on screen, growing to meet people Audio-visual entertainment requirements.Wherein, the most important purposes of Set Top Box is exactly the broadcasting for audio frequency and video (song, film), such as, and numeral TV set-top box be used for receive digital television signal displaying video programs, digital audio-video place playback terminal for playing this locality Or the music song video on network.
Due to copyright, major part multimedia video is the most all encryption, and Set Top Box the most on the market is play The deciphering function of device is the most fairly simple, can only support encryption and the deciphering of some protocol levels, such as HTTPS, RTMPS agreement etc. Deng, the self-defined encryption and decryption for file processes and could must realize by carrying out secondary development for corresponding cipher mode, But there is the most general problem in this mode, if file encryption mode changes, it is necessary to re-start exploitation.
Meanwhile, in multimedia technology, there is multiple Streaming transfer protocol (such as, HTTP, RTP, UDP etc.) and many The video encapsulation form (such as, MP4, FLV, MPEG, AVI etc.) planted, traditional Set Top Box player is all based on concrete many Media encapsulation format is customized, and develops with strong points, but in use when numerous multimedia encapsulation format Versatility is inadequate, when Set Top Box is when needing to support new platform and new form, there is development efficiency the highest, and delivery cycle is long Problem.
Summary of the invention
An object of the present invention is to overcome disadvantage mentioned above, it is provided that a kind of audio/video flow can be unified decipher many Media de-encapsulation method, reduces the workload of secondary development.
In order to solve above-mentioned technical problem, the invention provides a kind of multimedia de-encapsulation method, comprise the following steps:
Input mode according to media stream obtains multi-medium data wrapper;
Judge whether described multi-medium data wrapper has encryption;
If having, being then first decrypted described multi-medium data wrapper, decapsulation obtains video data and sound the most again Frequency evidence;
If no, then directly the decapsulation of described multi-medium data wrapper is obtained video data and voice data, then sentence Whether disconnected video data and voice data have encryption, if having, then video data and voice data are decrypted process respectively.
By increasing general decryption processing step on the basis of tradition decapsulation processing mode, can meet and difference is added The multimedia file of close type is uniformly processed, without the cipher mode new for every kind, and customized development again, simplify Secondary development step, improves development efficiency.
Further, described multimedia de-encapsulation method, further comprising the steps of:
Video data after decapsulation and voice data more than a road are synchronized by timestamp, the most again It is packaged into the media stream of general format.
Technical scheme, by the media stream of different encapsulation format is carried out decapsulation process, is isolated original Video data and voice data, then Reseal become be suitable for player process unified generic encapsulation form, reduce and broadcast Put the restriction processing the media stream encapsulation format to input so that follow-up playback process process is simplified, thus brings double Capacitive and the lifting of reliability.
Further, the source of the media stream of described input is local file and/or network audio-video stream, described many matchmakers Before the deciphering of body stream or decapsulation, pretreatment need to be carried out, particularly as follows: by the media stream in various sources with unified interface output.
Technical scheme, is applicable to the media stream of various different expression form, compatible high, the scope of application Extensively;Meanwhile, the multimedia of separate sources different agreement is with after unified interface output, it is possible to directly deciphering or decapsulation, and Need not consider further that the contents such as protocol interface, simplification processes step.
Further, described multimedia de-encapsulation method, use FFmpeg to realize media stream defeated with unified interface Go out, remove the protocol information in media stream by the first order structure AVIOContext in FFmpeg.
Further, described step " if having, then be first decrypted described multi-medium data wrapper " is particularly as follows: pass through Many matchmakers that in FFmpeg, first order structure AVIOContext is decapsulated by self-defining second level structure AVIOContext Body stream carries out decryption processing.
Further, the decapsulation of described multi-medium data wrapper " if not having, is then directly obtained video counts by described step According to and voice data, then judging whether video data and voice data have encryption, if having, then video data and voice data being divided It is not decrypted process " particularly as follows: by self-defining second structure AVInputFormat structure in FFmpeg by first The media stream of level structure body AVIOContext removal protocol information carries out decapsulation and obtains video data and voice data, then Judging whether video data and voice data have encryption, if having, the unified interface of recycling AVIOContext is decrypted place Reason.
Correspondingly, present invention also offers a kind of multimedia de-encapsulating devices, it is characterised in that including:
First processing module, obtains multi-medium data wrapper for the input mode according to media stream;
Second processing module, is used for judging whether described multi-medium data wrapper has encryption;
3rd processing module, if for having, being then first decrypted described multi-medium data wrapper, decapsulating Obtain video data and voice data;
Fourth processing module, if for not having, then directly obtains video counts by the decapsulation of described multi-medium data wrapper According to and voice data, then judging whether video data and voice data have encryption, if having, then video data and voice data being divided It is not decrypted process.
Further, described multimedia de-encapsulating devices, also include:
5th processing module, for entering the video data after decapsulation and voice data more than a road by timestamp Row synchronizes, and Reseal becomes the media stream of general format the most again.
Further, the source of the media stream of described input is local file and/or network audio-video stream;Described Between one processing module and described second processing module, also include the 6th processing module, for by the media stream in various sources With unified interface output.
Further, the media stream in various sources is exported by described 6th processing module with unified interface, particularly as follows: Use FFmpeg to realize media stream to export with unified interface, by the first order structure AVIOContext in FFmpeg Remove the protocol information in media stream.
Further, " if having, then described multi-medium data wrapper is first decrypted " in described 3rd processing module, Particularly as follows: first order structure AVIOContext is solved by self-defining second level structure AVIOContext in FFmpeg The media stream of encapsulation is decrypted process.
Further, described multi-medium data wrapper " if not having, is then directly decapsulated by described fourth processing module Obtain video data and voice data, then judge whether video data and voice data have encryption, if having, then to video data and Voice data is decrypted process respectively " particularly as follows: tied by the second structure AVInputFormat self-defining in FFmpeg The media stream of first order structure AVIOContext removal protocol information is carried out decapsulation and obtains video data and sound by structure body Frequency evidence, then judge whether video data and voice data have encryption, if having, the unified interface of recycling AVIOContext is entered Row decryption processing.
Correspondingly, present invention also offers the application of a kind of multimedia de-encapsulation method, it is characterised in that: described multimedia De-encapsulation method is applied in Set Top Box.
By the multimedia de-encapsulation method of the present invention is applied in Set Top Box, it is possible to achieve by different encapsulation format Multimedia file Reseal becomes the encapsulation format that Set Top Box is supported, improves the compatibility of Set Top Box;Use general solution simultaneously Close processing module, it is not necessary to Set Top Box is customized exploitation again.
In sum, the beneficial effect of technical solution of the present invention has:
1., by increasing general decryption processing step on the basis of tradition decapsulation processing mode, can meet difference The multimedia file of encryption type is uniformly processed, without the cipher mode new for every kind, and customized development again, letter Change secondary development step, improve development efficiency.
2., by the media stream of different encapsulation format is carried out decapsulation process, isolate original video data and sound Frequency evidence, the more unified generic encapsulation form that the applicable player of Reseal one-tenth processes, reduce playback process to input The restriction of media stream encapsulation format so that follow-up playback process process is simplified, thus bring compatible and reliability Promote.
3. it is applicable to the media stream of various different expression form, compatible high, applied widely.Meanwhile, different next The multimedia of source different agreement is with after unified interface output, it is possible to directly deciphering or decapsulation, and need not consider further that agreement The contents such as interface, simplification processes step.The way of output after processing media stream, supports directly play or preserve written Part, meets the demand of different application scene, and applicable pattern is more flexible.
4. by the multimedia de-encapsulation method of the present invention is applied in Set Top Box, it is possible to achieve by difference encapsulation format Multimedia file Reseal become the encapsulation format that Set Top Box supports, improve the compatibility of Set Top Box;Use general simultaneously Decryption processing module, it is not necessary to Set Top Box is customized exploitation again.
Accompanying drawing explanation
Fig. 1 is a kind of multimedia de-encapsulation method flow chart of steps of the present invention.
Fig. 2 is a kind of multimedia de-encapsulating devices structure chart of the present invention.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Describe, it is clear that described embodiment is only a part of embodiment of the present invention rather than whole embodiments wholely.Based on Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under not making creative work premise Embodiment, broadly falls into the scope of protection of the invention.
In computer realm, multimedia (Multimedia) refers to the media shape of two or more media combination Formula, the multimedia often used includes word, picture, sound, animation and video etc., and in digital audio-video business scenario, Common multimedia form is exactly film video, TV programme, and this kind of multimedia is mainly by Voice & Video two parts content group Becoming, have can also comprise caption content.Generally, the Voice & Video in each multimedia has corresponding coded format, logical Saying the compression algorithm used to reduce the volume of video and audio frequency that coded system refers to, different coded systems is all popularly There is a respective feature, but final purpose is provided to reduce file size as much as possible is easy to transmission, can guarantee that relatively simultaneously High video pictures quality or audio frequency effect.Such as, common H264, Xvid etc. are exactly video code model, and MP3, AAC etc. are just It it is audio coding formats.
The video good by compression coding and audio frequency are put in a file according to certain form, form one completely Multimedia file, this process referred to as encapsulation, and the form encapsulated is referred to as container, different encapsulation format is corresponding Having different file suffixes names, such as, common multimedia encapsulation format has RM, RMVB, AVI, MKV etc..
When being played out by multimedia file, common processing procedure is: first carry out decapsulation operation, so-called decapsulation behaviour Make to be exactly from complete multimedia file, to isolate the good video of compression coding and audio frequency, according still further to video data and audio frequency number It is decoded playing according to corresponding coded system.In complicated scene, due to copyright, major part multimedia video leads to Being the most all encryption, the deciphering function of Set Top Box the most on the market is the most fairly simple, can only support adding of some protocol levels Close and deciphering, such as HTTPS, RTMPS agreement etc., the file processed for Custom Encryption must be by for corresponding encryption Mode carries out secondary development and could realize, but this mode exists the most general problem, if file encryption mode changes, Exploitation must be re-started.
For solving the problems referred to above, the present invention proposes a kind of multimedia de-encapsulation method, such as Fig. 1, is the one of the present invention Multimedia de-encapsulation method flow chart of steps, comprises the following steps:
Step 1, obtain multi-medium data wrapper according to the input mode of media stream;
In multimedia application scene, the input mode of media stream can have various ways: the media stream of input can Think locally stored file, such as, in digital audio-video place (KTV, bar), Set Top Box plays locally stored music song Vision distortion frequency file or movie file;In addition, the media stream of input can also is that network audio-video stream, such as, family's number Word is televised TV programme, and Online Video is live, and it is many that Online Video program request (VOD) etc. belongs to play network by Set Top Box Media resource, owing to presently, there are multiple data network transmission agreement (such as HTTP, RTMP, RTSP etc.), so using not simultaneous interpretation The network message form of transmission protocol also differs.
In addition, the composition of the media stream of input also has various ways: can be to comprise video and audio frequency simultaneously File or flow data, wherein, audio frequency can be more than one, such as, supports that when video playback switching national language is dubbed or English The video file dubbed, it is simply that encapsulated by the audio frequency of a video and two different languages and form;Can also is that video and audio frequency The file stored respectively or flow data, equally, audio file therein can also have multiple, such as numeral cinemas movie file DCP form is exactly video and the audio frequency of film to be stored respectively, with support multilingual in the case of load different audio frequency, and for example Song resource in KTV, can be made up of a video file and two audio files (for former vocal accompaniment switching).
In conjunction with above-mentioned analysis, owing to the media stream of input can be locally stored file, it is also possible to be to obtain on network The file taken, the procotol simultaneously obtaining media stream employing from network is also possible to difference;Different network protocol is passed Defeated media stream, analysis mode is also not quite similar.For reducing media stream deciphering or the complexity of decapsulation process, this In the preferred embodiment of bright technical scheme, before the deciphering of described media stream or decapsulation, unified pretreatment can be carried out, specifically For: by the media stream in various sources with unified interface output.By pretreatment operation, by the media stream of different agreement, Obtain removing the complete multimedia stream of protocol information after process so that subsequent decryption or decapsulation operation process without paying close attention to association again View related content.
For realizing the reliability of transmitted data on network, no matter using which kind of host-host protocol, conventional mode is all that data are sent out Multimedia original document is splitted into the data block of fixed size by the side of sending, and carries out beating to each data block further according to the agreement used Bag, increases corresponding control information or command information is sent to receiving terminal.The receiving terminal of media stream receives net according to agreement After one sequence data bag of network transmission, need to remove the protocol information in each packet, obtain original multi-medium data Block message, synthesizes original media stream according still further to order by data chunk, then carries out subsequent treatment.In this processing procedure In, local file is owing to without removing protocol information, can being treated as a kind of special agreement and using system with network multimedia stream The processing mode of one.
Such as, RTMP (Real Time Messaging Protocol, real-time messages host-host protocol) is that a kind of design is used Carry out the procotol of real-time data communication, be mainly used in Flash/AIR platform and the Streaming Media/friendship of support RTMP agreement Carry out audio frequency and video and data communication between server mutually, use RTMP agreement to carry out in the scene of multimedia streaming data transmission, When transmitting terminal and receiving terminal mutually send after instruction of shaking hands is successfully connected by network, transmitting terminal by transmission RTMP protocol package to connecing Receiving end, RTMP protocol package is all to transmit according to the bag of fixed size, comprises packet header of a regular length and one up to 128 The inclusion of byte.After receiving terminal receives each protocol package, first send response message and represent to transmitting terminal and be successfully received, RTMP is unpacked simultaneously, remove the packet header of regular length, obtain inclusion data;Will according still further to order information in header packet information The multimedia streaming data that one sequence inclusion data composition is complete.
In the specific embodiment of technical scheme, FFmpeg is used to realize media stream defeated with unified interface Go out, by the protocol information during the first order structure AVIOContext of inputoutput data removes media stream in FFmpeg. Particularly as follows: use FFmpeg (a set of can be used to record, converted digital audio, video, and the meter of increasing income of stream can be translated into Calculation machine program) realize the protocol processes to media stream.Wherein, AVIOContext is that FFmpeg manages inputoutput data Structure, it carry out special disposal agreement related content, the media stream of input different agreement, should by AVIOContext The complete multimedia stream of protocol information is removed in unified interface output.Concrete protocol handling part is given by AVIOContext URLProtocol, URLProtocol use the mode of non-cushioned direct read/write I/O, and AVIOContext realizes there is buffering Read-write.
Step 2, judge whether described multi-medium data wrapper has encryption;
In existing multimedia technology, common a kind of cipher mode is, is encrypted whole multi-medium data wrapper, It is to cannot be carried out follow-up decapsulation and play operation without the multi-medium data wrapper of decryption processing.This step is used for judging Whether the multi-medium data of input is encrypted whole multi-medium data wrapper.
If step 3 has, being then first decrypted described multi-medium data wrapper, decapsulation obtains video counts the most again According to and voice data;
If judging, the multi-medium data of input is the encryption of whole multi-medium data wrapper, then first according to deciphering calculation accordingly Multi-medium data wrapper is decrypted by method.
Such as, certain local multimedia file have employed DES algorithm and carried out file encryption, is carrying out follow-up decapsulation Before operation, need to call DES decipherment algorithm and file is decrypted.
In the particular embodiment, technical scheme is by the second level structure of inputoutput data in FFmpeg The media stream that first order structure AVIOContext is decapsulated by body AVIOContext is decrypted process.Particularly as follows: adopt Realizing the decryption processing to media stream with FFmpeg, (it is FFmpeg decapsulation function to utilize AVFormatContext Structure) two-stage AVIOContext can be used to realize unified deciphering function with the characteristic of self-defined AVIOContext.Its In, the AVIOContext of the first order is responsible for the multimedia sources of input is carried out protocol-dependent pretreatment as mentioned before, obtains Removing the complete multimedia stream of protocol information, media stream information now is in encrypted state;The second level AVIOContext is responsible for the media stream of the output of the AVIOContext to the first order specially and is decrypted process, according to multimedia That flows adds confidential information, uses corresponding decipherment algorithm to decipher frame by frame, the media stream after output deciphering.By increasing by second Level AVIOContext carries out unifying the mode of decryption processing, it is to avoid all need for a kind of new encrypted form under traditional approach Want customized development, the problem causing efficiency low construction cycle length.
After the multimedia streaming data of input is removed agreement and decryption processing, it is possible to multimedia streaming data is entered Row lock out operation, extracts and is encapsulated in video data therein and voice data, and this step simply will be encapsulated in certain and specifically seal Audio frequency and video in dress form (such as flv, mp4, rmvb, avi) are separated, and at not original to audio frequency and video coded system Reason, meanwhile, if the media stream of input includes multiple audio frequency, also can isolate the audio frequency of respective amount.Using FFmpeg carries out under the mode processed, and can enter by AVFormatContext structure is called av_read_frame () method Row decapsulation obtains video data and voice data.
Such as, in a specific embodiment, a media stream using AVI encapsulation format, wherein video uses H.264 coded system, audio frequency uses AAC coded system, obtains a H.264 coded system after being separated by this media stream Video and the audio frequency of AAC coded system.
If step 4 does not has, then directly the decapsulation of described multi-medium data wrapper is obtained video data and audio frequency number According to, then judge whether video data and voice data have encryption, if having, then video data and voice data are decrypted respectively Process.
If judging, the multi-medium data of input is not to be encrypted whole multi-medium data wrapper, then can be direct Multimedia wrapper data are carried out lock out operation, extracts and be encapsulated in video data therein and voice data, concrete mode For: by the second structure AVInputFormat structure self-defining in FFmpeg by first order structure AVIOContext The media stream of removal protocol information carries out decapsulation and obtains video data and voice data, then judges video data and audio frequency number According to whether having encryption, if having, the unified interface of recycling AVIOContext is decrypted process.
Such as, the film play at the cinema is typically DCP (Digital Cinema Package numeral cinemas file Bag) encapsulation format, it is a kind of digital document collection, for storing and change the audio frequency of digitized video, image and data stream, generally Including a video file and the audio file of multiple different language version, when the multimedia of this encapsulation format is processed Time, technical scheme can separate respectively for each file: isolates video data from video file, from often The audio file of individual language version is isolated the voice data of corresponding language.
In application scenes, the cipher mode that multimedia stream file uses is not foregoing to whole multimedia Data wrapper is encrypted, but encrypts video data and voice data respectively, then is packaged into multimedia file.This In the case of, technical scheme, in addition it is also necessary to judge whether isolated video data and voice data have encryption, if had Encryption, then need video data and voice data are decrypted process respectively;Do not process without encryption.The most conventional AES have: AES (Advanced Encryption Standard, Advanced Encryption Standard), RSA (public key encryption algorithm) Etc..
Above-mentioned 4 steps are the general step of technical solution of the present invention, in a preferred embodiment, and many matchmakers of the present invention Body de-encapsulation method, further comprising the steps of: step 5, the video data after decapsulation and more than road voice data to be led to Crossing timestamp to synchronize, Reseal becomes the media stream of general format the most again.
This is to there is numerous multimedia encapsulation format due to multimedia technology field, and traditional Set Top Box player Generally it is both for a certain concrete multimedia encapsulation format and is customized exploitation, many matchmakers of this kind of encapsulation format can only be supported Body file plays out, and versatility is inadequate, causes when needing to support new platform and new encapsulation format, and development efficiency is low, Delivery cycle is long.
Therefore, after abovementioned steps isolates video data and voice data, technical scheme can be again by them It is packaged into unified encapsulation format, such as, mpegts or mpeg4 encapsulation format.Further, the present invention is possible not only to once solving Video data and the voice data of encapsulation carry out Reseal, it is also possible to by video data and the voice data one in alternative document Rise and carry out Reseal.Such as, after a movie file is decapsulated, obtain video data and the sound of corresponding movie file Frequency evidence, owing to the movie file of decapsulation only has a road voice data, such as, only Chinese is dubbed, and at this moment, can find this The English that film video is corresponding is dubbed, and when Reseal, the video data of this film and the English of this film is dubbed, original Chinese dub and carry out Reseal together, thus realize a video file can arbitrarily be increased the purpose of video data, from And make video file more complete.
For not opening the platform of independent audio/video decoder, or for not supporting video file and multiple audio file The platform of the encapsulation format (such as DCP encapsulation format) individually stored, uses Reseal can solve multimedia encapsulation The problem that form is not supported, improves compatibility.Further, since can be to the PTS of audio frequency and video during Reseal (Presentation TimeStamp, Presentation Time Stamp), DTS (Decoding Time Stamp, decoded time stamp) repair Change, such that it is able to control audio-visual synchronization.
Media stream after Reseal, can be directly output to player and play out, represent video content to screen And play audio content, it is also possible to the media stream after Reseal preserves into file, and this mode is commonly used to also want The scene of analyzing and processing further to media stream.Such as, in video monitoring scene, the video signal that headend equipment gathers can Can it is not absolutely required to carry out real-time play show, then after can carrying out decapsulation operation, Reseal becomes to be suitable for follow-up play Form, and preserve into file and store, when follow-up in need time, then the file of required broadcasting found out broadcast Put.
In a preferred embodiment, the multimedia de-encapsulation method of the present invention can apply in Set Top Box, owing to passing The Set Top Box of system is all based on concrete a certain multimedia encapsulation format and cipher mode is customized, develop with strong points still Versatility is inadequate, when running into new multimedia encapsulation format and new cipher mode, there is development efficiency the highest, delivery cycle Long problem.By the multimedia de-encapsulation method of the present invention is applied in Set Top Box, original Set Top Box cannot be able to be propped up The multimedia encapsulation format held decapsulates, then Reseal becomes the encapsulation format that Set Top Box is supported, to increase compatibility;With Time, use unified manner of decryption, it is also possible to reduce secondary development number of times, it is to avoid for a kind of new encryption under traditional approach Form is required for customized development, the problem causing efficiency low construction cycle length.
Such as Fig. 2, it is a kind of multimedia de-encapsulating devices structure chart of the present invention, including:
First processing module, obtains multi-medium data wrapper for the input mode according to media stream;Input many The source of Media Stream can be local file, it is also possible to be network audio-video stream.
In a preferred embodiment, the multimedia de-encapsulating devices of the present invention, it is also possible to arrange the 6th processing module, uses Media stream in the various sources the first processing module obtained, with unified interface output, belongs to local according to media stream File or Internet resources, and which kind of the network transmission protocol Internet resources use, and carries out corresponding pretreatment, gets complete Multi-medium data wrapper.Concrete processing mode is: uses FFmpeg to realize media stream and exports with unified interface, passes through Protocol information during the first order structure AVIOContext of inputoutput data removes media stream in FFmpeg.At this In the AVIOContext processing procedure of level, only need to be concerned about the media stream I/O mode of input, agreement, and need not be concerned about Whether media stream is encrypted, encapsulation format etc..
Whether the second processing module, be multi-medium data wrapper cipher mode for judging the media stream of input.
3rd processing module, if the media stream of input is multi-medium data wrapper cipher mode, this module is to described Multi-medium data wrapper is first decrypted, and decapsulation obtains video data and voice data the most again;
Wherein, being first decrypted described multi-medium data wrapper, the mode that the present invention uses is: utilize in FFmpeg The structure AVFormatContext of decapsulation function can use increase the second level with the characteristic of self-defined AVIOContext AVIOContext realizes unified deciphering function, and the AVIOContext of the second level is responsible for specially the first order described previously The media stream of AVIOContext output is decrypted process, according to the confidential information that adds of media stream, uses corresponding deciphering to calculate Method is deciphered frame by frame, the media stream after output deciphering;Decapsulation step after deciphering simply will be encapsulated in certain and specifically seal Audio frequency and video in dress form (such as flv, mp4, rmvb, avi) are separated, and at not original to audio frequency and video coded system Reason.
Fourth processing module, if the media stream of input is not multi-medium data wrapper cipher mode, this module is direct The decapsulation of multi-medium data wrapper is obtained video data and voice data, then judge media stream be whether video data and Voice data individually distinguishes cipher mode, the most then video data and voice data are decrypted process respectively.Concrete mode For: by the second structure AVInputFormat structure self-defining in FFmpeg by first order structure AVIOContext The media stream of removal protocol information carries out decapsulation and obtains video data and voice data, then judges video data and audio frequency number According to whether having encryption, if having, the unified interface of recycling AVIOContext is decrypted process.
5th processing module, for entering the video data after decapsulation and voice data more than a road by timestamp Row synchronizes, and Reseal becomes the media stream of general format the most again, decreases the playback process media stream encapsulation to input The restriction of form so that follow-up playback process process is simplified, thus bring the compatible and lifting of reliability, and mark is provided Accurate audio and video synchronization method.
Media stream after Reseal can directly play out, or preserve into file and store, and has when follow-up The when of needs, then the file of required broadcasting is found out play out.In the particular embodiment, the multimedia of the present invention De-encapsulating devices can be Set Top Box, it is also possible to for smart machine, such as mobile phone, tablet device etc..Set Top Box is passed through with user As a example by program request Internet video or the local multimedia file of broadcasting, it is as follows that modules realizes function:
First processing module, the when of user's program request Internet video, receives user's program request by wired radio and television network many Media Stream;When user plays local multimedia file time, this module is responsible for loading local multimedia file by file interface, Here local multimedia file can be the file simultaneously comprising video and audio frequency, it is also possible to store respectively for video and audio frequency File.
6th processing module, uses FFmpeg to realize media stream and exports with unified interface, by inputting in FFmpeg The first order structure AVIOContext of output data removes the protocol information in media stream, receives network according to agreement After one sequence data bag of transmission, the protocol information in each packet is removed, obtains original multi-medium data block message, According still further to sequentially data chunk being synthesized original media stream.
Second processing module, it is judged that the multi-medium data of program request or local multimedia file whether multi-medium data wrapper Cipher mode.
3rd processing module, if the multi-medium data of program request or local multimedia file are the encryption of multi-medium data wrapper Mode, then first pass through the AVIOContext of the second level of inputoutput data in FFmpeg defeated to the AVIOContext of the first order After the media stream gone out is decrypted, then multi-medium data wrapper is carried out lock out operation, extract and be encapsulated in therein regarding Frequency evidence and voice data, not original to audio frequency and video coded system processes.
Fourth processing module, if the multi-medium data of program request or local multimedia file are not that multi-medium data wrapper adds Close mode, then by self-defining second structure AVInputFormat structure in FFmpeg by first order structure The media stream of AVIOContext removal protocol information carries out decapsulation and obtains video data and voice data, then judges video Whether data and voice data have encryption, if having, the unified interface of recycling AVIOContext is decrypted process.
5th processing module, for becoming to be suitable for what this Set Top Box was play by video data with described voice data Reseal Unified encapsulation format (MPEG4), and export to playing module, is shown to video data screen by playing module and plays audio frequency Data.
Technical scheme is simply explained in detail by above-mentioned detailed description of the invention, the present invention the most only office It is limited to above-described embodiment, every any improvement according to the principle of the invention or replacement, all should be within protection scope of the present invention.

Claims (13)

1. a multimedia de-encapsulation method, it is characterised in that comprise the following steps:
Input mode according to media stream obtains multi-medium data wrapper;
Judge whether described multi-medium data wrapper has encryption;
If having, being then first decrypted described multi-medium data wrapper, decapsulation obtains video data and audio frequency number the most again According to;
If no, then directly the decapsulation of described multi-medium data wrapper is obtained video data and voice data, then judges to regard Whether frequency evidence and voice data have encryption, if having, then video data and voice data are decrypted process respectively.
2. multimedia de-encapsulation method as claimed in claim 1, it is characterised in that further comprising the steps of:
Video data after decapsulation and voice data more than a road are synchronized by timestamp, Reseal the most again Become the media stream of general format.
3. multimedia de-encapsulation method as claimed in claim 1, it is characterised in that the source of the media stream of described input is Local file and/or network audio-video stream, before the deciphering of described media stream or decapsulation, need to carry out pretreatment, particularly as follows: will be each Plant the media stream in source with unified interface output.
4. multimedia de-encapsulation method as claimed in claim 3, it is characterised in that use FFmpeg to realize media stream with system The interface output of one, removes the protocol information in media stream by the first order structure AVIOContext in FFmpeg.
5. multimedia de-encapsulation method as claimed in claim 4, it is characterised in that described step is " if having, then to described many matchmakers Volume data wrapper is first decrypted " particularly as follows: by self-defining second level structure AVIOContext in FFmpeg to the Primary structure body AVIOContext removes the media stream of protocol information and is decrypted process.
6. multimedia de-encapsulation method as claimed in claim 1, it is characterised in that described step is not " if having, then directly by institute State the decapsulation of multi-medium data wrapper and obtain video data and voice data, then judge whether video data and voice data have Encryption, if having, is then decrypted process to video data and voice data respectively " particularly as follows: by self-defining in FFmpeg First order structure AVIOContext is removed the media stream of protocol information by the second structure AVInputFormat structure Carry out decapsulation and obtain video data and voice data, then judge whether video data and voice data have encryption, if having, then profit It is decrypted process by the unified interface of AVIOContext.
7. a multimedia de-encapsulating devices, it is characterised in that including:
First processing module, obtains multi-medium data wrapper for the input mode according to media stream;
Second processing module, is used for judging whether described multi-medium data wrapper has encryption;
3rd processing module, if for having, being then first decrypted described multi-medium data wrapper, decapsulation obtains the most again Video data and voice data;
Fourth processing module, if for not having, then directly the decapsulation of described multi-medium data wrapper is obtained video data and Voice data, then judge whether video data and voice data have encryption, if having, then video data and voice data are entered respectively Row decryption processing.
8. multimedia de-encapsulating devices as claimed in claim 7, it is characterised in that also include:
5th processing module, for carrying out same by the video data after decapsulation and voice data more than a road by timestamp Step, Reseal becomes the media stream of general format the most again.
9. multimedia de-encapsulating devices as claimed in claim 7, it is characterised in that the source of the media stream of described input is Local file and/or network audio-video stream;Between described first processing module and described second processing module, also include the 6th Processing module, for exporting the media stream in various sources with unified interface.
10. multimedia de-encapsulating devices as claimed in claim 9, it is characterised in that described 6th processing module is by various next The media stream in source, with unified interface output, exports particularly as follows: use FFmpeg to realize media stream with unified interface, logical Cross the first order structure AVIOContext in FFmpeg and remove the protocol information in media stream.
11. multimedia de-encapsulating devices as claimed in claim 10, it is characterised in that in described 3rd processing module " if having, Then described multi-medium data wrapper is first decrypted " particularly as follows: by self-defining second level structure in FFmpeg The media stream that first order structure AVIOContext is removed protocol information by AVIOContext is decrypted process.
12. multimedia de-encapsulating devices as claimed in claim 10, it is characterised in that " if not having in described fourth processing module Have, then directly the decapsulation of described multi-medium data wrapper obtained video data and voice data, then judge video data and Whether voice data has encryption, if having, then video data and voice data is decrypted process respectively " particularly as follows: pass through In FFmpeg, first order structure AVIOContext is removed association by self-defining second structure AVInputFormat structure The media stream of view information carries out decapsulation and obtains video data and voice data, then judges whether are video data and voice data Having encryption, if having, the unified interface of recycling AVIOContext is decrypted process.
The application of 13. 1 kinds of multimedia de-encapsulation method, it is characterised in that: described multimedia de-encapsulation method is applied to Set Top Box In.
CN201610785286.8A 2016-08-31 2016-08-31 Multimedia de-encapsulation method and device Active CN106331853B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610785286.8A CN106331853B (en) 2016-08-31 2016-08-31 Multimedia de-encapsulation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610785286.8A CN106331853B (en) 2016-08-31 2016-08-31 Multimedia de-encapsulation method and device

Publications (2)

Publication Number Publication Date
CN106331853A true CN106331853A (en) 2017-01-11
CN106331853B CN106331853B (en) 2019-10-25

Family

ID=57789792

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610785286.8A Active CN106331853B (en) 2016-08-31 2016-08-31 Multimedia de-encapsulation method and device

Country Status (1)

Country Link
CN (1) CN106331853B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107360402A (en) * 2017-08-30 2017-11-17 陕西千山航空电子有限责任公司 A kind of HD video recording method based on RTSP agreements
CN108810575A (en) * 2017-05-04 2018-11-13 杭州海康威视数字技术股份有限公司 A kind of method and apparatus sending target video
CN109309670A (en) * 2018-09-07 2019-02-05 深圳市网心科技有限公司 Data stream method and system, electronic device and computer readable storage medium
WO2021072878A1 (en) * 2019-10-15 2021-04-22 平安科技(深圳)有限公司 Audio/video data encryption and decryption method and apparatus employing rtmp, and readable storage medium
CN113873275A (en) * 2021-09-13 2021-12-31 乐相科技有限公司 Video media data transmission method and device
CN114500475A (en) * 2021-12-31 2022-05-13 赛因芯微(北京)电子科技有限公司 Network data transmission method, device and equipment based on real-time transmission protocol

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101998384A (en) * 2009-08-18 2011-03-30 中国移动通信集团公司 Method for encrypting transmission medium stream, encryption server and mobile terminal
CN102202237A (en) * 2010-03-22 2011-09-28 乐金电子(中国)研究开发中心有限公司 Channel browsing display method, device and receiver for digital television
CN102665103A (en) * 2012-04-13 2012-09-12 烽火通信科技股份有限公司 Audio and video packaging method applicable to streaming media services
EP2596633A4 (en) * 2010-07-20 2014-01-15 Nokia Corp A media streaming apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101998384A (en) * 2009-08-18 2011-03-30 中国移动通信集团公司 Method for encrypting transmission medium stream, encryption server and mobile terminal
CN102202237A (en) * 2010-03-22 2011-09-28 乐金电子(中国)研究开发中心有限公司 Channel browsing display method, device and receiver for digital television
EP2596633A4 (en) * 2010-07-20 2014-01-15 Nokia Corp A media streaming apparatus
CN102665103A (en) * 2012-04-13 2012-09-12 烽火通信科技股份有限公司 Audio and video packaging method applicable to streaming media services

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
胡平华,黄险峰: "基于Linux系统的freerdp多媒体重定向", 《电子质量》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108810575A (en) * 2017-05-04 2018-11-13 杭州海康威视数字技术股份有限公司 A kind of method and apparatus sending target video
CN107360402A (en) * 2017-08-30 2017-11-17 陕西千山航空电子有限责任公司 A kind of HD video recording method based on RTSP agreements
CN109309670A (en) * 2018-09-07 2019-02-05 深圳市网心科技有限公司 Data stream method and system, electronic device and computer readable storage medium
CN109309670B (en) * 2018-09-07 2021-02-12 深圳市网心科技有限公司 Data stream decoding method and system, electronic device and computer readable storage medium
WO2021072878A1 (en) * 2019-10-15 2021-04-22 平安科技(深圳)有限公司 Audio/video data encryption and decryption method and apparatus employing rtmp, and readable storage medium
CN113873275A (en) * 2021-09-13 2021-12-31 乐相科技有限公司 Video media data transmission method and device
CN113873275B (en) * 2021-09-13 2023-12-29 乐相科技有限公司 Video media data transmission method and device
CN114500475A (en) * 2021-12-31 2022-05-13 赛因芯微(北京)电子科技有限公司 Network data transmission method, device and equipment based on real-time transmission protocol
CN114500475B (en) * 2021-12-31 2024-02-09 赛因芯微(北京)电子科技有限公司 Network data transmission method, device and equipment based on real-time transmission protocol

Also Published As

Publication number Publication date
CN106331853B (en) 2019-10-25

Similar Documents

Publication Publication Date Title
CN106331853B (en) Multimedia de-encapsulation method and device
CN102761779B (en) Conditional Access Module and its system and the apparatus and method for being sent to encryption data
JP7099510B2 (en) Receiver and receiving method
CN103873888A (en) Live broadcast method of media files and live broadcast source server
CN106657113B (en) A kind of conversion method and system of multiplexing protocols in broadcast network
CN107911684A (en) Reception device and method of reseptance
JPWO2016009944A1 (en) Transmitting apparatus, transmitting method, receiving apparatus, and receiving method
KR101343527B1 (en) Method for Producing and playing Digital Cinema Contents and Apparatus for producing and playing digital cinema contents using the method
JP2017085203A (en) Transmission device, transmission method, reception device, and reception method
JP6715910B2 (en) Subtitle data processing system, processing method, and program for television programs simultaneously distributed via the Internet
EP3306942B1 (en) Transmission device, transmission method, receiving device, and receiving method
JP2021119712A (en) Transmission device, transmission method, media processing device, media processing method, and reception device
CN109743627B (en) Playing method of digital movie package based on AVS + video coding
EP3668101B1 (en) Transmission device, transmission method, reception device, and reception method
JP4755717B2 (en) Broadcast receiving terminal device
US10812838B2 (en) Transmission device, transmission method, reception device, and reception method
CN111901692B (en) System for synthesizing VR (virtual reality) based on multi-audio and video streams
EP3160156A1 (en) System, device and method to enhance audio-video content using application images
JP6958645B2 (en) Transmitter, transmitter, receiver and receiver
CN106454408A (en) Method, device and system for realizing safe transmission of video streams
KR20100001045A (en) System for preventing illegal utilization of broadcasting contents in iptv broadcasting service and method thereof
CN115695858A (en) SEI encryption-based virtual film production video master film coding and decoding system, method and platform
JP2021129319A (en) Content output method
JP2020188516A (en) Content protection method
TW201240393A (en) System and method for decrypting multi-media stream data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant