Receiving RTSP stream data
I have an IP camera that can transmit media data to me using RTSP.
I am developing an application for getting media data.
I am using C ++ and Qt3.
I am creating a socket. connect it to the device IP on port = 554.
SETUP rtsp: //192.168.4.160/ufirststream RTSP / 1.0 \ r \ n CSeq: 1 \ r \ n Transport: RTP / AVP; client_port = 554 \ r \ n \ r \ n
And get the answer:
RTSP / 1.0 200 OK CSeq: 1 Date: Sat, Mar 24 2012 17:24:59 GMT Transport: RTP / AVP; unicast; destination = 192.168.4.186; source = 192.168.4.160; client_port = 0-1; server_port = 2000-2001 Session: 413F4DDB
I will parse it to get the gettin session value and make the following request:
PLAY rtsp: //192.168.4.160/ufirststream RTSP / 1.0 CSeq: 1 Session: 413F4DDB
And the server says:
RTSP / 1.0 200 OK CSeq: 1 Date: Sat, Mar 24 2012 17:25:02 GMT Session: 413F4DDB RTP-Info: url = rtsp: //192.168.4.160/ufirststream/track1; seq = 6716; rtptime = 406936711
And how can I get the media data ??? I thought the PLAY method is forcing the server to give me a stream, but it only gives me the url for rtsp and other information ...
I need a binary stream from the camera, can you give any advice for my next step?
source to share
indicates which protocol will be used to send the stream and the
ports your client will listen on.
Try to open 2 serial UDP ports and transmit this range as
554 instead. These two ports will be used for RTP and RTCP streams (video and control data).
In addition, the RTP port number must be an even number and the RTCP port the next odd number (see this question if you want the port range to be random rather than user-selected).
source to share