Step-out method of measurement and device between a kind of network side audio/video flow based on RTSP
Technical field
The present invention relates to network video service evaluating objective quality field, more specifically, relate to when being applied in network side in this field and receiving a large amount of audio/video flow the measurement of step-out between the matching technique of homology audio/video flow and audio/video flow.
Background technology
In recent years, along with the lifting at full speed of Internet bandwidth, streaming media video business has obtained good development.At network side, streaming media service being carried out to evaluating objective quality can helping service provider more clearly understand the satisfaction of user to video quality, thereby can improve service quality further.In actual flow media business, audio/video flow normally transmits by different rtp streamings.Therefore, in network side video objective quality evaluation, how in a large amount of data flow Rapid matching out from the audio/video flow of same video traffic and to measure step-out between stream be a key technology.
In streaming media service, be based upon RTSP agreement on Internet Transmission layer protocol TCP for realizing negotiation and the foundation that between server and client, streaming media service is connected; Be based upon transmission and quality-monitoring that RTP on UDP and rtcp protocol are respectively used to realize audio/video flow.Between existing each audio/video flow of Streaming Media client, be synchronously according to Real-time Transport Protocol standard (RFC3550), by what the parsing of rtcp protocol was realized.In the Sender Report (Sender Report) that Streaming Media client periodically sends server, npt timestamp and rtp timestamp are analyzed, and realize the synchronous and calibration between audio/video flow.But this synchronization mechanism synchronously depend on for the first time the time of advent of first Sender Report, thereby affect the initial broadcasting of video.Therefore, in certain methods application RTSP agreement Play response, synchronous initialization is carried out in range and rtptime territory, utilizes rtcp protocol in the process of playing simultaneously, carries out calibration synchronous between audio/video flow.
Yet, in network side video objective quality evaluation, between the above-mentioned stream based on rtcp protocol, synchronously there is certain problem.The first, on network node, simultaneous audio/video flow is more, needs first in a large amount of audio/video flows, to separate fast each audio/video flow from same video, could further to the step-out between audio/video flow, measure.The second, the data throughput of network side is larger, to having relatively high expectations of data processing speed.Therefore the step-out method of measurement between audio/video flow can not be too complicated.The 3rd, rtcp protocol is option in streaming media service, therefore at network side, cannot not carry out video objective quality evaluation to disposing the streaming media service of rtcp protocol, and this has limited the scope of application of method of measurement to a great extent.The 4th, rtcp protocol is based upon on UDP, is based upon on unreliable connection, and when network quality is poor, the RTCP bag that comprises Sender Report may be lost, and causes method of measurement to measure the step-out between audio/video flow.
The present invention proposes the method for measurement of step-out between a kind of streaming media service stream that can be applied to network side.At network node place, only need the Streaming Media control protocol RTSP in a large amount of audio/video flows to resolve, utilize respective ends slogan, realize the Rapid matching of each audio/video flow in homology business.Further, the present invention utilizes the timestamp information of Real-time Transport Protocol, can measure preferably step-out between audio/video flow.In addition, the method in the present invention, without rtcp protocol is resolved, has reduced the algorithm complex that between audio/video flow, step-out is measured largely, can better adapt to the actual demand of network side.
Summary of the invention
Technical problem to be solved by this invention is: overcome the parsing, the method that between the audio/video flow existing in prior art, synchronously depend on rtcp protocol too complicated, cannot be applicable to problem and defect that between network side audio/video flow, step-out is measured.
In order to solve the problems of the technologies described above, the invention provides a kind of method that between the audio/video flow based on RTSP protocol port Rapid matching, step-out is measured at network side, comprise the following steps:
(a) at network side, obtain the RTSP bag of streaming media service.
(b) the RTSP bag obtaining is resolved, and record essential information, Internet Transmission information and the initial synchronisation information of homology audio/video flow.
(c), according to the port number information in the homology audio/video flow Internet Transmission information of record, at network side, obtain sound, the video flowing of streaming media service.
(d) according to the timestamp of the essential information of the homology audio/video flow of record, initial synchronisation information and RTP bag, step-out between homology audio/video flow is measured.
Further, said method also can have following characteristics: in step (a), need to obtain same IP address to and DESCRIBE order and the response of the RTSP agreement of port numbers, SETUP order and response, PLAY order and response and TEARDOWN order and respond.Can guarantee like this can to parse Internet Transmission port numbers and the needed information of all audio/video flows of this video stream media business in (b).
Further, the above-mentioned consideration that RTSP bag is obtained also can have following characteristics: because RTSP agreement adopts default port numbers 554 conventionally at server, therefore at network side, only need to the port numbers of Transmission Control Protocol, resolve at transport network layer, can obtain RTSP bag.Guaranteed like this to obtain realizing of RTSP bag simple in the situation that network side mass data flows.
Further, the above-mentioned consideration that RTSP bag is resolved also can have following characteristics: in step (b), the DESCRIBE order of RTSP agreement and response thereof are resolved.SDP in analyzing responding (Session Description Protocol) message, can obtain the audio/video flow information that the video of client-requested comprises, sample frequency and the orbit number trackID of record audio stream, and the sample frequency of video flowing, frame per second and orbit number trackID respectively.The essential information of these audio/video flows can be measured for step-out between subsequent sound video flowing.
Further, the above-mentioned consideration that RTSP bag is resolved also can have following characteristics: in step (b), the SETUP order of RTSP agreement and response thereof are resolved.Analyzing responding message, according to orbit number trackID, can find and record client network transmission ends slogan and the task number session of corresponding audio/video flow.Wherein, the RTP bag that client network transmission ends slogan obtains audio/video flow for (c) obtains.Task number session is for the coupling of homology audio/video flow.
Further, the above-mentioned consideration that RTSP bag is resolved also can have following characteristics: in step (b), the PLAY order of RTSP agreement and response thereof are resolved.Analyzing responding message, according to task number session and orbit number trackID, finds and records the timestamp information of the first RTP bag of Audio/Video Streaming.Because each audio/video flow initial time stamp is that independent random produces.Therefore, realize in (d) synchronous between audio/video flow according to the timestamp information of the first RTP bag transmitting in RTSP control protocol.
Further, the above-mentioned consideration that RTSP bag is resolved also can have following characteristics: in step (b), the TEARDOWN order of RTSP agreement and response thereof are resolved.When connecting disconnection, according to session, delete the record of corresponding audio/video flow.Can avoid like this port numbers of the middle connection breaking of reality to continue to monitor the computational resource of waste network side.
Further, the above-mentioned consideration that RTSP bag is resolved also can have following characteristics: in method, only by control protocol RTSP in process that streaming media service is connected, resolve, can complete the Rapid matching to homology audio/video flow.Method realizes simple and quick, and method computation complexity is lower, can better adapt to the feature that network side data amount is larger.
Further, the above-mentioned consideration that RTSP bag is resolved also can have following characteristics: in method, only utilize PLAY order and the response thereof of RTSP agreement, just can complete between audio/video flow synchronously.So, without in the process of streaming media playing by rtcp protocol being monitored to realize synchronous between audio/video flow, so greatly simplified process synchronous between audio/video flow, can save a large amount of resources at network side, thereby can provide fast the measurement result of step-out between streaming media service stream.
Further, the above-mentioned consideration that homology audio/video flow is obtained also can have following characteristics: in step (c), according to the Internet Transmission port numbers of the audio/video flow of record in (b), at network side, obtain the RTP bag of each audio/video flow, for the measurement of the step-out between (d) homology audio/video flow.
Further, above-mentioned to homology audio/video flow, synchronous consideration also can have following characteristics: in step (d), according to the essential information of the audio/video flow of record in (b), can calculate the timestamp increment of sound, video flowing, for step-out between subsequent sound video flowing, measure.
Further, above-mentioned to homology audio/video flow, synchronous consideration also can have following characteristics: in step (d), according to the timestamp increment of the initial time stamp information of the homology audio/video flow obtaining in (b), audio/video flow with the timestamp information of each RTP bag obtaining (c), can realize synchronous between homology audio/video flow.
Further, the above-mentioned consideration that step-out between homology audio/video flow is measured also can have following characteristics: in the process that step-out is measured between homology audio/video flow, introduce the concept of time window.In time window, calculate step-out between audio/video flow and guarantee that the measured value obtaining is more level and smooth, Output rusults is more stable.
The present invention also provides a kind of network side apparatus of realizing said method, comprises between RTSP bag parsing module, RTP audio/video flow extraction module, audio/video flow step-out measurement module between synchronization module and audio/video flow.
Further, described RTSP bag parsing module also can have following characteristics: from RTSP bag, extract DESCRIBE order and response, SETUP order and response thereof, PLAY order and response thereof and TEARDOWN order and response thereof.Parsing obtains audio/video flow essential information, Internet Transmission information and initial synchronisation information.
Further, described RTSP bag parsing module also can have following characteristics: audio/video flow essential information comprises sample frequency and the orbit number of audio stream, the sample frequency of video flowing, frame per second and orbit number.
Further, described RTSP bag parsing module also can have following characteristics: audio/video flow Internet Transmission packets of information includes network transmission ends slogan and task number.
Further, described RTSP bag parsing module also can have following characteristics: initial synchronisation information comprises the timestamp information of the first RTP bag of audio/video flow.
Further, described RTP audio/video flow extraction module also can have following characteristics: according to the Internet Transmission port numbers of record, extract the RTP audio/video flow of related streams media business, and resolve the timestamp information that head obtains this RTP bag.
Further, between described audio/video flow, synchronization module also can have following characteristics: according to the task number of record, and can Rapid matching homology audio/video flow.
Further, described audio/video flow synchronization module also can have following characteristics: according to audio/video flow initial synchronisation information, can realize the Fast synchronization between audio/video flow.
Further, described audio/video flow synchronization module also can have following characteristics: according to the audio/video flow essential information of record, can calculate the timestamp increment of audio/video flow, for the step-out between audio/video flow, measure.
Further, between described audio/video flow, step-out measurement module also can have following characteristics: on the basis that the step-out of each frame is calculated, introduced the concept of time window.In time window, the step-out of each frame is weighted on average, thereby obtains more level and smooth stable measurement result.
Beneficial effect
This method is measured the step-out between network side homology audio/video flow in streaming media service.Finally set up step-out method of measurement between a simple and effective network side streaming media service stream.Between more existing audio/video flow, simultaneous techniques is compared, the present invention only utilizes Streaming Media control protocol RTSP to realize the Rapid matching of homology audio/video flow in network side audio/video flow with synchronously, method is simple, can adapt to better the feature that network side data amount is large.
Accompanying drawing explanation
Fig. 1 is embodiment of the present invention overall process block diagram.
Fig. 2 is embodiment of the present invention RTSP bag parsing module block diagram.
Fig. 3 is embodiment of the present invention RTP audio/video flow extraction module block diagram.
Fig. 4 is synchronization module block diagram between embodiment of the present invention audio/video flow.
Fig. 5 is step-out measurement module block diagram between embodiment of the present invention audio/video flow.
Embodiment
Fig. 1 is the overall procedure of this method.RTSP bag parsing module is mainly used in extracting RTSP at network side and wraps and resolve RTSP control information.First, according to RTSP Internet Transmission port numbers, at network side, extract RTSP bag.Then the control information in RTSP bag is resolved, obtains synchronous initiation information between audio/video flow essential information, Internet Transmission information, stream, for the audio/video flow of subsequent step extract and stream between step-out measure.Wherein, audio/video flow essential information comprises sample frequency and the orbit number of audio stream, and the sample frequency of video flowing, frame per second and orbit number; Internet Transmission information comprises Internet Transmission port numbers and the task number of audio/video flow; Between stream, synchronous initiation information comprises the timestamp information of sound, the first RTP bag of video flowing.RTP audio/video flow extraction module is responsible for, according to the Internet Transmission port numbers of RTSP bag parsing module record, at network side, carrying out obtaining of audio/video flow RTP bag.Between audio/video flow, synchronization module is responsible for calculating respectively audio/video flow timestamp increment according to sound, video flowing essential information, then synchronous according to synchronous initiation information realization homology audio/video flow between stream.Finally, by step-out measurement module between audio/video flow, in time window, calculated the step-out value of homology audio/video flow.
Fig. 2 is the specific descriptions of RTSP bag parsing module, and this module comprises following steps:
Step 210, because most of RTSP streaming media servers of practical application are all used default port number 554 transmit pories as RTSP agreement.Therefore, in the present invention, easy for realizing, according to default port numbers 554, at network side, extract RTSP bag.RTSP agreement is based upon on Internet Transmission layer protocol TCP, to the extraction of RTSP bag, can resolve by the destination slogan in TCP packet header and two territories of source port number.If destination slogan is 554, it is RTSP request command; If source port number is 554, it is RTSP response command.
Step 215, to RTSP, order is resolved, and obtain RTSP control command type (DESCRIBE, SETUP, PLAY and TEARDOWN), and a minute situation is processed.
Step 220, if RTSP request command is DESCRIBE order, records the sequence number CSeq of this request command flag information, source IP address and port numbers and object IP address and port numbers.
Step 225, continues to monitor to the RTSP bag in network flow, and according to the request command flag information of record in step 220, finds the next message with same request order flag information in response command, is the response of this DESCRIBE order.
Step 230, the SDP message in the response of parsing DESCRIBE order.SDP message is resolved, can obtain the essential information of audio/video flow.
For example the SDP message of the streaming media service stream of a H264 coding is as follows:
Media Description from above-mentioned message, name and address (m) territory can parse this streaming media service stream and comprise a video flowing (video0RTP/AVP96) and an audio stream (audio0RTP/AVP97).
In this example, the video flowing essential information of business can be resolved from Media Attribute (a) territory of video flowing.By Media Attribute (a): rtpmap:96H264/90000 territory, can obtain video flowing sample frequency is freq
vidco=90000Hz.By Media Attribute (a): control:trackID=65536 territory, can obtain video track Taoist monastic name trackID
vidco=65536.Again by SPS in sprop-parameter-sets territory (being Z2QAHqy0BaGfL4CIAAADA+gAALtUeLF1) is carried out to Base64 decoding and decapsulation, obtain SPS=6764001e ac b405a19f2f8088000003e80000bb5478b175, it is resolved and can obtain num_units_in_tick=125 and time_scale=5994, so the frame per second fps=time_scale/num_units_in_tick/2=23.976frames/second of video.
In this example, the audio stream essential information of business can be resolved from Media Attribute (a) territory of audio stream.By Media Attribute (a): rtpmap:97mpeg4-generic/44100/2 territory, can obtain audio sampling frequency is freq
audio=44100 * 2Hz.By Media Attribute (a): control:trackID=65537 territory, can obtain audio track Taoist monastic name trackID
audio=65537.
Step 235, if RTSP request command is SETUP order, records the sequence number CSeq of this request command flag information, source IP address and port numbers and object IP address and port numbers.And by the REQUEST territory in this SETUP request command is resolved, obtain the trackID of corresponding audio/video flow.
Step 240, continues to monitor to the RTSP bag in network flow, and according to the request command flag information of the record in step 235, finds the next one to have the message of same request order flag information, is the response of this SETUP order.
Step 245, resolves the response of SETUP order, obtains the Internet Transmission relevant information of the Audio/Video Streaming of trackID in step 235, comprises Internet Transmission port numbers client_port and task number session.Wherein, client_port obtains for subsequent step audio/video flow RTP bag, and task number session is for the coupling of homology audio/video flow.
For example, the SETUP command response of a RTSP bag is as follows:
Wherein, by Session:2519348816218767898 territory, can parse the task number session=2519348816218767898 of this stream.By Transport territory, can parse Internet Transmission port numbers client_port=54994.
Step 250, if RTSP request command is PLAY order, records the sequence number CSeq of this request command flag information, source IP address and port numbers and object IP address and port numbers.
Step 255, continues to monitor to the RTSP bag in network flow, and according to the request command flag information of the record in step 250, finds the next one to have the message of same request order flag information, is the response of this PLAY order.
Step 260, the response of parsing PLAY order, obtains synchronous initiation information between audio/video flow, comprises the timestamp information rtptime of the first RTP bag of sound, video flowing
audioand rtptime
vidco.
For example, the PLAY command response of a RTSP bag is as follows:
By RTP-Info territory, can parse the timestamp information rtptime of first RTP bag of the audio stream of trackID=65536
audio=527607500; The timestamp information rtptime of the first RTP bag of the video flowing of trackID=65537
vidco=64458855.
Step 265, if RTSP request command is TEARDOWN order, records the sequence number CSeq of this request command flag information, source IP address and port numbers and object IP address and port numbers.
Step 270, continues to monitor to the RTSP bag in network flow, and according to the request command flag information of record in step 265, obtains the response of this TEARDOWN order.
Step 275, TEARDOWN order represents that this streaming media service stream connection disconnects, and therefore should according to session value wherein, delete all information of this Business Stream, comprises audio/video flow essential information, Internet Transmission information and synchronous initiation information etc.
Fig. 3 is the specific descriptions of RTP audio/video flow extraction module, and this module comprises following steps:
Step 310 according to Internet Transmission port numbers, is obtained the RTP bag of audio/video flow from network flow.Because Real-time Transport Protocol is to be based upon on Internet Transmission layer protocol UDP, therefore the destination slogan territory in UDP packet header is resolved, can obtain the RTP bag of corresponding network transmission ends slogan.
Step 315, resolves the timestamp timestamp territory in the RTP bag packet header obtaining, and obtains the timestamp information cur_rtptime of each RTP bag in audio/video flow.This information is measured for step-out between subsequent step audio/video flow.
Fig. 4 is the specific descriptions of synchronization module between audio/video flow, and this module comprises following steps:
Step 410, stabs increment δ computing time by audio/video flow essential information
audioand δ
video, suppose that the every T of voice data encapsulates once second.
δ
audio=freq
audio×T
δ
video=freq
video/fps
Step 415, because the sound from same business, video flowing have identical task number, therefore in the present invention, according to task number session coupling homology audio/video flow.
Step 420, according to audio/video flow initialization information rtptime
audioand rtptime
vidco, the timestamp of sound, the first RTP bag of video flowing, carries out synchronously, calculating the reproduction time playtime of current Audio/Video Streaming to each RTP bag of homology audio/video flow.
For example, the timestamp of supposing current last packets of audio data of receiving is cur_rtptime
audio; The timestamp of last video packets of data is cur_rtptime
vidco, the reproduction time of sound, video flowing is respectively
playtime
audio=(cur_rtptime
audio-rtptime
audio)/δ
audio
playtime
video=(curr_rtptime
video-rtptime
video)/δ
video
Fig. 5 is the specific descriptions of step-out measurement module between audio/video flow, and this module comprises following steps:
Step 510, according to the reproduction time of the audio/video flow obtaining in step 420, calculates the step-out value D between homology audio/video flow.
For example, (the unit: be second) of the step-out D between single frames homology audio/video flow in this example
D=|playtime
audio-playtime
video|
Step 515, according to the single frames homology audio frequency and video fluid sound step-out value D obtaining in step 510, weighted average in time window, obtains average step-out value D
avg, make result more stable.
Suppose that time window length is W, average step-out value is:
Although step-out method of measurement and device have been illustrated and have described between the network side audio/video flow based on RTSP, clearly the present invention is unrestricted.Under the condition not departing from by the determined the spirit and scope of the present invention of appended claims book, those skilled in the art will can take into account many corrections, replacing, variation, substitute and equivalent content.
For example, for obtaining of RTSP bag, be not limited to the mode that embodiment proposes, can adopt the mode that data payload package is resolved, obtain RTSP bag.
For example, the calculating for step-out degree between homology audio/video flow is not limited to the mode that embodiment proposes.Can adopt other Environmental Evaluation Model to assess or weighting the step-out between homology audio/video flow.