Embodiment
The embodiment of the invention provides a kind of media stream sending method, streaming media server, encoder and decoder, in order to improve real-time and the fluency in the media flow transmission process, make client can play the Media Stream that obtains in real time, glibly, thereby strengthened customer experience.
Below in conjunction with accompanying drawing the technical scheme that the embodiment of the invention provides is described.
Referring to Fig. 1, the system of a kind of media flow transmission that the embodiment of the invention provides comprises:encoder 11,streaming media server 12 and decoder 13.Wherein,encoder 11 can be positioned at one independently on the server, also can be positioned on thestreaming media server 12;Decoder 13 can be positioned at client.
Preferably,encoder 11 comprises:
Coding unit 111 is used for adopting different code check codings to obtain a plurality of files in stream media at the Same Scene content, and these files in stream media constitute a resultant current media file; Perhaps,coding unit 111 can also be used for adopting different code check codings to obtain a plurality of real-time media streams at the Same Scene content, and these real-time media streams constitute a synthetic code stream.
Transmittingelement 112, be used for adopting different code check codings to obtain the resultant current media file at the Same Scenecontent coding unit 111 and send to describedstreaming media server 12, perhaps adopt different code check codings to obtain synthetic code stream at the Same Scene content describedcoding unit 111 and send to streamingmedia server 12 in real time.
Encoder 11 sends the resultant current media file or the synthetic code stream of various code rate, bandwidth betweenstreaming media server 12 dynamic detections and the client, and according to Bandwidth Dynamic the code stream code check of thedecoder 13 of client is mail in adjustment, thereby realization bandwidth self-adaption, both guarantee the real-time of Media Stream, guaranteed the fluency of Media Stream again.
Preferably, describedcoding unit 111 is if adopt different code check codings to obtain a plurality of files in stream media at the Same Scene content, and then in these files in stream media, different files in stream media is identical in the pairing scene content of synchronization; If adopt different code check codings to obtain a plurality of real-time media streams at the Same Scene content, then these different real-time media streams are also identical in the pairing scene content of synchronization.
That is to say,streaming media server 12 can have dual mode to transmit the Media Stream thatcoding unit 111 sends, a kind of is to obtain the resultant current formed at a plurality of Media Streams that the Same Scene content adopts different code checks coding to obtain fromcoding unit 111, and synthetic stream stored, obtain a plurality of files in stream media, and then from these files in stream media, read Media Stream and send to thedecoder 13 of client, the Media Stream that adopts this mode to send can abbreviate storage flow as; Another kind of mode is to obtain in real time adopting different code check codings to obtain a plurality of real-time media streams at the Same Scene content fromcoding unit 111, and is transmitted to thedecoder 13 of client in real time, and the Media Stream that adopts this mode to send can abbreviate real-time stream as.Wherein, described real-time stream can be to be stored in advance in thecoding unit 111, and promptly forcoding unit 111, this real-time stream is actually storage flow.
Describedstreaming media server 12 comprises:
Bandwidth determining unit 121 is used for the network state information according to client feedback, determines the current bandwidth between describedstreaming media server 12 and the client.
Codecheck determining unit 122 is used for according to current bandwidth, determines the code check of the current Media Stream that need send to client.
MediaStream transmitting element 123 is used for sending the Media Stream that adopts described code check determiningunit 122 current definite code check codings to obtain to client.
Wherein, the operation of feedback network state information can be carried out by the decoder in theclient 13, also can be carried out by other modules.
Preferably, described code check determiningunit 122 comprises:
The corresponding relation unit is used for the corresponding relation of memory bandwidth and code check in advance.
Determining unit is used for according to the current bandwidth betweenstreaming media server 12 and the client, and the bandwidth of storing in the described corresponding relation unit and the corresponding relation of code check, determines the code check of the current Media Stream that need send to client.
At the mode that sends storage flow, describedstreaming media server 12 also comprises:
Memory cell is used for storing in advance a plurality of files in stream media that adopt different code check codings to obtain at the Same Scene content.
At this moment, described Media Stream transmittingelement 123 comprises:
The files in stream media determining unit, be used for determining the current scene content that need send to client, and determine the pairing a plurality of files in stream media of this scene content, and, from these files in stream media, search the files in stream media that adopts this code check coding to obtain according to current definite code check.
The current frame data determining unit is used for according to current time, finds the present frame stream medium data that need send to client from the current definite files in stream media of this files in stream media determining unit, and this frame stream medium data is sent to client.
At sending the mode of stream in real time, describedstreaming media server 12 also comprises:
The real-time media stream acquiring unit is used for obtaining in real time a plurality of real-time media streams that adopt different code check codings to obtain at the Same Scene content.
At this moment, described Media Stream transmittingelement 123 according to current definite code check, is searched the Media Stream that adopts this code check coding to obtain, and this Media Stream is sent to client from a plurality of real-time media streams.
Preferably, the decoder in theclient 13 comprises:
Decoding unit 131 is used for the Media Stream that receives is decoded.
Networkstatus monitoring unit 132 is used for the packet loss state that monitoring media flows, and determines current network state information according to the packet loss state.
Networkstate feedback unit 133 is used for to describedstreaming media server 12 feedback network state informations.For example, can pass through RTCP Real-time Transport Control Protocol (RTCP) message feedback network state information.
Wherein, networkstatus monitoring unit 132 and networkstate feedback unit 133 also can be independent of outside thedecoder 13 and be arranged in the client.
For example, theencoder 11 that is provided in the embodiment of the invention, be a kind of capturing and coding equipment, can be digital video frequency server (DVS), digital video recorder (DVR), IP video camera (IPCamera), PC insertion encoding card and collecting device (CodecPc), obtain the code stream of several different code checks at the Same Scene content according to code check commonly used now, and the multiply code stream carried out the fluidisation index, specifically, be exactly according to the original position of temporal information, therefore makestreaming media server 12 can use the code stream of same time shaft different code checks of index multiply in synthetic code stream the code stream of same time mark pointed Same Scene content correspondence.
Wherein, the coding parameter thatencoder 11 is adopted in the process of encoding is arranged in theencoder 11 in the time of can being initial, also can change resulting in follow-up instruction according to signal server.Wherein, described coding parameter, for example: the video flowing parameter generally comprises coded format, standard, frame per second, code check, I frame period or the like; The audio stream parameter comprises coded format, sample rate, bit rate, packaging time length or the like.
In addition, thedecoder 13 that is provided in the embodiment of the invention can also be provided with according to the dynamic bandwidth between the client at network state information estimationstreaming media server 12 anddecoder 13 places.That is to say,bandwidth determining unit 121 in thestreaming media server 12 also can be arranged in client, particularly, can be arranged indecoder 13, bring in the current bandwidth of determining betweenstreaming media server 12 and the client by the client, and directly givestreaming media server 12 with the feedback information of current bandwidth, to alleviate the burden ofstreaming media server 12.
Streamingmedia server 12 is made the real-time code rate adjustment according to the real-time bandwidth between self and thedecoder 13, select the code stream of optimal code check, and at the key frame place code stream is switched, thereby the bandwidth self-adaption of realizing the code stream of different code checks switches.
Therefore, the embodiment of the invention provides a kind of transmission plan of Media Stream bandwidth self-adaption, can be applied in video monitoring, video conference, Internet Protocol Television fields such as (IPTV).
Streamingmedia server 12 can initiatively send Media Stream to client, also can send Media Stream according to client-requested to client after the request that receives client.
Referring to Fig. 2, a kind of media stream sending method that the embodiment of the invention provides totally comprises step:
S101, streaming media server be according to the network state information of client feedback, determines the current bandwidth between self and the client.
S102, streaming media server be according to the current bandwidth between self and the client, determines the code check of the current Media Stream that need send to client.
S103, streaming media server send the Media Stream that adopts this code check coding to obtain to client.
Preferably, step S102 comprises:
Streaming media server is according to the current bandwidth between self and the client, and the bandwidth of storage in advance and the corresponding relation of code check, determine current need be to the code check of the Media Stream of client transmission.
Preferably, encoder adopts various code rate to encode at the Same Scene content, and adopt same time shaft that the Media Stream that obtains by different rate samples is set up index, the synthetic Media Stream of the Same Scene content correspondence that encodes is sent to streaming media server.Streaming media server should synthesize in the Media Stream and store, so that the follow-up distribution of carrying out Media Stream according to client-requested after receiving the synthetic Media Stream of the Same Scene content correspondence that encoder sends; Perhaps, directly from the synthetic Media Stream that receives, extract the code stream of a certain code check that needs transmission and initiatively be distributed to client, for example relay in real time etc.
Referring to Fig. 3, a kind of media stream sending method that the embodiment of the invention provides specifically comprises step:
S201, decoder send the signaling of request Media Stream to streaming media server, the information that comprises the Media Stream of being asked in this signaling, for example media stream file sign etc. further can also comprise network state information current between decoder and the streaming media server.
S202, streaming media server resolve the signaling that decoder sends, and estimate current bandwidth between self and the decoder according to this signaling, send the Media Stream of the code check that is fit to current bandwidth to decoder.
S203, decoder analysis be from the state of the media stream data bag of streaming media server, as packet loss or the like, and determines current network state information according to the state of packet, and this network state information is fed back to streaming media server by the RTCP message.
S204, streaming media server receive the RTCP message, and whether the Media Stream of judging the decoder request send and finish, if then the Media Stream demand signalling of decoder is next time waited in end, otherwise, execution in step S205.
S205, streaming media server are determined the real-time bandwidth between streaming media server and the decoder according to the RTCP message of receiving.
Whether whether S206, this real-time bandwidth of streaming media server judges are fit to current code check, promptly corresponding with the code check of the Media Stream that sends when the forward direction decoder, if, execution in step S207 then; Otherwise, execution in step S208.
S207, streaming media server continue to send Media Stream by current code check to encoder.
S208, streaming media server are made dynamic adjustment according to real-time bandwidth, at the code stream that need in the synthetic Media Stream of the various code rate that encoder sends, choose optimum current bandwidth, and by the key frame place Media Stream is switched, and the Media Stream after will switching sends to decoder.Thereby realized code stream self adaptation, and the code stream self adaptation of the dynamic bandwidth between decoder and the streaming media server at the decoder of different bandwidth access.
In sum, the embodiment of the invention provides the distribution scheme of the Media Stream in a kind of multimedia system, has solved the problem of taking into account of real-time and fluency, and adjusts the code check of Media Stream in real time according to the network bandwidth.Particularly, by the network state information of streaming media server, determine the current bandwidth between streaming media server and the client according to client feedback; Streaming media server is according to current bandwidth, determines the code check of the current Media Stream that need send to client; Streaming media server sends the Media Stream that adopts this code check coding to obtain to client, thereby real-time and fluency in the media flow transmission process have been improved, make client can play the Media Stream that obtains in real time, glibly, promptly on the highest basis of dynamic bandwidth utilance, realize the smooth playing of real-time code stream, strengthened customer experience.
Media Stream described in the embodiment of the invention can be video flowing, audio stream, data flow or the like; Described multimedia system can be video monitoring system, IPTV system, video conferencing system, unified communications or the like.The technical scheme that the embodiment of the invention provides is not only applicable to the dynamic bandwidth adjustment between streaming media server and the decoder, also is only applicable to the self adaptation of the decoder access bandwidth of streaming media server and different bandwidth access, and the on-demand process of storage flow.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.