CN1972444A - MPEG2 file real-time playing method based on single-input interface - Google Patents

MPEG2 file real-time playing method based on single-input interface Download PDF

Info

Publication number
CN1972444A
CN1972444A CNA2005100454429A CN200510045442A CN1972444A CN 1972444 A CN1972444 A CN 1972444A CN A2005100454429 A CNA2005100454429 A CN A2005100454429A CN 200510045442 A CN200510045442 A CN 200510045442A CN 1972444 A CN1972444 A CN 1972444A
Authority
CN
China
Prior art keywords
file
mpeg2
data
rtp
information
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
CNA2005100454429A
Other languages
Chinese (zh)
Other versions
CN100473162C (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.)
Hisense Group Co Ltd
Original Assignee
Hisense Group 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 Hisense Group Co Ltd filed Critical Hisense Group Co Ltd
Priority to CNB2005100454429A priority Critical patent/CN100473162C/en
Publication of CN1972444A publication Critical patent/CN1972444A/en
Application granted granted Critical
Publication of CN100473162C publication Critical patent/CN100473162C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

This invention relates to one MPEG2 file real-time play method based on single input interface, which is aimed for single input interface decoder chip through RTSP, RTP/RTCP transmission agreement to isolate audio or visual frequency data to integrate similar MPEG2 PS system form data flow file to realize flow media file download and real time play. This method adopts reverse process in sealing process to restore MPEG flow.

Description

Based on the real-time method of playing of the MPEG2 file of single-input interface
Technical field
The present invention is a kind of MPEG2 files in stream media of realizing in the single-input interface IP set-top box, the method for downloading and playing in real time.
Background technology
At present because the restriction of aspects such as the network bandwidth, the disposal ability of hardware own and protocol specification is downloaded a large amount of sound, video multimedia data from the network media, download time and memory space all there is very high requirement.Smaller for memory space, real-time is required than the higher single-input interface IP set-top box, it is particularly outstanding that this contradiction just seems.
The existing stream media technology that adopts has solved this difficult problem well.Stream is the new ideas that occur on network in recent years, mainly is meant the technology general name by the Network Transmission multi-medium data.
Streaming Media then comprises broad sense and two kinds of intensions of narrow sense: sensu lato Streaming Media refers to and makes Voice ﹠ Video form the general name of a series of technology, method and the agreement of stable and continuous transport stream and playback stream, i.e. stream media technology; Sense stricto Streaming Media is for traditional download-playback mode, refers to a kind of new method of obtaining multi-medium datas such as Voice ﹠ Video from network, and it can be supported the real-time Transmission of multimedia data stream and play in real time.Pass through stream media technology, server can send stable and continuous multimedia data stream to client, client with a stable speed playback, is carried out playback more afterwards, is promptly realized a kind of pattern of real-time broadcast and need not wait data all to download when receiving data.
That Streaming Media transmission is at present mainly adopted is RTSP, the RTP/RTCP agreement.Real-time Transport Protocol separate transmission in when transmission with sound, video data, and the data that receive of client comprise independently sound, video file like this, so the method that receives the decode respectively of general software player employing sound, video, shown in accompanying drawing 3 afterwards.And existing being specifically designed to supports that the hardware decoding chip of playing stream media is less, and the typical hardware decoding chip only supports the local file of single interface to play, so this class decoder can't transmit at Real-time Transport Protocol, and data are decoded and real-time the broadcast.
Summary of the invention
The method of playing in real time based on the MPEG2 file of single-input interface of the present invention, its purpose is to address the above problem and at existing single-input interface decoding chip, will be through RTSP, the sound that the RTP/RTCP host-host protocol separates, video data are with reference to MPEG2 PS streaming system file organization form, the data streaming file of synthetic similar MPEG2 system format, thus be implemented in download and the broadcast in real time of carrying out the MPEG2 files in stream media in the single-input interface IP set-top box.
The method that described MPEG2 file based on single-input interface is play in real time is to take a kind of process in contrast at the encapsulation process of RTP data file, promptly realizes being reduced into mpeg stream by the RTP bag on decoder.
According to RFC3550 and RFC2250, when streaming media server end mpeg stream is packaged into the Real-time Transport Protocol bag, a video RTP bag, fixedly packet header, MPEG video specific header (having extension header), RTP payload three parts constitute by RTP.An audio frequency RTP bag, fixedly packet header, mpeg audio specific header, RTP payload three parts constitute by RTP.
Said process is actually MPEG2 is carried out the process that system layer is resolved, and promptly some important information of search are filled in the RTP bag in several important data structures from mpeg stream, finish the encapsulation of a RTP bag simultaneously according to existing standard.
And the described method of playing in real time based on the MPEG2 file of single-input interface, be to finish decoder according to the significant data in the RTP bag to play in real time, and the PACK and the PACKET header data of realization MPEG2 Streaming Media are filled, and the elementary stream that obtains by RTP sequence number buffer memory reorganization, after forming complete MPEG2 data format, send into decoder and decode, play.
Compare with the multiplex data of local file through the separated media data that obtain after the RTP transmission, lacked the header information of original whole M PEG2 file on the one hand; On the other hand, the PACK header information in the MPEG2 file is not transmission also, just some field mappings is arrived the RTP head.
The method that described MPEG2 file based on single-input interface is play in real time obtains file decoding information according to some control informations in the RTSP flow transmission, is used for the initiating hardware decoder;
Obtain the informations parameter such as type, coded format and duration of medium among the SDP (Session Description Protocol, i.e. Session Description Protocol) by RTSP agreement acquisition file.Wherein, SDP is used to illustrate the base attribute of a flow media session, comprises the time range of medium type and coded format, needed transmission bandwidth, broadcast, required Buffer information etc.
Fill the PACK and the PACKET head of every frame data according to the MPEG2 Standard File Format, the packet header by the RTP bag obtains coded format and timestamp;
Fill corresponding file header information according to MPEG2 PS file standard (being ISO/IEC 13818 standards), form the complete file header format, and the elementary stream that obtains by the reorganization of RTP sequence number buffer memory, and deliver to hardware decoder by buffer memory.
As above-mentioned content, angle from hardware decoder, the MPEG2 data of reformulating do not have essential distinction with the local file format of playing, thereby can be by existing decoder to downloading, recombinate and play in real time through the separated media data that obtain after the RTP transmission.
The described method of playing in real time based on the MPEG2 file of single-input interface, its realization flow is:
The first step, the SDP information analysis by the RTSP protocol transmission goes out the fileinfo parameter that decoder is play in real time to be needed.
The information parameter that can obtain from SDP information includes, file type, and the duration, audio frequency, the coded format of video, sample frequency, maximum rates etc., above-mentioned parameter are used for the initiating hardware decoder.
In second step, receive the RTP bag that comprises stream medium data from the webserver.
At reference information, at first, distinguish audio frequency or video data according to the loadtype in the RTP bag;
Then according to the sequence number that comprises in the RTP bag, from the RTP bag, extract media data and recombinate; Audio frequency after the reorganization, video data file are the basic stream of arranging in order, but still are not complete, as to have logical meaning PACK files at this moment, therefore directly give decoder and can't decode and broadcast in real time.
In the 3rd step, each frame of audio frequency, video data is all added a PACK head.
In the 4th step, PACKET head on increasing respectively again before each frame of audio frequency, video data is audio frame, or frame of video to show it, and fills the buffering area field according to SDP information.
Fill demonstration timestamp PTS field according to the timestamp information in the RTP packet header, the field of other PACKET head is according to fixed format inserted corresponding position information.
In the 5th step, with amended metadata cache, by decoding with the decoder of sending into alternately of hardware decoder, and the data that will have a complete MPEG2 system file header format are play in real time.
Shown in above-mentioned method step, in realizing the process that MPEG2 stream medium data PACK and PACKET head are filled, the PACK numeric data code in the MPEG2 stream medium data, multiplex rate, System Target Decoder buffer data all acquire from SDP information.
Stream type in the MPEG2 stream medium data and demonstration timestamp directly obtain from the mapping of RTP head.
Shown in above-mentioned method step, when adding the PACK head before each frame of audio or video data, multiplex rate is drawn by following formula:
Wherein,
Audio rate and video rate are by drawing in " a=AvgBitRate:integer " field in the SDP information;
PACKET length is fixed value, is by obtaining in (a=AvgPacketSize:integer) field in the SDP information.
The method that the MPEG2 file of described single-input interface is play in real time, its advantage is: can be based on the existing real-time playing stream media file of decoding chip of playing local file, not only reduce system design and hardware input cost, and under the situation that does not increase amount of calculation, realized video on-demand function.
Description of drawings
Fig. 1 is that the SDP in the RTSP agreement describes;
Fig. 2 is a RTP header format schematic diagram;
Fig. 3 is existing RTP transfer of data and decoding process schematic diagram;
Fig. 4 is the PACK schematic diagram of MPEG2 stream medium data;
Fig. 5 is the PACKET schematic diagram of MPEG2 stream medium data;
Fig. 6 realizes MPEG2 stream medium data PACK and PACKET head filling schematic diagram according to the method for the invention;
Fig. 7 is the real-time playing flow figure of decoding chip of the present invention.
Embodiment
Embodiment 1, and as shown in drawings, the real-time method step of playing of described MPEG2 file based on single-input interface is as follows:
The first step, the SDP information analysis by the RTSP protocol transmission goes out the fileinfo parameter that decoder is play in real time to be needed.
The information parameter that can obtain from SDP information includes, file type, and the duration, the coded format of audio frequency, video, sample frequency, maximum rates etc., above-mentioned parameter are used for the initiating hardware decoder.
As shown in Figure 1, the broadcast support information that can obtain of the following parameters among the SDP has:
" m=(media name and transport address) " field obtains medium type and coded format;
The form of " a=* (0 or a plurality of session attribute capable) " field is a=<attribute 〉:<value 〉, wherein attribute includes, the wide height of duration, sample frequency, maximum rate, video, the passage number of audio frequency etc.;
In second step, receive the RTP bag that comprises stream medium data from the webserver.
As shown in Figure 2, in the RTP bag, include following reference information,
" Ver " is Real-time Transport Protocol version number;
" P " is used to indicate whether the end of this RTP bag includes additional information;
" X " is used for sign and whether has extended head;
" CC " is used for sign and has what CSRC marks behind fixing head;
" M " is flag bit;
The type of entrained information in " loadtype " marking RTP bag;
" SSRC " is used for the identification data source;
The data source of " CSRC " sign contribution.
At above-mentioned reference information, at first, distinguish audio frequency or video data according to the loadtype in the RTP bag; Then according to the sequence number that comprises in the RTP bag, from the RTP bag, extract media data and recombinate; Audio frequency after the reorganization, video data file are the basic stream of arranging in order.
In the 3rd step, each frame of audio frequency, video data is all added a PACK head.
As shown in Figure 4, to be set to be 00 00 01 BA to the initial code of PACK head;
Then fill 2 fixed bits ' 01 ';
46bit subsequently is the system reference clock, and the time of System Target Decoder is sent in expression; Except the flag bit that intert the centre everybody all is filled to 0; This is because we adopt the mode of manually sending into, and the time-dependent of decoding is in the time of manually sending into, and therefore being filled to 0 can not influence the decoder normal decoder;
Be 24 multiplex rate then, show that code stream enters the speed of decoder, multiplex rate is calculated by following expression formula and is drawn:
Wherein,
Audio rate and video rate are by drawing in " a=AvgBitRate:integer " field in the SDP information;
PACKET length is fixed value, is by obtaining in (a=AvgPacketSize:integer) field in the SDP information.
The reservation position of back all is set to 1, does not need byte of padding simultaneously, so 3 bytes of the expression byte of padding length of back are filled to 0.
In the 4th step, PACKET head on increasing respectively again before each frame of audio frequency, video data is audio frame, or frame of video and decode time etc. to show it.
According to the type of the PT field infilled frame in the RTP packet header, fill the PTS field according to the timestamp information in the RTP packet header, the field of other PACKET head is according to fixed format inserted corresponding position information.
Particularly, as shown in Figure 5,
The start code prefix of PACKET head is 00 00 01;
Ensuing 8 bit are stream_id, the type of expression stream; If audio frame then is filled to C0; If frame of video then is filled to E0;
Then 16 is PACKET length (packet_length), adds the acquisition of data length by calculating packet header length;
Fill 2 fixed bits ' 10 ' then, flag bit PES_scrambling_control thereafter (encrypting control), PES_priority (load priority), data_alignment_indicator (immediately following the addressed location data type behind the PES packet header), ESCR_flag (whether the ESCR field is arranged), ES_rate_flag (whether the ES_rate field is arranged) and PES_CRC_flag (whether crc field is arranged) equipotential are set to ' 0 ' simultaneously; Flag bit PES_extension_flag is set to 1, shows that there is an extension field in this PACKET back; PTS_DTS_flags is set to ' 10 ', and the timestamp that shows the back is PTS.
Follow next byte, but the data length of favored area in the expression PACKET head is made as 5, promptly the length of PTS is 5 bytes.
Next fill 4 fixedly bit ' 0010 ', show that the back is decoded time stamp PTS;
Then the timestamp in the RTP packet header is mapped to PTS;
Because it is 1 that the front is provided with flag bit PES_extension_flag, so have following extension field:
Flag bit PES_private_data_flag, pack_header_field_flag, program_packet_sequence_counter_flag all are set to 0;
Flag bit P-STD_buffer_flag is changed to 1;
Be that 3bit keeps the position then, all put 0;
Flag bit PES_extension_flag_2 puts 1, and there is the PES_extension_field_length field sign back;
Fill 2 fixed bits ' 01 ' subsequently, show that follow later is the big or small P-STD_buffer_size (13 bit) of System Target Decoder buffering area zoom factor P-STD_buffer_scale (1 bit) and System Target Decoder buffering area;
For the P-STD_buffer_scale field, if audio frame then is filled to 0; If frame of video then is filled to 1;
For the P-STD_buffer_size field, it represents the size of decoder buffer, at first judges the size (by obtaining among the SDP) of wide (a=Width:integer) and high (a=Height:integer) of video during filling.If wide smaller or equal to 320, higher primary school is in equaling 240, and then whole 16 (2 bit fixed bits ' 01 '+1 bit P-STD_buffer_scale+13 bit P-STD_buffer_size) audio frequency are filled to " 40 20 ", and video then is filled to " 60 2E ";
If do not satisfy this agreement, then video buffer size then from [64 * 1024] and
Figure A20051004544200101
In get bigger one, wherein, R VmaxBe maximum video rate, it obtains from " a=MaxBitRate:integer " field of SDP information;
Audio buffer, maximum are got 32 * 128 bytes.
Because front flag bit PES_extension_flag_2 is set to 1,, fill by the length of calculating extension field so next be the PES_extension_field_length field.
In the 5th step, with amended metadata cache, by decoding with the decoder of sending into alternately of hardware decoder, and the data that will have a complete MPEG2 system file header format are play in real time.
Shown in Fig. 6 and said method step, in realizing the process that MPEG2 stream medium data PACK and PACKET head are filled,
PACK numeric data code in the MPEG2 stream medium data, multiplex rate, System Target Decoder buffer data all acquire from SDP information.
Stream type in the MPEG2 stream medium data and demonstration timestamp directly obtain from the mapping of RTP head.
As shown in Figure 7, use to support the decoder that single interface, local file are play, the method play in real time of MPEG2 file as described in the present invention,
At first, carry out hardware initialization;
Then, obtain SDP information by the RTSP agreement and analyze the support broadcast information that decoder needs;
Subsequently, decoder is by judging whether alternately and can decoding; If can decode, then utilize the RTP/RTCP agreement to receive data, after realizing that MPEG2 stream medium data PACK and PACKET head are filled, in decoder, send into sound, video data alternately, to decode and to play in real time according to flag bit;
Said process is until finishing the decoded and broadcast of total data.

Claims (4)

1, the method play in real time of a kind of MPEG2 file based on single-input interface is characterized in that: obtain file decoding information according to some control informations in the RTSP flow transmission, be used for the initiating hardware decoder;
Obtain related information parameters among the SDP by RTSP agreement acquisition file;
Fill the PACK and the PACKET head of every frame data according to the MPEG2 Standard File Format, the packet header by the RTP bag obtains coded format and timestamp;
Fill corresponding file header information according to the MPEG2 file standard, form the complete file header format, and the elementary stream that obtains by the reorganization of RTP sequence number buffer memory, and deliver to hardware decoder by buffer memory.
2, the method play in real time of the MPEG2 file based on single-input interface according to claim 1 is characterized in that: the method flow that described MPEG2 file is play in real time is,
The first step, the SDP information analysis by the RTSP protocol transmission goes out the fileinfo parameter that decoder is play in real time to be needed;
In second step, receive the RTP bag that comprises stream medium data from the webserver;
At reference information, at first, distinguish audio frequency or video data according to the loadtype in the RTP bag; Then according to the sequence number that comprises in the RTP bag, from the RTP bag, extract media data and recombinate; Audio frequency after the reorganization, video data file are the basic stream of arranging in order;
In the 3rd step, each frame of audio frequency, video data is all added a PACK head;
In the 4th step, PACKET head on increasing respectively again before each frame of audio frequency, video data is audio frame, or frame of video to show it, and fills the buffering area field according to SDP information; Fill demonstration timestamp PTS field according to the timestamp information in the RTP packet header, the field of other PACKET head is according to fixed format inserted corresponding position information;
In the 5th step, with amended metadata cache, by decoding with the decoder of sending into alternately of hardware decoder, and the data that will have a complete MPEG2 system file header format are play in real time.
3, the method for playing in real time based on the MPEG2 file of single-input interface according to claim 2, it is characterized in that: in realizing the process that MPEG2 stream medium data PACK and PACKET head are filled, the PACK numeric data code in the MPEG2 stream medium data, multiplex rate, System Target Decoder buffer data all acquire from SDP information;
Stream type in the MPEG2 stream medium data and demonstration timestamp directly obtain from the mapping of RTP head.
4, the method for playing in real time based on the MPEG2 file of single-input interface according to claim 3, it is characterized in that: when adding the PACK head before each frame of audio or video data, multiplex rate is drawn by following formula,
Figure A2005100454420003C1
Wherein,
Audio rate and video rate are by drawing in " a=AvgBitRate:integer " field in the SDP information;
PACKET length is fixed value, is by obtaining in (a=AvgPacketSize:integer) field in the SDP information.
CNB2005100454429A 2005-11-27 2005-11-27 MPEG2 file real-time playing method based on single-input interface Active CN100473162C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2005100454429A CN100473162C (en) 2005-11-27 2005-11-27 MPEG2 file real-time playing method based on single-input interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2005100454429A CN100473162C (en) 2005-11-27 2005-11-27 MPEG2 file real-time playing method based on single-input interface

Publications (2)

Publication Number Publication Date
CN1972444A true CN1972444A (en) 2007-05-30
CN100473162C CN100473162C (en) 2009-03-25

Family

ID=38112986

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2005100454429A Active CN100473162C (en) 2005-11-27 2005-11-27 MPEG2 file real-time playing method based on single-input interface

Country Status (1)

Country Link
CN (1) CN100473162C (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010078763A1 (en) * 2008-12-29 2010-07-15 中兴通讯股份有限公司 Stream media server, client terminal and method and system for downloading stream media
CN101621342B (en) * 2008-06-30 2011-05-11 中兴通讯股份有限公司 Method for realizing network TV program carousel based on real-time transport protocol

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101621342B (en) * 2008-06-30 2011-05-11 中兴通讯股份有限公司 Method for realizing network TV program carousel based on real-time transport protocol
WO2010078763A1 (en) * 2008-12-29 2010-07-15 中兴通讯股份有限公司 Stream media server, client terminal and method and system for downloading stream media

Also Published As

Publication number Publication date
CN100473162C (en) 2009-03-25

Similar Documents

Publication Publication Date Title
US11665384B2 (en) Method and apparatus for transmitting media data in multimedia transport system
EP2270681B1 (en) Method and apparatus for media data transmission
CN1764974B (en) Storage medium storing multimedia data, and method and apparatus for reproducing multimedia data
US8719309B2 (en) Method and apparatus for media data transmission
CN102714624B (en) For the method and apparatus that the self adaptation stream using segmentation is transmitted
US8239558B2 (en) Transport mechanisms for dynamic rich media scenes
CN100464586C (en) MPEG1 file real-time playing method based on IP STB
CN101505316A (en) Method and device for reordering and multiplexing multimedia packets from multimedia streams pertaining to interrelated sessions
CN101842786A (en) Fast and editing-friendly sample association method for multimedia file formats
TW202032998A (en) Multiple decoder interface for streamed media data
CN101802823A (en) Segmented metadata and indexes for streamed multimedia data
JP4308555B2 (en) Receiving device and information browsing method
CN1972454A (en) Mobile multimedia broadcasting real-time traffic flow packaging method
CN1972453B (en) A data flow packaging method of mobile multimedia broadcasting system
CN1972408A (en) A data transmission method for mobile multimedia broadcasting system
CN100473162C (en) MPEG2 file real-time playing method based on single-input interface
GB2469563A (en) A method system and apparatuses for processing readable content stored in a stream of data
Setlur et al. More: a mobile open rich media environment
JP4794640B2 (en) Transmitting apparatus and media data transmitting method
WO2008043212A1 (en) A method for transferring assistant data in mobile multi-media broadcast
CN101198068A (en) Auxiliary data encapsulation method for media data flow of multimedia broadcasting system
AU2012203922A1 (en) Method and apparatus for media data transmission

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant