IP Camera Open RTSPSpecificationV5.docx
《IP Camera Open RTSPSpecificationV5.docx》由会员分享,可在线阅读,更多相关《IP Camera Open RTSPSpecificationV5.docx(9页珍藏版)》请在冰豆网上搜索。
IPCameraOpenRTSPSpecificationV5
IPCameraOpenRTSPSpecification
DOCUMENTHISTORY
Version
Date
SupportedFirmware
ReleaseNotes
1.00
2007-May-14
V3.0.0.0
Initialversion
1.01
2007-Dec-28
V3.0.2.1691
SupportMega-pixelstreaming
1.02
2008-Mar-04
V3.0.2.1829
Correctederrorsinexamples
1.03
2008-May-20
V5.0.0.0
F/Wversion5.0whichsupportsH.264streaming
1.04
2008-Sep-26
V5.0.0.2565
NewRTSPURLformat
1OVERVIEW
ThisdocumentspecifiestheexternalRTSP-basedapplicationprogramminginterfaceoftheIPcameraswithfirmwareversion3.00andabove.
1.1Productandfirmwareversions
ThesupportfortheRTSPAPIisproductandfirmwaredependent.PleaserefertotheReleaseNotesfortheactualproductforcomplianceinformation.
2REFERENCES
∙RTSPprotocol
oRealTimeStreamingProtocol-RFC2326
∙SDPprotocol
oSessionDescriptionProtocol-RFC2327
∙HTTPprotocol
oHypertextTransferProtocol--HTTP/1.0
∙Externalapplicationprogramminginterfaces(Clientside)
oIPCameraOpenVideoHTTPAPI
oIPCameraOpenVideoRTSPAPI
oIPCameraOpenVideoParameterspecification
3RTSPAPI
NewRTSPURLformathasfollowingtype:
rtsp:
///media/media.amp[?
=[&=...]]
ThefollowingparametersaresupportedforH.264,MPEG-4Part2andMJPEGstreams.
Parameter
Validvalues
Description
videocodec
h264,mpeg4,jpeg
Theselectedvideocodec.Default:
Productdependent;inorderofpriority:
h264,mpeg4,jpeg
resolution
1280x1024,1280x960,1280x720,768x576,4CIF,704x576,704x480,VGA,640x480,640x360,2CIFEXP,2CIF,704x288,704x240,480x360,CIF,384x288,352x288,352x240,320x240,240x180,QCIF,192x144,176x144,176x120,160x120
Specifytheresolutionofthereturnedimage.
audio
0,1
Specifywhetheraudioshallbeavailableinthestream.0=noaudio,1=audioDefault:
1
OldRTSPURLformathasfollowingtype:
1.3GPP
rtsp:
///mpeg4/media.3gp
2.MJPEG
rtsp:
///mjpg/video.mjpg?
resolution=xwidthandheightaccordwithplatform
rtsp:
///mjpg/1/video.mjpg?
resolution=xwidthandheightaccordwithplatformspec
3.MPEG4
rtsp:
///mpeg4/media.ampdefault
rtsp:
///mpeg4/media.amp?
resolution=xwidthandheightaccordwithplatform
rtsp:
///mpeg4/1/media.ampdefault
rtsp:
///mpeg4/1/media.amp?
resolution=xwidthandheightaccordwithplatform
4.H264
rtsp:
///h264/media.amp?
resolution=xwidthandheightaccordwithplatform
rtsp:
///h264/1/media.amp?
resolution=xwidthandheightaccordwithplatform
whereisthehostnameorIPaddressoftheserver.
isstreamwidth.
isstreamheight.
TheDESCRIBE,SETUP,OPTIONS,PLAY,PAUSEandTEARDOWNmethodsaresupported.TheRTSPprotocolisdescribedinRFC2326.
Requestsyntax:
COMMANDURIRTSP/1.0
Headerfield1:
val1
Headerfield2:
val2
...
Responsesyntax:
RTSP/1.0ResultCodeResultString
Headerfield3:
val3
Headerfield4:
val4
...
Thefollowingheaderfieldsareacceptedbyallcommands.Otherheaderfieldsaresilentlyignored(unlessstatedotherwiseinthesectionsbelow).
Field
Description
Authorization
Authorizationinformationfromtheclient.
CSeq
Requestsequencenumber.
Session
Sessionidentifier(returnedbyserverinSETUPresponse).
Content-Length
Lengthofcontent.
ThefollowingheaderfieldscanbegeneratedforallresponsesbytheRTSPserver:
Field
Description
CSec
Responsesequencenumber(matchesthesequencenumberoftherequest).
Session
Sessionidentifier.
WWW-Authenticate
Authenticationfromclientrequested.
3.1RTSPDESCRIBE
∙TheDESCRIBEcommandreturnstheSDP(RFC2327)descriptionfortheURI.
∙TheDESCRIBEcommandacceptsthefollowingadditionalheaderfields:
Field
Description
Accept
Listofcontenttypesthatclientsupports(application/sdpistheonlysupportedtype).
TheDESCRIBEcommandgeneratesthefollowingadditionalheaderfields:
Field
Description
Content-Type
Typeofcontent(application/sdp).
Content-Length
LengthofSDPdescription.
Content-Base
IfrelativeURLsareusedintheSDPdescription,thenthisisthebaseURL.
Example:
DESCRIBE/mpeg4/1/media.ampRTSP/1.0
CSec:
1
Accept:
application/sdp
Authorization:
Basiccm9vdDpwYXNz
Responseexample:
RTSP/1.0200OK
CSec:
1
Content-Base:
rtsp:
//x.y.z.w:
554/mpeg4/quad/media.amp
Content-Type:
application/sdp
Content-Length:
680
v=0
o=-11091620142191821109162014219192INIP4x.y.z.w
s=MediaPresentation
e=NONE
c=INIP40.0.0.0
b=AS:
8000
t=00
a=control:
*
a=range:
npt=now-
a=mpeg4-iod:
"data:
application/mpeg4-iod;base64,AoDUAE8BAf/1AQOAbwABQFBkYXRhOmFwcGxpY2
F0aW9uL21wZWc0LW9kLWF1O2Jhc2U2NCxBUjBCR3dVZkF4Y0F5U1FBWlFRTklCRUVrK0FBZWhJQUFIb1NBQVlC
QkE9PQQNAQUABAAAAAAAAAAAAAYJAQAAAAAAAAAAAzoAAkA2ZGF0YTphcHBsaWNhdGlvbi9tcGVnNC1iaWZzLW
F1O2Jhc2U2NCx3QkFTWVFTSVVFVUZQd0E9BBICDQAAAgAAAAAAAAAABQMAAEAGCQEAAAAAAAAAAA=="
m=video0RTP/AVP96
b=AS:
8000
a=control:
trackID=1
a=rtpmap:
96MP4V-ES/90000
a=fmtp:
96profile-level-id=245;config=000001B0F5000001B509000001000000012008D495880325
0B042414440F;
a=mpeg4-esid:
201
3.2RTSPOPTIONS
TheOPTIONScommandreturnsalistofsupportedRTSPcommands.
Example:
OPTIONS*RTSP/1.0
CSec:
2
Responseexample:
RTSP/1.0200OK
CSec:
2
Public:
DESCRIBE,PAUSE,PLAY,SETUP,TEARDOWN
3.3RTSPSETUP
TheSETUPcommandconfiguresthedeliverymethodforthedata.TheSETUPcommandrequiresandgeneratesthefollowingadditionalheaderfield:
Field
Description
Transport
Specifieshowthedatastreamistransported.
Supportedvariants:
RTP/AVP;unicast;client_port=port1-port2
RTP/AVP;multicast;client_port=port1-port2
RTP/AVP/TCP;unicast
Theresponsereturnsasessionidentifierthatshouldbeusedwithstreamcontrolcommandstotheserver(PLAY,PAUSE,TEARDOWN).IftheSessionheaderincludesatimeoutparameter,thenthesessionneedstobekeptalive.ThiscanbedonebysendingRTSPrequeststotheservercontainingthesessionidentifier(e.g.OPTIONS)withinthespecifiedtimeouttimeorthroughtheuseofRTCP.TheRTSPserverdoesnotsupportreconfiguringofthetransportparameters.
Example:
SETUP/mpeg4/1/media.amp/trackID=1RTSP/1.0
CSeq:
3
Transport:
RTP/AVP;unicast;client_port=20000-20001
Responseexample:
RTSP/1.0200OK
CSeq:
3
Session:
1442774578;timeout=60
Transport:
RTP/AVP;unicast;mode=play;server_port=49000-49001;client_port=20000-20001
3.4RTSPPLAY
ThePLAYcommandstarts(orrestartsifpaused)thedatadeliverytotheclient.ThePLAYcommandgeneratesthefollowingadditionalheaderfields:
Field
Description
Range
Specifiestherangeoftimebeingplayed.Sinceonlylivestreamsareused,thespecifiedtimewillalwaysbeginnowandhavenostoptime.
RTP-Info
InformationabouttheRTPstream.Morespecifically,itincludesthenextRTPsequencenumberthatwillbeused.
Example:
PLAY/mpeg4/1/media.ampRTSP/1.0
CSeq:
4
Session:
1442774578
Responseexample:
RTSP/1.0200OK
CSeq:
4
Session:
1442774578
Range:
npt=now-
RTP-Info:
url=trackID=1;seq=2735
3.5RTSPPAUSE
ThePAUSEcommandpausesthedatadeliveryfromtheserver.
Example:
PAUSE/mpeg4/1/media.ampRTSP/1.0
CSeq:
5
Session:
1442774578
Responseexample:
RTSP/1.0200OK
CSeq:
5
Session:
1442774578
3.6RTSPTEARDOWN
TheTEARDOWNcommandterminatesthedatadeliveryfromtheserver.
Example:
TEARDOWN/mpeg4/1/media.ampRTSP/1.0
CSeq:
6
Session:
1442774578
Responseexample:
RTSP/1.0200OK
CSeq:
6
Session:
1442774578
3.7RTSPoverHTTP
ItispossibletotunnelRTSPthroughHTTPtogetthroughfirewallsetc.Thisisachievedbysettinguptwosessions,oneGET(forcommandrepliesandstreamdata)andonePOST(forcommands).RTSPcommandssentonthePOSTconnectionarebase64encoded,butrepliesontheGETconnectionareplaintext.TobindthetwosessionstogethertheserverneedsauniqueID(conveyedinthex-sessioncookieheader).TheGETandPOSTrequestareacceptedbothontheHTTPport(default80)andtheRTSPserverport(default554).TheRTSP/HTTPURLis:
http///mpeg4/1/media.amp.SupportedmethodsareGETandPOST.
GETexample:
GET/mpeg4/1/media.ampHTTP/1.0
x-sessioncookie:
944345808
Responseexample:
HTTP/1.0200OK
Content-Type:
application/x-rtsp-tunnelled
NotethatthereturnedContent-Lengthisanarbitrarynumberanddoesnotindicatethesizeofanydata.
POSTexample:
POST/mpeg4/1/media.ampHTTP/1.0
x-sessioncookie:
944345808
Content-Length:
32767
Content-Type:
application/x-rtsp-tunnelled
Notethatthex-sessioncookiepresentinthePOSTcontentisthesameasthex-sessioncookieinthecorrespondingGETrequest.AlsonotethatthePOSTrequestmustbesentonaseparateconnectiontotheserver(i.e.itcannotbesentonthesameconnectionastheGETrequest).NoresponseissentforthePOSTrequest.
Commandexample(base64encodedPLAYonthePOSTconnection):
UExBWSAvbXBlZzQvMS9tZWRpYS5hbXAgUlRTUC8xLjANCkNTZXE6IDQNClNl
c3Npb246IDEzNjk5MTc3MTINCg0K
Whichcorrespondstothiscommand:
PLAY/mpeg4/1/media.ampRTSP/1.0
CSeq:
4
Session:
1369917712
Commandresponse(plain-textontheGETconnection):
RTSP/1.0200OK
CSeq:
4
Session:
1369917712