Support for Security Camera System via NVR - ESeeCloud/dvr163

how to connect it with HA ?

Taking your lead, I tried ā€œview1.htmlā€ through ā€œview4.html.ā€ Got some interesting results.
view1.html is looking for a control called " WebClient.exe." Iā€™ve downloaded it but will wait until Iā€™m feeling brave to install it.

View3.html got me some good data. It shows a very different interface. Itā€™s not showing any usable image on my system, but it uses this URL:
http://[NVR IP]/cgi-bin/sp.cgi?chn=1&quality=2&rate=10&u=[UserID]&p=[Password]

I imagine you can play around with ā€œqualityā€ and ā€œrateā€ and maybe get something out of that.

View4.html is similar but uses Flash. RTMP is a Flash protocol, not sure if theyā€™re using the proprietary Adobe version or the open version, but either way itā€™s to be avoided at all costs as far as Iā€™m concerned.

Hereā€™s what I did:

  • Go into the Lovelace UI
  • Select ā€œConfigure UIā€ from the three dots at the top right
  • Select ā€œAdd Cardā€ (+ sign at lower right)
  • Select ā€œIFRAMEā€
  • Give it a title and type in the following URL:
    http://[your.nvr.ip.address]/cgi-bin/sp.cgi?chn=[channel #]&u=[UserID]&p=[Password]
    replacing the parts in [brackets] with your values. Camera numbers start at zero.
  • Scroll up and down in the ā€œAspect Ratioā€ selection until you get one that works OK.
1 Like

the sp cgi is not able to handle properly camera data, at some point it just freeze the nvr interface and force a rebootā€¦ i think both cam and nvr use rtmp for continuous viewing but it seems encrypted and need auth with digest so makes things quite complex, i wouldnt mind letting nvr do is job if it could call a web service when motion is detected but email is the only options ā€¦

Oh! You just reminded me view2.html downloads a JaViewer.swf which I had decompiled, thereā€™s a file called jaVideo.as with connection info.

This is in a function called ConnectRTMP

this.nc = new NetConnection();
this.nc.connect(this.stream_url, this.ja_flash_ver, this.nonce, this.username, 
this._md5.hash((this.nonce + ":") + this.userpwd));
this.nc.addEventListener(NetStatusEvent.NET_STATUS, this.netStatusListener);

This is ConnectFLV

this.nc = new NetConnection();
this.nc.addEventListener(NetStatusEvent.NET_STATUS, this.netStatusListener);
this.nc.connect(null);

I was not able to do anything with this though :frowning: NetConnection seems like itā€™s Flash only https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetConnection.html

I canā€™t tell if ā€œqualityā€ does anything but ā€œrateā€ is a nice find! 1 is definitely a lower frame rate than 10.

Interesing let me show you what wireshark give :slight_smile:

http://192.168.3.49/JaViewer.swf?player_max=4..tcUrl...rtmp://[email protected][email protected].@o.......

videoFunction.?.........pageUrl..(http:.//192.168.3.49/view2.html?type=main..objectEncoding.@......... [email protected].. 8aa586f98d7771651fd0336ac917131e

later
...)..|........nlogin?method=md5&nonce=f647c49c2eb129712384a1ea6feff568&username=admin&digest=1e5f8e6981d06826b123b05323ed845.@.....

later

.Z............play............ ch2_0.264.........

for security reason i change nonce=f647c49c2eb129712384a1ea6feff568 and digest=1e5f8e6981d06826b123b05323ed845

cause the password is encoded with thoseā€¦ to be honest with the encoding method i think we need a flash client to connect to it ā€¦ but seems possible to make a proxy which gonna trancode rtmp to rtsp

Yeah, .swf is flash. Thatā€™s a dead end as far as Iā€™m concerned. Very disappointed if thereā€™s no other way.

Thatā€™s bad. On my system the sp.cgi does work, just that I have very little control over it; couldnā€™t get rate or quality parameters to do anything. But I havenā€™t thoroughly tested with a direct connection, only through HA which seems to slow down the rate anyway.

I had not considered a proxy to convert it, I wonder how much CPU that would use. I am running HA on a Pi, I donā€™t have any extra computers lying around. Iā€™m okay with using the sp.cgi though it is good enough for me.

I would still like motion detection in HA. I have a separate ā€œalertā€ email account for the NVR. I was thinking of writing a script that simply checked the inbox every X seconds. If it finds an email it can tell HA.

i am not able to use this link many time , as this link crashes my NVR and it reboots .

http://192.168.9.108:80/cgi-bin/sp.cgi?chn=1&u=xxxxx&p=xxxxx

after trying to open this link , why the NVR reboots ?

Does it crash when you view it through the regular web interface (view2.html)? Not sure what to tell you, try adding &rate=1 to lower the frame rate.

Same issue , sp.cgi has a connections limit and freeze the nvr web server when there is more than one stream ā€¦ not usable anyway or at least not reliable ā€¦

For using rtmp stream and convert it , it suppose to work with ffmpeg , probably need a second pi for that but I wasnā€™t able to authenticate thoses stream anyway ā€¦ Iā€™m seriously considering replacing all that crapā€¦

does this code helpful in connecting our NVR with HA ?
after reading and trying after this thread i think my NVR is unable to connect successfully and smoothly with HA ,

if anyone progressed in this K9608-2W NVR then please share here ,

and is there any other way we can use our cameras to support with HA ?

NVR could send motion notification throught email, the only problem is email polling can take up to 5 min which doesnt make any sense ā€¦ iā€™ve just found that node red provide a smtp server node and im gonna investigate on that

the cameras connected to our NVR are ONVIF cameras , can we use these wireless camera separately without NVR ?

this can solve our problem .

but the cameras should work wirelessly .

DU still need those camera URL stream link and Iā€™ve connected a laptop to the nvr network but didnā€™t manage to get any rstp stream ā€¦ even if each camera has its own web interface(very limited and use flash too so probably rmtp only)

Maybe the simpler way would be using an hdmi capture device from the nvr to hassā€¦

then how can we connect it with HA and manage all the available cameras in that nvr ?
how to manage those cameras through HDMI ?

if you re ready to drop your nvr they can be a way

  1. get the wireless name and password of your nvr (navigate in nvr settings)
  2. note ip of each camera
  3. connect to the wifi network of your nvr
  4. navigation to http://ip_of_cam
  5. in device_cfg , you can change wifi setting to connect your cam to your local wifi (dont use dhcp)
  6. you have acces to rtsp throught rtsp://192.168.x.x/ch0_0.264
    repeat for each cam
    Nvr become useless (or maybe re-add cam to nvr with their local ip)

If we could get SSH access to the NVR we could potentially link its wifi network with its ethernet one, or at least expose the RTSP streams through a proxy or something (right?). I have tried poking through the firmware update file but couldnā€™t find anything useful in it.

http://help.dvr163.com/index.php/ꗠēŗæå„—č£…å‡ēŗ§č½Æ件

Also has anyone else scanned the NVRā€™s ports? The web server port is open but also 64444, itā€™s driving me crazy, there has to be a reason for 64444 but I canā€™t get any response from it.

 nmap -p- $nvr_ip

Output:

Host is up (0.00072s latency).
Not shown: 65533 closed ports
PORT      STATE SERVICE
8080/tcp  open  unknown
64444/tcp open  unknown

Just curiousā€¦ all this hacking and reverse engineering is cool - but has anyone bothered trying to contact the original author of the NVR software?

When I attempted to find him (over a year ago), all the links to his website were dead (in the Apple Store). Think his name is Frank Law - but suspect that might just be an alias.

If someone can track him down, it might be worth asking him if he can share the information we need to integrate this properly.