I am doing a project in which ,I have to stream the ip camera's live in my app. For demo I am using DLink camera(DCS 942L) .Please help me how to stream this ip camera's live in my app.
Asked
Active
Viewed 1,069 times
1 Answers
0
i succeed access to your camera, i make a http query using dlink:dlink as user:password :
1) before all, i encode dlink:dlink using Base64 encoder it give me ZGxpbms6ZGxpbms=
2) i send the query in c/c++ as follow:
sockaddr_in sin;
char *ip="203.125.227.73";
int port=80;
sin.sin_addr.s_addr=inet_addr(ip); // IP of server
sin.sin_family= AF_INET;
sin.sin_port=htons(port);
int sock=socket(AF_INET,SOCK_STREAM,0);
connect(sock, (sockaddr *)&sin, sizeof(sin));
char s[1024];
strcpy(s,"GET /video/mjpg.cgi HTTP/1.1\r\n"
"Authorization: Basic ZGxpbms6ZGxpbms=\r\n\r\n");
send(sock,s,strlen(s),0);
the server send me back this:
HTTP/1.0 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Content-Type: multipart/x-mixed-replace;boundary=myboundary
--myboundary
Content-Type: image/jpeg
Content-Length: 32616
X-Status: 00000000
X-Tag: 830892
X-Flags: 0
X-Framerate: 20.92
X-Resolution: 640*360
X-Audio: 0
X-Timestamp: 1386117639854
\r\n\r\n followed_by_jpeg_data_stream_that_you_have_to_decode_in_bmp_and_display_it
in my case i use libjpeg in android and turbo-jpeg in windows to decode the stream. dont forget to change the username and password, you can encode quickly the new user:pass in this web website: http://www.motobit.com/util/base64-decoder-encoder.asp

SRedouane
- 498
- 5
- 10
-
ip address is http://203.125.227.73/ and username=dlink ,password=dlink, I have used Mjpeg demo for this camera,but it shows only black screen in my phone,please help. – mohd irfan Dec 02 '13 at 05:57
-
@user2445771, any idea how to find "/video/mjpg.cgi" part of the webserver? I have IP camera and its desktop app to view it, I want to have my own android app for that camera. I have ip, password, port but I guess link part is missing (like what to execute).... Any standard syntax to follow ? – JRC Mar 07 '14 at 09:57
-
unfortunately no, each cam has it's own URL that you can find it in the manual. – SRedouane Mar 08 '14 at 13:34