cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to stream mpeg4 on an Axis Camera using the RTSP protocol?

From: Frank Chang <frank_chang91_at_hotmail.com>
Date: Tue, 28 Jul 2015 02:49:47 -0400

I've recently started playing around with libcurl, I'm using libcurl
7.23.1 for RTSP comms to an old password protected Axis camera. The
problem is libcurl times out after it receives a 401 response from the
RTSP describe request. After scouring the examples and archives for
inspiration I came across a mail titled '[PATCH] RTSP-Authentication'
(http://curl.haxx.se/mail/lib-2011-06/0004.html). I promptly applied the
patch from the mailing list and libcurl started handling RTSP
authentication. Question is, will this patch be making it's way into a
libcurl release?

Jeremy
 
You will have to excuse my ignorance as libcurl and studying RFCs is a
relatively new past time. Your concerns seemed to be with the behaviour
of RTSP servers that send a 401 response. Below is a wireshark trace of
an RTSP conversation between vlc and an Axis camera. As far as I can
understand libcurl expects a SDP response from a Describe request,
however because authentication failed the server does not return the SDP
data or set Content-Length etc, thus stalemate. From my basic testing
the patch makes libcurl handle the Describe request in a similar fashion
to vlc.

OPTIONS rtsp://192.168.0.4/mpeg4/1/media.amp RTSP/1.0
CSeq: 1
User-Agent: LibVLC/1.1.4 (LIVE555 Streaming Media v2010.04.09)

RTSP/1.0 200 OK
CSeq: 1
Public: DESCRIBE, GET_PARAMETER, PAUSE, PLAY, SETUP, SET_PARAMETER,
TEARDOWN

DESCRIBE rtsp://192.168.0.4/mpeg4/1/media.amp RTSP/1.0
CSeq: 2
Accept: application/sdp
User-Agent: LibVLC/1.1.4 (LIVE555 Streaming Media v2010.04.09)

RTSP/1.0 401 Unauthorized
CSeq: 2
WWW-Authenticate: Digest realm="AXIS_00408C6596D6",
nonce="00005f72Y032271154ced1f1adfcd4e193499a2a3825af", stale=FALSE
WWW-Authenticate: Basic realm="AXIS_00408C6596D6"

DESCRIBE rtsp://192.168.0.4/mpeg4/1/media.amp RTSP/1.0
CSeq: 3
Accept: application/sdp
Authorization: Digest username="root", realm="AXIS_00408C6596D6",
nonce="00005f72Y032271154ced1f1adfcd4e193499a2a3825af",
uri="rtsp://192.168.0.4/mpeg4/1/media.amp",
response="9d601434de8132b3a5f02c3649f25f05"
User-Agent: LibVLC/1.1.4 (LIVE555 Streaming Media v2010.04.09)

RTSP/1.0 200 OK
CSeq: 3
Content-Base: rtsp://192.168.0.4:554/mpeg4/1/media.amp/
Content-Type: application/sdp
Content-Length: 698
v=0
o=- 947127225043130 947127225043138 IN IP4 192.168.0.4
s=Media Presentation
e=NONE
c=IN IP4 0.0.0.0
b=AS:8000
t=0 0
a=control:*
a=range:npt=now-
a=mpeg4-iod:
"data:application/mpeg4-iod;base64,AoDUAE8BAf/1AQOAbwABQFBkYXRhOmFwcGxpY2F0aW9uL21wZWc0LW9kLWF1O2Jhc2U2NCxBUjBCR3dVZkF4Y0F5U1FBWlFRTklCRUVrK0FBZWhJQUFIb1NBQVlCQkE9PQQNAQUABAAAAAAAAAAAAAYJAQAAAAAAAAAAAzoAAkA2ZGF0YTphcHBsaWNhdGlvbi9tcGVnNC1iaWZzLWF1O2Jhc2U2NCx3QkFTWVFTSVVFVUZQd0E9BBICDQAAAgAAAAAAAAAABQMAAEAGCQEAAAAAAAAAAA=="
m=video 0 RTP/AVP 96
b=AS:8000
a=framerate:30.0
a=control:trackID=1
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=245;
config=000001B0F5000001B509000001000000012008D49588032516044814440F
a=mpeg4-esid:201
SETUP rtsp://192.168.0.4:554/mpeg4/1/media.amp/trackID=1 RTSP/1.0
CSeq: 4
Transport: RTP/AVP;unicast;client_port=34996-34997
Authorization: Digest username="root", realm="AXIS_00408C6596D6",
nonce="00005f72Y032271154ced1f1adfcd4e193499a2a3825af",
uri="rtsp://192.168.0.4:554/mpeg4/1/media.amp/",
response="2eae467d03d178ee1fecf640f1e0affb"
User-Agent: LibVLC/1.1.4 (LIVE555 Streaming Media v2010.04.09)

RTSP/1.0 200 OK
CSeq: 4
Session: 1797559597;timeout=60
Transport:
RTP/AVP;unicast;client_port=34996-34997;server_port=50020-50021;ssrc=4D03E67E;mode="PLAY"

PLAY rtsp://192.168.0.4:554/mpeg4/1/media.amp/ RTSP/1.0
CSeq: 5
Session: 1797559597
Range: npt=0.000-
Authorization: Digest username="root", realm="AXIS_00408C6596D6",
nonce="00005f72Y032271154ced1f1adfcd4e193499a2a3825af",
uri="rtsp://192.168.0.4:554/mpeg4/1/media.amp/",
response="e9c65ca08356efa06d3272d5549a75f9"
User-Agent: LibVLC/1.1.4 (LIVE555 Streaming Media v2010.04.09)

RTSP/1.0 200 OK
CSeq: 5
Session: 1797559597
Range: npt=now-
RTP-Info: url=trackID=1;seq=28083;rtptime=3032983193

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-07-28