Closed royaalto closed 6 years ago
Did you input the user/password like "./complete_example rtsp://admin:12345@192.168.1.111:554/video/0"? MyRtspClient don't support getting user/password in url now. You could set user/password in the code. Please refer to common_example.cpp about line 60-70 which is comment-out. See also: https://github.com/Ansersion/myRtspClient/issues/6
If so, could you do me a favor and give me a example url for getting stream with user/password for Bosch camera. I'll try to make it compatible soon.
I run with
./complete_example rtsp://192.168.0.22:554
I modified the code
RtspClient Client(RtspUri);
std::string usr1 = "service";
std::string pass = "1234";
/* Set rtsp access username */
Client.SetUsername(usr1);
std::cout<<"username2"<<std::endl;
/* Set rtsp access password */
Client.SetPassword(pass);
then get
Start
play rtsp://192.168.0.22:554
Then put video data into test_packet_recv.h264
RTSP/1.0 401 Unauthorized
CSeq: 1
WWW-Authenticate: Digest realm="Please log in with a valid username",nonce="05643a873c231202489f38ff06fe310b",opaque="",stale=FALSE,algorithm=MD5
I think it is a standard onvif camera I usually visualize it with vlc using "rtsp://service:password@192.168.0.22:554"
And I am quite sure the password is correct.
Generally, RTSP needs auth when sending DESCRIBE. Maybe the Bosch ipcam is strict in its privacy. So it requires auth even when sending OPTION which is of little account for the ipcam. I added auth check for every RTSP command of MyRtspClient just now. Maybe you could try it. Thank you for your feedback:)
Thanks very much for the quick response. Really appreciate .
After running I get
Start play rtsp://192.168.0.22:554
Then put video data into test_packet_recv.h264
BASIC Authentication not supported now
CheckAuth: error
DoOPTIONS error
Could you please help me to a line: cout << RtspResponse << endl; after line 2082 of rtspClient.cpp(just before the cout of "BASIC Authentication not supported now"). And give the output for me. Thinks a lot
Start play rtsp://192.168.0.22:554
Then put video data into test_packet_recv.h264
RtspResponse is:
RTSP/1.0 401 Unauthorized
CSeq: 1
WWW-Authenticate: Digest realm="Please log in with a valid username",nonce="6f6737d15c4c51ec12752a610ec6476e",opaque="",stale=FALSE,algorithm=MD5
BASIC Authentication not supported now
CheckAuth: error
DoOPTIONS error
I fix the bug just now. I think it will work now.
Thank you very much. Rtsp connection should be no problem. But I got this error I think it is related to codec
Start play rtsp://192.168.0.22:554
Then put video data into test_packet_recv.h264
RTSP/1.0 200 OK
CSeq: 2
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, SET_PARAMETER, GET_PARAMETER, PAUSE
RTSP/1.0 200 OK
CSeq: 3
Cache-control: no-cache
Content-Type: application/sdp
Content-Length: 292
v=0
o=- 0 0 IN IP4 192.168.0.22
s=LIVE VIEW
c=IN IP4 0.0.0.0
t=0 0
a=control:*
m=video 0 RTP/AVP 35
a=rtpmap:35 H264/90000
a=rtpmap:102 H265/90000
a=control:video
a=recvonly
a=fmtp:35 packetization-mode=1;profile-level-id=4d402a;sprop-parameter-sets=Z01AKo2NIA8ARPy4CAQ=,aO44gA==
Control: rtsp://192.168.0.22:554/video
MyRTP_SetUp TCP: 0
Setup Session video: MyRtsp: Success
RTSP/1.0 200 OK
CSeq: 4
Session: 28161a3e5d8b6bc;timeout=30
Transport: RTP/AVP;unicast;client_port=10330-10331;server_port=15344-15345;ssrc=4100bd12;mode="PLAY"
start PLAY
RTSP/1.0 200 OK
CSeq: 5
Session: 28161a3e5d8b6bc
Adding destination 192.168.0.22:15344
Unknown NALU Type: H265
Unknown NALU Type: H265
Unknown NALU Type: H265
Unknown NALU Type: H265
Unknown NALU Type: H265 Unknown NALU Type: H265
Unknown NALU Type: H265
try_times > 5
start TEARDOWN
RTSP/1.0 200 OK
CSeq: 6
Session: 28161a3e5d8b6bc
I tried to fix the bug just now. Maybe you could try it again. Really thanks for your feedback! Note: Re-genMakefile your makefile(Because I added a new source file 'sdp_data.cpp')
New code has a bug when parsing VPS/SPS/PPS for h264/265 which will lead to decoding failed of the video for ipcam. I fixed it just now.
COOL, you are so nice!
Hi, some additional questions, my camera supports H264/H265/Mjpeg, so I am thinking to use your lib to get directly the Mjpegs then maybe first write to some files. Actually I know how to get Jpeg pics from HTTP, but I am new to Rtsp. Could you give me some clues about how to implement mjpeg parsing in your code or do you have any plans to implement such function?
Rtsp client sends DESCRIBE command to get the SDP which describes the video/audio resources that could be access to.
According to your SDP below:
v=0 o=- 0 0 IN IP4 192.168.0.22 s=LIVE VIEW c=IN IP4 0.0.0.0 t=0 0 a=control:* m=video 0 RTP/AVP 35 a=rtpmap:35 H264/90000 a=rtpmap:102 H265/90000 a=control:video a=recvonly a=fmtp:35 packetization-mode=1;profile-level-id=4d402a;sprop-parameter-sets=Z01AKo2NIA8ARPy4CAQ=,aO44gA==
There is no mjpeg resource that the client can get. Maybe you can use the Bosch tools to get the mjpeg and then use wireshark to capture the network packet to find more clues.
Note: RFC7826 and RFC4566 are key doc for RTSP. Maybe you could get some inspiration from them. https://tools.ietf.org/html/rfc7826#section-13.2 https://tools.ietf.org/html/rfc4566#section-5.14
I am now using Bosch IP camera, the rtsp is available with user and password. Also I read the issues here and modify two lines related to the password and user.
But I still get 400 error when running the example code when I use the correct user name and password.
Do I miss something?