RTP/RTCP And RTSP Multimedia Protocols For The Internet - Inria

Transcription

RTP/RTCP and RTSPmultimedia protocols for theInternetProjet Planète; INRIA Rhône-Alpesvincent.roca@inrialpes.frAugust 29th, 2001INRIA Rhône-Alpes - Planète projectOutline of the presentation1- the contextl 2- the RTP/RTCP protocolsl 3- the RTSP protocoll 4- selected bibliographylINRIA Rhône-Alpes - V. Roca - 21

PART 1:The contextINRIA Rhône-Alpes - V. Roca - 3A general view of the real-time protocolslthe protocols and their application field stream description:SDP, SMIL.describe the session and content stream control:RTSPremote control the session media transport:RTPsend data and metadata resource reservation (if any!):RSVP, DiffServmake sure the communication path offersappropriate guaranties otherwise Best-Effort transmissions!INRIA Rhône-Alpes - V. Roca - 4

A general view (cont’)land the result INRIA Rhône-Alpes - V. Roca - 5PART 2:The RTP/RTCP protocolslllllll2.1 Overview2.2 RTP generalities2.3 header format2.4 mixers vs. translators2.5 RTCP generalities2.6 RTP profiles2.7 some implementationsINRIA Rhône-Alpes - V. Roca - 6

2.1- OverviewlIETF Audio/Video Transport WG RTPv1 RFC 1889 (January 1996) RTPv2 draft-ietf-avt-rtp-new-09.txt (March 2001)lReal-Time Protocol (RTP) understand: « a framing protocol for real-time applications » does not define any QoS mechanism for real-time delivery!lReal-Time Control Protocol (RTCP) its companion control protocol, just here to get somefeedback does not guaranty anything either!INRIA Rhône-Alpes - V. Roca - 7Overview (cont’)lDesign goals: flexibleprovide mechanisms, do notdictate algorithms! instantiations for H261, MPEG1/2/. protocol neutralUDP/IP, private ATMnetworks. scalableunicast, multicast, from 2 to separate control/datasome functions may betaken over by conferencecontrol protocol (e.g. RTSP)INRIA Rhône-Alpes - V. Roca - 8

2.2- RTP generalitiesldata functions (RTP) content labeling source identification loss detection resequecing timing intra-media synchronization: remove jitter withplayout buffers inter-media synchronization: lip-synchro betweenaudio-videoINRIA Rhône-Alpes - V. Roca - 9Typical uselUsually. uses UDP(TCP is not for real-time!!!) no fixed UDP port negociated out of band UDP port for RTCP UDP port for RTP 1 usually one media per RTP session (i.e. port pair)INRIA Rhône-Alpes - V. Roca - 10

Time managementTwo times lRTP time random initial offset (for each stream) RTP timestamp present in each data packet increases by the time « covered » by a packetlNTP time (or wallclock time) absolute time (use Network Time Protocol format) NTP timestamp present in each RTCP SenderReport enables inter-stream synchronizationINRIA Rhône-Alpes - V. Roca - 112.3- RTP header01230 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - V 2 P X CC M PT sequence number - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - timestamp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - synchronization source (SSRC) identifier contributing source (CSRC) identifiers . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - payload (audio, video.) - - - - - - - - - - - - - - - - . padding count - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - version (V) padding (P) extension (X)CSRC count (CC)marker (M)payload type (PT)INRIA Rhône-Alpes - V. Roca - 12

RTP header. (cont’)lSequence number field incremented for each RTP packetlSynchronization SouRCe (SSRC) field uniquely identifies the source in the session chosen randomly detect and solve collisionslContributing SouRCe (CSRC) and CC fields used by a mixer to identify the contributingsources size of the list given by the CSRC Count (CC) fieldINRIA Rhône-Alpes - V. Roca - 132.4- Mixers versus TranslatorslMixers combines several flows in a single new one use new SSRC; original SSRCs in a CSRC list appears as a new source e.g. bandwidth reduction for dial-up networkslTranslators passes through the various flows separately keep original SSRCs e.g. protocol translation, firewallINRIA Rhône-Alpes - V. Roca - 14

Mixer a mixer may change the data format (coding) andcombine the streams in any manner example: video mixer ( MCU)end system 1from ES1: SSRC 6mixerfrom ES2: SSRC 23from M: SSRC 52CSRC list {6, 23}end system 3end system 2INRIA Rhône-Alpes - V. Roca - 15Translator data may pass through the translator intact or maybe encoded differently the identity of individual flows remains intact! example: going through a firewallend system 1from ES1: SSRC 6from ES2: SSRC 23end system 2from ES1: SSRC 6from ES2: SSRC 23transl.1transl.2authorized tunnelfirewallINRIA Rhône-Alpes - V. Roca - 16from ES1: SSRC 6from ES2: SSRC 23

2.5- RTCP generalitiesperiodic transmission of control packetsl several functionsl feedback on the quality of data distribution let everybody evaluate the number of participants persistant transport-level canonical name for asource, CNAME usually: user@host will not change, even if SSRC does! provides binding across multiple media tools for asingle userINRIA Rhône-Alpes - V. Roca - 17RTCP generalities (cont’)lFive RTCP packets SRsender reportstx and rx statistics from active senders RRreceiver reportsrx statistics from other participants, or fromactive senders if more than 31 sources SDES source description, including CNAME BYEexplicit leave APPapplication specific extensionsINRIA Rhône-Alpes - V. Roca - 18

RTCP generalities (cont’)l distribution use same distribution mechanisms as datapackets (n m multicast) multiple RTCP packets can be concatenated bytranslators/mixers compound RTCP packetlscalability with session size RTCP traffic should not exceed 5% of totalsession bandwidthrequires an evaluation of number of participantsRTCP tx interval f(number of participants) at least 25% of RTCP bandwidth is for sourcereportslet new receivers quickly know CNAME of sources!INRIA Rhône-Alpes - V. Roca - 19SR RTCP packetsincludes SSRC of senderidentify source of data NTP timestampwhen report was sent RTP timestampcorresponding RTP time packet counttotal number sent octet counttotal number sent followed by zero or more receiver report example:source 1 reports, there are 2 other sourcesreceiverreportsource 2SSRCSRsenderreportSSRCRTCP packetSSRClreceiverreportsource 3INRIA Rhône-Alpes - V. Roca - 20

RR RTCP packetslincludes SSRC of sourceidentify the source to whichthis RR block pertains fraction lostsince previous RR (SR) sent( int(256*lost/expected)) cumul # of packets lostlong term loss highest seq # receivedcompare losses interarrival jittersmoothed interpacketdistortion LSRtime when last SR heard DLSRdelay since last SRINRIA Rhône-Alpes - V. Roca - 21SDES RTCP packetlmay contain: a CNAME item (canonical identifier/name) a NAME item (real user name) an EMAIL item a PHONE item a LOC item (geographic location) a TOOL item (application name) a NOTE item (transient msg, e.g. for status) a PRIV item (private extension)INRIA Rhône-Alpes - V. Roca - 22

Example of RTCP compound packet aggregation of two packets (e.g. by a mixer)receiverreportsource 3SDESSSRCreceiverreportsource 2RTCP packet 2SSRCsenderreportSSRCSRSSRCRTCP packet 1CNAME PHONEcompound packet(single UDP datagram)INRIA Rhône-Alpes - V. Roca - 232.6- RTP profileslRTP is generic define a profile for eachtarget media! Example: MPEG1/2 video packetization must follow general guidelines RFC 2736, December 1999 Goal: « every packet received must be usefull !!! » Potential problems over standard Internet packets may be lost reordered fragmented by IP if size MTU (max tx unit)INRIA Rhône-Alpes - V. Roca - 24

RTP profiles (cont’)lExample of what must not be done!!! loss multiplication effect due to bad framingapplicationapplication data unitSrcRTPfragment 1fragment 2network txRTPfragment 3LOSTfragment 1fragment 2Rxapplicationuncomplete data!!!useless!!!INRIA Rhône-Alpes - V. Roca - 25RTP profiles (cont’)lPrinciples ALF (Application Level Framing) unit of transmission unit of control each unit is self-sufficient and can be processed assoon as it is received an RTP/UDP/IP packet should consist of one ormore complete codec frame if a codec frame size is larger than MTU, theapplication must define its own fragmentationmechanismINRIA Rhône-Alpes - V. Roca - 26

2.7- Some implementations (by Schulzrinne)Organizationproduct nameBell Labs, Columbia Univ., Massachusetts Univ.RTP LibraryVersion: 3.0 Beta (4/1997)An RTP implementations by the standard authors, source code mburgs Universitair CentrumJVOIPLIBVersion: 1.0 (11/2000)JVOIPLIB is an object-oriented Voice over IP (VoIP) library written in C tmlJavaSoft/Sun MicrosystemsJava Media FrameworkRTP application and library for audio/video session playback over IP mburgs Universitair Centrum and Universiteit MaastrichtJRTPLIBVersion: 2.4 (7/2000)JRTPLIB (Jori’s RTP library) is a C lib.htmlLive.comLIVE.COM Streaming MediaVersion: 1.0 (October 2000)This C code, distributed under a LGPL licence, forms a set of libraries that can be used within RTP/RTCP streamingapplications, or can be extended to support additional media types and codecs (in addition to MP3 audio).http://live.sourceforge.net/UCLCommon Multimedia LibraryVersion: 1.2.8 (May 2001)The UCL common multimedia library implements a number of algorithms and protocols (including RTP) needed by a number ofour ia/software/common/index.htmlINRIA Rhône-Alpes - V. Roca - 27PART 3:The RTSP protocolllll3.1 generalities3.2 an example3.3 a bit more in details3.4 some implementationsINRIA Rhône-Alpes - V. Roca - 28

3.1- RTSP generalitieslIETF standard RFC 2326lReal-Time Streaming Protocol acts as a « network remote control »lsupports the following operations: retrieval of a media from a server invitation of a media server to a conference recording of a conferenceINRIA Rhône-Alpes - V. Roca - 29RTSP generalities (cont’)lProtocol design text-based protocol transport protocol independant supports any session description (sdp, xml, etc.) similar design as HTTP with differences yet! client server and server client requests server maintains a « session state » data carried out-of-band works either with unicast or multicastINRIA Rhône-Alpes - V. Roca - 30

RTSP URLlwhole presentationrtsp://media.example.com:554/twisterla track within the udiolname hierarchy media hierarchy filehierarchyINRIA Rhône-Alpes - V. Roca - 31RTSP messagesla request (client server or server client)method to applyURLRTSP versionPLAY rtsp://video.example.com/twister/video RTSP/1.0CSeq: 2seq# for request/response pairSession: 23456789session identifierRange: smpte 0:10:00play starting at that offset for anundefined durationland its responseversion status codereason phraseRTSP/1.0 200 OKseq# for request/response pairCSeq: 2session identifierSession: 23456789Range: smpte 0:10:00-0:20:00RTP-Info: url rtsp://video.example.com/twister/video;seq 12312232;rtptime 78712811INRIA Rhône-Alpes - V. Roca - 32

RTSP methodslmajor methods SETUP: PLAY: PAUSE: TEARDOWN:lserver allocates resources for astream and starts an RTSP sessionstarts data tx on a streamtemporarily halts a streamfree resources of the stream, noRTSP session on server any moreadditional methods OPTIONS:get available methods ANNOUNCE:change description of media object DESCRIBE:get low level descr. of media object RECORD:server starts recording a stream REDIRECT:redirect client to new server SET PARAMETER:device or encoding controlINRIA Rhône-Alpes - V. Roca - 333.2- Example: media on demand, unicastlScenario CclientWAVmedia descr.web serveraudioservervideoserverstep 1: get description (in SDP format)step 2: open streams with RTSPstep 3: playstep 4: teardownINRIA Rhône-Alpes - V. Roca - 34

Example (cont’)lAnother viewHTTP GETpresentation description (sdp)clientCwebserverWSETUPPLAYRTP audio/videomediaserversA&VRTCPTEARDOWNINRIA Rhône-Alpes - V. Roca - 35Example: step 1, get descriptionC- W: GET /twister.sdp HTTP/1.1Host: www.example.comAccept: application/sdpW- C: HTTP/1.0 200 OKContent-Type: application/sdpv 0o - 2890844526 2890842807 IN IP4 192.16.24.202s RTSP Sessionm audio 0 RTP/AVP 0a control:rtsp://audio.example.com/twister/audio.enm video 0 RTP/AVP 31a A Rhône-Alpes - V. Roca - 36

Example: step 2, open streamsC- A: SETUP rtsp://audio.example.com/twister/audio.en RTSP/1.0CSeq: 1Transport: RTP/AVP/UDP;unicast;client port 3056-3057A- C: RTSP/1.0 200 OKCSeq: 1Session: 12345678Transport: RTP/AVP/UDP;unicast;client port 3056-3057;server port 5000-5001C- V: SETUP rtsp://video.example.com/twister/video RTSP/1.0CSeq: 1Transport: RTP/AVP/UDP;unicast;client port 3058-3059V- C: RTSP/1.0 200 OKCSeq: 1Session: 23456789Transport: RTP/AVP/UDP;unicast;client port 3058-3059;server port 5002-5003INRIA Rhône-Alpes - V. Roca - 37Example: step 3, playC- V: PLAY rtsp://video.example.com/twister/video RTSP/1.0CSeq: 2Session: 23456789Range: smpte 0:10:00V- C: RTSP/1.0 200 OKCSeq: 2Session: 23456789Range: smpte 0:10:00-0:20:00RTP-Info: url rtsp://video.example.com/twister/video;seq 12312232;rtptime 78712811INRIA Rhône-Alpes - V. Roca - 38

Example: step 3, play (cont’)C- A: PLAY rtsp://audio.example.com/twister/audio.en RTSP/1.0CSeq: 2Session: 12345678Range: smpte 0:10:00A- C: RTSP/1.0 200 OKCSeq: 2Session: 12345678Range: smpte 0:10:00-0:20:00RTP-Info: url rtsp://audio.example.com/twister/audio.en;seq 876655;rtptime 1032181 NB: use standard RTP synchronization methodsfor lip-sync!INRIA Rhône-Alpes - V. Roca - 39Example: step 4, teardownC- A: TEARDOWN Seq: 3Session: 12345678A- C: RTSP/1.0 200 OKCSeq: 3C- V: TEARDOWN rtsp://video.example.com/twister/video RTSP/1.0CSeq: 3Session: 23456789V- C: RTSP/1.0 200 OKCSeq: 3INRIA Rhône-Alpes - V. Roca - 40

3.3- A bit more in details: time managementlNPT (normal play time) gives stream absolute position relative to start ofthe presentation two bseconds this is the info displayed on a viewer! example:npt 10:07:00- 10:07:33range start range end(hh:mm:ss)npt 121.45-125range start range end(sec.sub)(sec)INRIA Rhône-Alpes - V. Roca - 41Time management (cont’)lSMPTE relative to start of clip format:hours:minutes:seconds:frames.subframes example:smpte-30-drop 10:07:00-10:07:33:05.01SMPTE format(30 frames/s)lrange startrange end(hh:mm:ss) (hh:mm:ss:fr.sub)absolute time follows ISO 8601, using UTC/GMT example:current time is 20010829T114501.00Zdatetime(yyyymmdd) (hhmmss.sub)INRIA Rhône-Alpes - V. Roca - 42

Time management (cont’)lAllows absolute timing of events example:start playing movie at 20010829T114501.00Z, at npt 10:07:00 enables distributed server synchronizationlAllows media editing frame precisionINRIA Rhône-Alpes - V. Roca - 43A bit more in details: RTSP communicationsl Three working modes persistant transport connections (TCP) for severalrequests/responses a connection (TCP) per request/response connectionless mode (UDP)lindicated by the URL: « rtsp » « rtspu »lassumes persistant connectionassumes connectionlessserver to client requests require the« persistant connection » mode the only reliable way to reach a client!INRIA Rhône-Alpes - V. Roca - 44

A bit more in details: Invitationlgoal invite a server to add a media in an existingpresentationlclient uses SETUP method transport/conference params the client indicates to the media server thetransport and conference parameters to useINRIA Rhône-Alpes - V. Roca - 45Invitation (cont’)lexample: server M is invited to add a sound track tothe conferenceC- M: DESCRIBE eq: 1Accept: application/sdpM- C: RTSP/1.0 200 1 OKContent-type: application/sdpContent-Length: 44v 0o - 2890844526 2890842807 IN IP4 192.16.24.202s RTSP Sessioni See abovet 0 0m audio 0 RTP/AVP 0INRIA Rhône-Alpes - V. Roca - 46

Invitation (cont’)C- M: SETUP rtsp://server.example.com/demo/548/sound RTSP/1.0CSeq: 2Transport: RTP/AVP;multicast;destination 225.219.201.15;port 7000-7001;ttl tl.edu%20StarrM- C: RTSP/1.0 200 OKCSeq: 2Transport: RTP/AVP;multicast;destination 225.219.201.15;port 7000-7001;ttl 127Session: .arl.wustl.edu%20StarrC- M: PLAY rtsp://server.example.com/demo/548/sound RTSP/1.0CSeq: 3Session: 91389234234M- C: RTSP/1.0 200 OKCSeq: 3INRIA Rhône-Alpes - V. Roca - 47A bit more in details: Recordinglgoal ask a server to record an active sessionlclient uses ANNOUNCE and RECORDmethods Announce method enables the client to give (e.g.the sdp) presentation description Record method enables the client to record thepresentation for a given time intervalINRIA Rhône-Alpes - V. Roca - 48

A bit more in details: Cache controllgoal control the way the media stream may be cachedlexample of directives no-cachenever cache publicstream cacheable by any cache privatedon’t cache unless by private cache no-transform never alter the stream content only-if-cached e.g. play a stream only if cached max-staleonly if expired from less than that min-freshonly if won’t expire after that value must-revalidateINRIA Rhône-Alpes - V. Roca - 493.4- Some implementations (by Schulzrinne)Organizationtype OSAppleserverAppleclientproduct namesession descriptionremarksDarwin QuickTime Streaming ServerSDPopen source, full RTP/RTSP serverQuickTime 4MacOS, WindowsSDPQuickTime 4 also supports importing SDP files that describe multicasts,with standard decoders.CernWrtpColumbia UniversityrtspdserverNT, SolarisSDPno container filesEnteraEntera Lightweight Streaming ApplicationserverWindow, unixSDPIBMRTSP ToolkitKOM TU-DamstadtKOM-PlayerplayerLinux, AIXSDPMPEG-1 System; alternative RTSP server for IBM’s VideoChargernCUBE CorporationrtspsrvserverTransitSDPDelivers MPEG-2 video over ATM, QAM, or DVB-ASI; no RTP delivery.Oracle CorporationOracle Video Serverclient, serverWindows, unix SDPMPEG-1 Systems, MPEG-2 Transport, AVI codecs. ATM, QAM, IP,DVB-ASI. No RTP delivery.Real NetworksReal Networksproxy kit (firewall)Real NetworksReal NetworksserverWindows, unixSDP, RTSLReal NetworksRealServer G2serverWindows, unixSDP, SMILsupports RTP for RTP-based clientsReal Networks"Hosting" serverserverWindows, unixStreams .au and .wav files over RTP when configured for multicast.SunJMF 2.1clientSolaris, Windows, MacOSSunMediaCentral serverserverSolarisVovidaserverLinuxOpen source, RECORD and PLAYMacOS, unixINRIA Rhône-Alpes - V. Roca - 50

Selected bibliographylGeneral Schulzrinne, IRT (Internet Real-Time) lab,http://www.cs.columbia.edu/ hgs/research/IRTlRTP Schulzrinne, Casner, Frederick, Jacobson, « RTP, atranport protocol for real-time applications », IETF,work in progress, draft-ietf-avt-rtp-new-09.txt ,March 2001. Schulzrinne, RTP home page,http://www.cs.columbia.edu/ hgs/rtp/lRTSP Schulzrinne, Rao, Lanphier, « Real-Time StreamingProtocol (RTSP) », IETF, Request For Comments2327, April 1998. Schulzrinne, RTSP home page,http://www.cs.columbia.edu/ hgs/rtsp/INRIA Rhône-Alpes - V. Roca - 51

INRIA Rhône-Alpes - V. Roca - 5 A general view (cont') l and the result INRIA Rhône-Alpes - V. Roca - 6 PART 2: The RTP/RTCP protocols l 2.1 Overview l 2.2 RTP generalities l 2.3 header format l 2.4 mixers vs. translators l 2.5 RTCP generalities l 2.6 RTP profiles l 2.7 some implementations