Author Topic: Hikvision Cameras with motion sensor enabled  (Read 3470 times)

Offline jimmyz

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Hikvision Cameras with motion sensor enabled
« Reply #15 on: February 17, 2018, 08:05:12 pm »
I have a Laview NVR. To get full streaming (will only work with the mobile app) you need to change the streaming option to
rtsp,rtsp,:8554/PSIA/streaming/channels/101
the next camera would be 102 etc
hope that helps

Offline bwillette

  • Sr. Newbie
  • *
  • Posts: 47
  • Karma: +3/-0
Re: Hikvision Cameras with motion sensor enabled
« Reply #16 on: February 18, 2018, 11:07:34 am »
I have a Laview NVR. To get full streaming (will only work with the mobile app) you need to change the streaming option to
rtsp,rtsp,:8554/PSIA/streaming/channels/101
the next camera would be 102 etc
hope that helps

Thanks Jimmyz.  I assume this means you haven't put the port in the 'IP' field already?  Since I'm using the Virtual Host option on my DVR, everything I've read suggesting using the IP as x.x.x.x:65001 for the first camera, x.x.x.x:65002 for the second camera, etc for the IP address.  So I don't think this would allow me to specify the Streams option using the :8554 in the URL as you've done?  At least it doesn't seem to work for me.

Maybe you simply specify the x.x.x.x in the IP address, and then for all the URLs for access, you put the :6500X in the URL field as well?

Offline jimmyz

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Hikvision Cameras with motion sensor enabled
« Reply #17 on: February 18, 2018, 06:14:44 pm »
Here are my settings- I added the nvr per the first post using this:
rtsp://user:pass@IPADDRESSOFNVR:8554/PSIA/streaming/channels/101
you do not have to use the virtual host option this way- just change cameras, camera 1=101; camera 2=201 etc
« Last Edit: February 18, 2018, 07:03:42 pm by jimmyz »

Offline bwillette

  • Sr. Newbie
  • *
  • Posts: 47
  • Karma: +3/-0
Re: Hikvision Cameras with motion sensor enabled
« Reply #18 on: February 18, 2018, 06:22:43 pm »
Here are my settings- I added the nvr per the first post using this:
rtsp://user:pass@192.168.2.30:8554/PSIA/streaming/channels/101
you do not have to use the virtual host option this way
Makes sense.  Sadly that will not work with the motion/line-detection stuff, as you need to leverage direct access to the camera to access the alertStream (which is why I'm using the Virtual Host option). 

Your post did get me to thinking however, so I went back and reworked the code to not expect the port # in the IP address, which lets me use the 8554 port for the streaming interface like you did, AND I added a new variable to hold the alertStream URL in it (with the appropriate 6500X port # for the Virtual Host of the camera). Works like a champ.

I also discovered my curl | grep pattern was sadly delaying the notification cycle, since it's buffering between the two commands, so I reverted back to the original method of dumping the complete (and verbose) output of the curl command.  There's still a bit of a delay between when the Hikvision reports the linedetection event in the alertStream, and everything triggers (via Scenes or whatnot), but I guess it's liveable.

Now if only the 'Record Video' trigger would work with the rtsp stream on these cameras (at least we can capture images with them via Scenes).

Offline jimmyz

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Hikvision Cameras with motion sensor enabled
« Reply #19 on: February 18, 2018, 06:23:37 pm »
great- can you post your new code- I would love to try it out thanks in advance
« Last Edit: February 18, 2018, 06:25:15 pm by jimmyz »

Offline bwillette

  • Sr. Newbie
  • *
  • Posts: 47
  • Karma: +3/-0
Re: Hikvision Cameras with motion sensor enabled
« Reply #20 on: February 18, 2018, 06:48:04 pm »
Sure, glad to.

Be sure to specify JUST the IP address of the NVR in the IP address of the camera (this would be the fourth camera, for instance): /ISAPI/Streaming/channels/401/picture

And then the Streams variable like so: rtsp,rtsp,:8554/Streaming/channels/402

This adds a new 'alertURL' variable to the camera, which allows you to exactly specify the URL to get the alertStream.  If you're using the Virtual Host option, you should specify the port # of your camera in the first part of the URL like so : :65004/ISAPI/Event/notification/alertStream

Few things you'll need to ensure:
  • You have the Virtual Host option turned on for your NVR
  • Your username/password is the same on the NVR as your cameras (the admin user may not work well, you may need to add a new user with appropriate permissions)
  • You probably will need to change your substream for each camera to MPEG to make the streaming work properly in the mobile app (H.264 which is the default, and does not seem to work for Vera). This is why I specified '402' above, vs '401' which is the main stream.
  • This code is specifically written to expect the Line Detection capability to be pre-configured on the camera. You'll want to do this through the NVR itself for each camera you plan to connect to

What's going on here is we're actually leveraging the NVR to get the images and video, but then directly accessing the cameras to get access to the alertStream linedetection notifications. 

Be careful using this, if you don't know what you're up to, you could get into a Luup-reboot-loop and have a tough time getting out of it.  (No warranties provided obviously).  I'm actually doing this on my LaView NVR/camera setup, which is  rebranded Hikvision.  Other than the annoying alert-delay things seem to be mostly working.

Hope that helps.
« Last Edit: February 18, 2018, 06:53:13 pm by bwillette »

Offline bwillette

  • Sr. Newbie
  • *
  • Posts: 47
  • Karma: +3/-0
Re: Hikvision Cameras with motion sensor enabled
« Reply #21 on: February 18, 2018, 06:51:27 pm »
Sure, glad to.

Be sure to specify JUST the IP address of the NVR in the IP address of the camera, and use the port number in the URL like so (this would be the fourth camera, for instance): /ISAPI/Streaming/channels/401/picture

And then the Streams variable like so: rtsp,rtsp,:8554/Streaming/channels/402

This adds a new 'alertURL' variable to the camera, which allows you to exactly specify the URL to get the alertStream.  If you're using the Virtual Host option, you should specify the port # of your camera in the first part of the URL like so : :65004/ISAPI/Event/notification/alertStream

Few things you'll need to ensure:
  • You have the Virtual Host option turned on for your NVR
  • Your username/password is the same on the NVR as your cameras (the admin user may not work well, you may need to add a new user with appropriate permissions)
  • You probably will need to change your substream for each camera to MPEG to make the streaming work properly in the mobile app (H.264 which is the default does not seem to work for Vera).  This is why I specified '402' above, vs '401' which is the main stream.
  • This code is specifically written to expect the Line Detection capability to be pre-configured on the camera. You'll want to do this through the NVR itself for each camera you plan to connect to

What's going on here is we're actually leveraging the NVR to get the images and video, but then directly accessing the cameras to get access to the alertStream linedetection notifications. 

Be careful using this, if you don't know what you're up to, you could get into a Luup-reboot-loop and have a tough time getting out of it.  (No warranties provided obviously).  I'm actually doing this on my LaView NVR/camera setup, which is  rebranded Hikvision.  Other than the annoying alert-delay things seem to be mostly working.

Hope that helps.