Reputation: 17794
I am in asp.net C# and I want to get an RTSP stream from axis camera tunneled over HTTP. For this I am following axis api documentation (page 16 to onwards). I issued HTTP requests to camera with authorization header and RTSP Describe
command was base 64 encoded and sent to the camera URL through POST. Here is the HTTP request.
POST http://195.29.168.2:20000/axis-media/media.amp HTTP/1.1
User-Agent: Fiddler
Authorization: Basic VXNlcjpDQG1VNTNy
Host: 195.29.168.2:20000
Content-Length: 214
Content-Type: application/x-rtsp-tunnelled
[Base 64 encoded Describe command]
DESCRIBE rtsp://195.29.168.2:20000/axis-media/media.amp
?videocodec=h264&resolution=640x480 RTSP/1.0\r\n
CSeq: 0\r\n
User-Agent: Axis AMC\r\n
Accept: application/sdp\r\n
I intend to get trackId parameter from Describe
command and then use it in subsequent Setup
command to establish the session with server but every time I send this request, 400 (bad request) parameter is sent by the camera. What am i doing wrong?
Note: All requests were issued from fiddler
Upvotes: 1
Views: 4764
Reputation: 11
I got the same problem. Turns out you need to send each parameter to the camera on a single line. As in:
DESCRIBE rtsp://195.29.168.2:20000/axis-media/media.amp?videocodec=h264&resolution=640x480 RTSP/1.0
CSeq: 0
User-Agent: Axis AMC
Accept: application/sdp
If you do it as shown below the camera gets a newline character in the middle and screws up the request. Kind of annoying that the api on the axis page shows it formatted like this.
DESCRIBE rtsp://195.29.168.2:20000/axis-media/media.amp
?videocodec=h264&resolution=640x480 RTSP/1.0
I wouldn't use fiddler, It stopped RTSP working for me completely. Wireshark works fine. I used puTty to communicate with the camera. I would ultimately like to use a web browser and use PHP to send / receive the commands but I dont get how to do it.
I know how to send a GET request if it looks like the following as it just goes in the url
http://myserver/axis-cgi/mjpg/video.cgi?resolution=320x240&compression=25&camera=1
But when it looks like the following here im confused as to how you would send it to a server from a web browser..
SETUP rtsp://myserver/axis-media/media.amp/
trackID=1?videocodec=h264&resolution=640x480 RTSP/1.0
CSeq: 2
User-Agent: Axis AMC
Transport: RTP/AVP;unicast;client_port=20000-20001
It'd be great if someone can help with that, I'm just learning php could I use that?
Upvotes: 1