Page 1 of 1

IP camera wiewer ...

Posted: Thu Dec 06, 2018 8:40 pm
by marc_256
Hi everyone,

After they broke in by my mother and a few weeks later by my sister at home ...
I decided to install some IP cameras and to connect them to a PC running win,
internal camera via wifi, and two external cameras via LAN (CAT5) cables.
this two cameras are connected to a HUB and PC.

Is there a way to create a IP connection via PB 5.70, and view in a real time steaming window,
and store the images on a HDD ?

thanks,
marc

Re: IP camera wiewer ...

Posted: Thu Dec 06, 2018 10:02 pm
by infratec
How large is your HDD ?

If you only want to store the stream it should be no problem.
But I think it is enough to fetch every 5 second a picture and store it.
In this way you can also show the pictures directly in PB.

For the stream you need to embed/involve VLC or ffmpg.

But you will get a lot of traffic on the net.

In our company we installed a complete own network infrastructure for the cams,
because else they slow down the normal user network.

Re: IP camera wiewer ...

Posted: Thu Dec 06, 2018 10:18 pm
by JHPJHP
Hi marc_256,

I know you're familar with PureBasic Interface to OpenCV, but have you tried connecting your camera via OpenCV's RTSP, particularlly using the FFMPEG functions; see the example cv_RTSP_writeframe_FFMPEG.pb. Combine this with the example cv_webcam_zone_tracking.pb, could make for a powerful application.

Another option might be to use the WebGadget, capturing the RTSP stream, drawing its contents to an image. Depending on the cameras manufacture, it should come with a configuration tool built-in to the firmware.

Cheers!

Re: IP camera wiewer ...

Posted: Fri Dec 07, 2018 5:57 am
by marc_256
Hi infratec,

I will also extend in my company the existing alarm system with some cameras,
and I bought a exterior HDD of 2 x 2TB in RAID 1 mode.
With a separated LAN for the cameras.
And you are write every 5 sec is OK to send via WIFI,
and streaming only if there is an alarm.
Yes, I was looking to VLC ...



Hello JHPJHP,

"I know you're familar with PureBasic Interface to OpenCV"
I think you are the best man who is familar with OpenCV :wink:

Oh, yes I will see for it,
I like to use PB so I can control some stuff myself.
I gone work on it this WE ...
thanks for the tip.


greetings,
marc

Re: IP camera wiewer ...

Posted: Fri Dec 07, 2018 12:38 pm
by CELTIC88
this code has not been tested!!

Code: Select all

;///////////////////////////////////////////////////////////////////
;!!warning this code has not been tested, And use at your own risk!!
;///////////////////////////////////////////////////////////////////

InitNetwork()

ip.s = "192.168.1.22" ;ip camera
Port = 8091 ; port camera
path.s = "/videostream.cgi" ; path of request 
authentification.s = "yourauth==" ; your authentification!

workmemory = AllocateMemory(1024*1024*2) ;memory to receive image data

c= OpenNetworkConnection(ip,Port)
If c
  SendNetworkString(c,"GET " + path + " HTTP/1.1" + #CRLF$ +
                      "Host: " + ip + ":" + Port  + #CRLF$ +
                      "Connection: keep-alive"  + #CRLF$ +
                      "Authorization: Basic " + authentification  + #CRLF$ + #CRLF$ ,#PB_Ascii) ; send request to get image
  
  Repeat
    ec = NetworkClientEvent(c)
    If ec = #PB_NetworkEvent_Data 
      rs = ReceiveNetworkData(c,workmemory,1024*1024*2)
      req.s = PeekS(workmemory,-1,#PB_Ascii);get request
      
      ShowMemoryViewer(workmemory,rs)
      
      imagesize = Val(StringField(StringField(req,2,"Content-Length: "),1,#CRLF$))
      imageaddress = workmemory + rs - imagesize
      
      ;;........
      
    EndIf
  Until ec = #PB_NetworkEvent_Disconnect
EndIf