Hikvision RTSP port closed IP Cam: DS-2CD2142FWD-IWS

tobden

n3wb
Joined
Oct 17, 2016
Messages
13
Reaction score
3
I've recently got addicted on home assistant and want to get the rtsp stream into home assistant so I can send image notifications. I have 4 cameras and 3 I can view the RTSP stream in VLC. One camera I cannot view the RTSP stream as vlc times out. I have my router set up so I can access the 192.168.254.X address range, allowing direct access to ip cameras via the nvr.

The camera that I cannot stream from RTSP is a DS-2CD2142FWD-IWS at 192.168.254.5. Although I cannot get the RTSP working, I have got this camera in home assistant and home assistant can receive the motion, line crossing and intrusion detection notifications (this works great, home assistant get notified instantly and I have so many ideas, like sending camera image on motion via telegram, hopefully this will work better than hikvisions email feature).

Steps I have tried to get the RTSP working:

These are my current settings in the following imgur album, I have tried to make my camera less secure:


Different firmwares I have tried:

IPC_R6_EN_STD_5.5.82_190909.zip
IPC_R6_EN_STD_5.5.53_180730.zip
IPC_R6_EN_STD_V5.5.5_Build180111.zip
IPC_R6_EN_STD_V5.5.0_Build170725.zip

can't seem to downgrade to v5.4.x unless use TFTP which I havent tried yet

When I do a nmap port scan with this command in Zenmap: nmap -p 80,554 -T4 -A -v -Pn 192.168.254.5

Code:
PORT    STATE    SERVICE VERSION
80/tcp  open     http    Hikvision IP camera httpd
554/tcp filtered rtsp
so the 554 port is closed

Then on a camera I can RTSP stream from: nmap -p 80,554 -T4 -A -v -Pn 192.168.254.4

Code:
PORT    STATE    SERVICE VERSION
80/tcp  open     http    Hikvision IP camera httpd
554/tcp open  rtsp    Hikvision 7513 POE IP camera rtspd
I have followed this video where he enables Hikvision CGI:
The urls I have tried:

Code:
rtsp:/admin:password@192.168.254.5:554/Streaming/Channels/102/?transportmode=unicast
rtsp:/admin:password@192.168.254.5:554/Streaming/Channels/101/
rtsp:/admin:password@192.168.254.5:554/Streaming/Channels/1/
http://192.168.254.5/ISAPI/Security/capabilities?username=admin
http://192.168.254.5:554/videostream.cgi?rate=0&user=admin&pwd=password
rtsp:/192.168.254.5:554/ISAPI/streaming/channels/101
These image/MJPEG links don't work either
Code:
http://admin:password@192.168.254.5/Streaming/channels/102/httpPreview
http://192.168.254.5/Streaming/channels/1/picture
I have also tried changing the RTSP port, resetting to factory settings, using wireshark to try and get RTSP url (but the web live view uses some kind of HTTP ISAPI way to get live stream i think, which is how home assistant works with hikvision, but have no idea about packet capture and sniffing).

Any other ideas how to get RTSP live stream to work? I'm pretty sure when I brought the camera I could RTSP stream from it. I'm nearly about to swap this camera with with another but this camera is my best camera looking down my driveway so don't really want to!
 
Last edited:

tobden

n3wb
Joined
Oct 17, 2016
Messages
13
Reaction score
3
Have you tried changing RTSP port on that camera? Might help

-
Changing the port doesn't allow me to stream via RTSP.

I changed the port to 2554:

1.png

and port scan results in RTSP port 2554 closed (well filtered):

Code:
nmap -p 80,443,554,2554,8000,8443 -T4 -A -v 192.168.254.5

PORT     STATE    SERVICE        VERSION
80/tcp   open     http           webserver
443/tcp  filtered https
554/tcp  filtered rtsp
2554/tcp filtered vcnet-link-v10
8000/tcp filtered http-alt
8443/tcp filtered https-alt
nmaps definition of filtered:

filtered

Nmap cannot determine whether the port is open because packet filtering prevents its probes from reaching the port. The filtering could be from a dedicated firewall device, router rules, or host-based firewall software. These ports frustrate attackers because they provide so little information. Sometimes they respond with ICMP error messages such as type 3 code 13 (destination unreachable: communication administratively prohibited), but filters that simply drop probes without responding are far more common. This forces Nmap to retry several times just in case the probe was dropped due to network congestion rather than filtering. This slows down the scan dramatically.
Doing the same port scan on a camera I can RTSP stream from shows RTSP port 554 open:

Code:
nmap -p 80,443,554,2554,8000,8443 -T4 -A -v 192.168.254.4

PORT     STATE  SERVICE        VERSION
80/tcp   open   http           Hikvision IP camera httpd
443/tcp  closed https
554/tcp  open   rtsp           Hikvision 7513 POE IP camera rtspd
2554/tcp closed vcnet-link-v10
8000/tcp open   http-alt?
8443/tcp closed https-alt
Just feels like I have a setting wrong or something but I'm not sure what....
 

tobden

n3wb
Joined
Oct 17, 2016
Messages
13
Reaction score
3
Hey trempa92, nice attention to detail, MJPEG works now! I suspect because it is on port 80. only 640x360 res but is a start.

I did a factory reset just now, it reset the MJPEG setting on substream so I had to change that back and lost the extra user for home assistant, so looks like it reset. But it must pull the admin user and password from the hik nvr (and who knows what else it pulls from nvr) as they are my non standard details.

Factory resetting does not allow me to stream via RTSP, port still filtered (closed)

trying the photo url doesn't work either (the ip address for my problem camera changed from 192.168.254.5 to 192.168.254.10). Which is weird since it is port 80 which is open. The same url works on other cameras.

1.jpg
 

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
734
Reaction score
230
Location
Croatia,Zagreb
Hey tobden,

Try this:

Network->Advanced Settings->Integration Protocol for CGI-> Enable it and refresh the page.

Filtered does not mean its closed, it can mean that no service is using that port at that moment.
Does your Home assistant accepts ONVIF protocol? You can enable ONVIF on camera.

Also this might fix your problem:

Try accessing RTSP stream via NVR not the camera itself. So lets say the camera u try to access is on channel 4

rtsp:/admin:password@NVRIP:554/Streaming/channels/401 401-> Channel 4 - 01 Mainstream 02 Substream
 

tobden

n3wb
Joined
Oct 17, 2016
Messages
13
Reaction score
3
Ah yes the webpage mentioned cgi which I should have thought to turn on the Hikvision-CGI function. Ok so now my settings look like this:

3.png2.png

Now I can get a full resolution screenshot directly from the camera (url: ) prefect for home assistant telegram notifications! :)

When I turn off the Hikvision-CGI function, the screenshot link doesn't work and get the same 404 error as my last post, as expected

I did find how to set up onvif on home asssistant but did not implement it yet. I have not used onvif before, not sure if it has any features that are worth setting up in home assistant, since I already have event notifications (motion, line, intrusion) in HA, maybe if I had PTZ cameras.

After changing settings to the screenshots in this post, RTSP direct streaming still doesn't work from the camera. However, I tried your suggestion via the NVR (url rtsp:/192.168.254.1:554/Streaming/Channels/401/) and it works as expected! :D I had no idea I could do this!

Feel a bit defeated didn't work out how to direct stream from camera but streaming main stream from nvr channel 4 achieves equivalent result, spent too much time on this already and I need to move on. Maybe it is even better to stream from NVR as possibly(?) takes some cpu load off camera, one less device to stream to. I do notice some stuttering on a couple of my cameras on an event detection (motion, line or intrusion or all at once for example) so less cpu load the better I guess. Or maybe the event detection is processed on hardware... I wonder if anyone has done any cpu usage studies and if it is better to stream from nvr/camera and if it is better to enable only one event instead of all at once... or maybe the stuttering was due to emails (failing timeout) uploading directly from cameras...

Anyway thanks for your help trempa92!
 
Last edited:

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
734
Reaction score
230
Location
Croatia,Zagreb
Ah yes the webpage mentioned cgi which I should have thought to turn on the Hikvision-CGI function. Ok so now my settings look like this:

View attachment 116573View attachment 116574

Now I can get a full resolution screenshot directly from the camera (url: ) prefect for home assistant telegram notifications! :)

When I turn off the Hikvision-CGI function, the screenshot link doesn't work and get the same 404 error as my last post, as expected

I did find how to set up onvif on home asssistant but did not implement it yet. I have not used onvif before, not sure if it has any features that are worth setting up in home assistant, since I already have event notifications (motion, line, intrusion) in HA, maybe if I had PTZ cameras.

After changing settings to the screenshots in this post, RTSP direct streaming still doesn't work from the camera. However, I tried your suggestion via the NVR (url rtsp:/192.168.254.1:554/Streaming/Channels/401/) and it works as expected! :D I had no idea I could do this!

Feel a bit defeated didn't work out how to direct stream from camera but streaming main stream from nvr channel 4 achieves equivalent result, spent too much time on this already and I need to move on. Maybe it is even better to stream from NVR as possibly(?) takes some cpu load off camera, one less device to stream to. I do notice some stuttering on a couple of my cameras on an event detection (motion, line or intrusion or all at once for example) so less cpu load the better I guess. Or maybe the event detection is processed on hardware... I wonder if anyone has done any cpu usage studies and if it is better to stream from nvr/camera and if it is better to enable only one event instead of all at once... or maybe the stuttering was due to emails (failing timeout) uploading directly from cameras...

Anyway thanks for your help trempa92!
Im glad i could be of help!

In my opinion its always best to use NVR usage as NVR got pretty powerfull CPU compared to cameras.The first thingyou will notice that usage is too high when live view start dropping. As NVR is prioritize events, recordings over live view. It will simply say No Resource.

So in my opinion working for 6 years with hikvision products turned to be: If u need rtsp stream, use it from NVR. I dont know why i didnt propose this solution sooner, i guess i was just tilted why camera stream is not working and was trying to give solution to that part.

Anyway cheers m8
 

tobden

n3wb
Joined
Oct 17, 2016
Messages
13
Reaction score
3
No worries m8, thanks again.

Makes sense cpu wise to stream via NVR instead of from camera.

I found the link to directly get snapshot from nvr:


Only thing is I asked for 2560x1440 the native stream resolution and only get 1920x1080. Looks like this is common though. Maybe this nvr snapshot link pulls frame and rezises image each request and ip camera just pulls a frame from the feed, no resize.
 
Top