How do I grab CCTV DVR's broadcast for custom application

我们两清 提交于 2019-12-04 21:57:22

A lot of cameras stream data via HTTP using the Mixed-Replace Content-Type. If you can access your camera on a browser, it is very likely that it uses HTTP.

Assuming this is your case, you'll have to find out what URL your camera uses to serve the stream. So you could:

  • Try to find a list like this on the internet, by Googling your camera model
  • Inspecting the browser yourself (this will require some knowledge on HTML5)

Once you have the URL,you can be sure if you're dealing with a Mixed-Replace request, if you have a terminal with curl, you can use something like:

$ curl --head http://user:password@192.168.99.230/video.cgi

My camera returns the following header:

HTTP/1.0 200 OK
Server: alphapd
Date: Thu Jan  9 09:04:59 2014
Pragma: no-cache
Cache-Control: no-cache
Content-Type: multipart/x-mixed-replace;boundary=video boundary--

This means I have a Mixed-Replace response separated by the "--video boundary--" string (look to the Content-Type field).

The request body looks like this:

--video boundary--
<metadata>
<image>
--video boundary--
<metadata>
<image>
...
(Neverending request body of real time delivered images)

Now your approach will depend on which application you want to embed the stream. On my case, I just needed to put them on a web page, so Firefox did me a favor and I could integrate it with:

<img src="http://user:password@192.168.99.230/video.cgi">

But you might have to be parsing and capturing each incoming image by yourself depending on your application.

There are standards out there so you just need to look around also don't expect any dvr manufacturer to give you api access many have tried they just dont give it away any way you don't want to be tied down to a specific dvr implementation I would advice you start with the ispy c# code http://www.ispyconnect.com and that will give you an idea of how it works in general since Ispy supports many types of cameras be it ip or webcam...

Code for analog cameras will be more difficult to find so good luck...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!