eu-evops / homebridge-hikvision

28 stars 21 forks source link

Need help with Config file #3

Open jamesngob opened 3 years ago

jamesngob commented 3 years ago

Hello there, I am a complete newbie in this Hombridge and plug-in. I have an HikVision NVR with the spec below (for demo purpose) IP: 192.168.1.105 Port: 8989 (to view the camera on Hikvision App) Username: admin pass: admin

I installed the plugin FFmpeg and hikvision However, when I copy the hikvision config, the homebridge freeze And I have not done anything yet with the FFmpeg. I guess because that I did not setup the FFmpeg plugin, the homebridge crashes? Could you please show me how to fill in the data for the FFmpeg? Thank you very much for your instruction and patience

kravena commented 3 years ago

You need to use the web portal port, which is probably port 80.

Make sure you have installed the "npm install -g hap-nodejs" in the terminal window in the portal (click 3 dots on top right and click portal).

sponte commented 3 years ago

Hi, firstly apologies for not responding earlier, but all github emails were going into my spam folder :(

Have you tried configuration from the README at https://github.com/eu-evops/homebridge-hikvision?

devil-warrior commented 3 years ago

I have tried using this and I can’t see the cameras in home app

{ "platform": "Hikvision", "host": "192.x.x.x", "port": 443, "username": "admin", "password": "mypassword”

I also tried port 80 and didn’t work.

I can only see the existing devices in Homebridge accessories. Do I need to configure FFmpeg?

I can see the last 80 lines of log and didn’t see any error.

jamesngob commented 3 years ago

@devil-warrior: Have you installed and config "Homebridge Camera FFmpeg" plug in yet? This plug-in will enable each individual camera to be streamed on the Homekit App (via homebridge-hikvision plugin) Details are here: https://github.com/Sunoo/homebridge-camera-ffmpeg The one you did is for the NVR, not for the individual camera It needs both plugins to work

devil-warrior commented 3 years ago

Hey mate,

Thank you for your prompt reply. I did add it in this below and I can see the camera in the home app but not available.

Do I need to add channel number and things like that after the port number in "source"?

I am just a newbie and sorry for asking silly questions.

"name": "Camera1", "videoConfig": { "source": "-i rtsp://192.168.x.x:554", "maxStreams": 5, "maxWidth": 3840, "maxHeight": 2160, "maxFPS": 60

On Mon, Mar 8, 2021 at 1:15 AM jamesngob notifications@github.com wrote:

@devil-warrior https://github.com/devil-warrior: Have you installed and config "Homebridge Camera FFmpeg" plug in yet? This plug-in will enable each individual camera to be streamed on the Homekit App (via homebridge-hikvision plugin) Details are here: https://github.com/Sunoo/homebridge-camera-ffmpeg The one you did is for the NVR, not for the individual camera It needs both plugins to work

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eu-evops/homebridge-hikvision/issues/3#issuecomment-792313358, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKSI5AB4PJNAZP2HGQLZHPTTCOYEHANCNFSM4TCXYYGQ .

jamesngob commented 3 years ago

@devil-warrior: The "source" should be like "-i rtsp://username:password@IP address:port/Streaming/Channels/101" In which:

Hope this helps

devil-warrior commented 3 years ago

Thanks for the detailed explanation. I will give it a try when i get back home.

On Mon, Mar 8, 2021 at 1:01 PM jamesngob notifications@github.com wrote:

@devil-warrior https://github.com/devil-warrior: The "source" should be like "-i rtsp://username:password@IP address:port/Streaming/Channels/101" In which:

  • username & password: The login credential you use to login the NVR
  • IP address:port: IP address of the NVR and the RTSP port (see the NVR management webpage for details)
  • the last 3 digit: 101: The first 1 mean channel e.g. the number of the camera in the NVR
  • the "01" is the stream of the camera - 1 mean mainstream and 2 mean substream

Hope this helps

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eu-evops/homebridge-hikvision/issues/3#issuecomment-792463369, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKSI5AFHRCRG74UOGOAEKRLTCRK2NANCNFSM4TCXYYGQ .

devil-warrior commented 3 years ago

Hi James,

Just to give you an update. I did try the link and it still doesn't work. It seems like a setting needs to be changed in NVR to allow for RTSP because i tried the RTSP with VLC and I couldn't get it to work.

Google search suggested that encryption needs to be turned off or use a different rtsp link. I am asking the supplier to provide an instruction.

will keep you posted.

Cheers!

On Mon, Mar 8, 2021 at 1:21 PM Tommy Bo tommy.bo2012@gmail.com wrote:

Thanks for the detailed explanation. I will give it a try when i get back home.

On Mon, Mar 8, 2021 at 1:01 PM jamesngob notifications@github.com wrote:

@devil-warrior https://github.com/devil-warrior: The "source" should be like "-i rtsp://username:password@IP address:port/Streaming/Channels/101" In which:

  • username & password: The login credential you use to login the NVR
  • IP address:port: IP address of the NVR and the RTSP port (see the NVR management webpage for details)
  • the last 3 digit: 101: The first 1 mean channel e.g. the number of the camera in the NVR
  • the "01" is the stream of the camera - 1 mean mainstream and 2 mean substream

Hope this helps

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eu-evops/homebridge-hikvision/issues/3#issuecomment-792463369, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKSI5AFHRCRG74UOGOAEKRLTCRK2NANCNFSM4TCXYYGQ .

jamesngob commented 3 years ago

Yes, you need to enable the rtsp services in the NVR itself Typically, on newer NVRs, this RTSP services is located at: Configuration > Network > Advanced Settings > Network Service > Enable RTSP You may post your NVR model number and the firmware version so that other people may jump in to help Also, for the encryption, at the moment, the FFmpeg plugin only work with H.264 encoding, so if your NVR quality setting to enable H.264+ or H.265, you will need to modify that back to H.264 Lastly, on your last config, the resolution seems to be too high...

devil-warrior commented 3 years ago

Hey mate,

I really do appreciate that you are helping me.

to give you the answer - yes RTSP is enabled.

My NVR model number is 7608ni-i2/8P and Firmware version is V4.22.000 build 200418.

Now I change it back to H264 and VLC is picking up something and please see the attached.

Screen Shot 2021-03-09 at 6 37 45 pm

the config has now been changed to 1280x720

still not working in HomeKit though.

Please see the log. I have tried 101 as well and didn't work.

[3/9/2021, 7:07:14 PM] [Camera FFmpeg] [Front yard] Video stream requested: 1280 x 720, 30 fps, 299 kbps [3/9/2021, 7:07:14 PM] [Camera FFmpeg] [Front yard] Starting video stream: 1280 x 720, 30 fps, 299 kbps [3/9/2021, 7:07:14 PM] [Camera FFmpeg] [Front yard] Stream command: ffmpeg -i rtsp://username:password@192.168.1.248/Streaming/channels/102 -an -sn -dn -codec:v libx264 -pix_fmt yuv420p -color_range mpeg -r 30 -f rawvideo -preset ultrafast -tune zerolatency -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease,scale=trunc(iw/2)2:trunc(ih/2)2 -b:v 299k -payload_type 99 -ssrc 4733929 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params Jy5qnIgQzk9k/xhBiIlYxDo4Y705bPIVSEAArrj8 srtp://192.168.1.6:51691?rtcpport=51691&pkt_size=1316 -loglevel level -progress pipe:1 [3/9/2021, 7:07:15 PM] [Camera FFmpeg] [Front yard] Stopped video stream.

I am just wondering if there is anything to do with the channel set up. all my cameras feeds are set up with channel 1. I only got 2 at the moment and planning to put more in a few weeks. see the attached.

Screen Shot 2021-03-09 at 7 16 29 pm
jamesngob commented 3 years ago

No, your camera channel looks OK

Check if your username and password is ok to view live?

And also, maybe check the port number again in your NVR. Typically, the default port for RTSP is 554 but it might be different in your settings. You will find these info under Configuration >Network>Basic Settings>Port

In your log, it maybe like this:

"source": "-i rtsp://username:password@192.168.1.248:554/Streaming/Channels/102"

--> Try this with VLC player first. If it works, it is OK for the FFmpeg

Try playing with the resolution and bitrate. For camera setting in the NVR, I use the followings setting for my 16-channels camera.

Stream type: Main Stream (Normal) Video Type: Video Resolution: 1280 x 720P Bitrate Type: Variable Video Quality: Medium Frame Rate: 15 Max. Bitrate 399 Video Encoding H.264

Stream type: Sub-Stream Video Type: Video Resolution: 640x360 Bitrate Type: Variable Video Quality: Medium Frame Rate: 10 Max. Bitrate 199 Video Encoding H.264

Maybe post your sanitized homebridge config file here as well (please cross out/replace any private info such as IP address, password, etc...

devil-warrior commented 3 years ago

please see the config

        "name": "Camera FFmpeg",
        "cameras": [
            {
                "name": "Front yard",
                "manufacturer": "Hikvision",
                "model": "xxxx",
                "serialNumber": "xxxx",
                "videoConfig": {
                    "source": "-i ***@***.***

/Streaming/channels/102", "maxStreams": 2, "maxWidth": 1280, "maxHeight": 720, "maxFPS": 30 } } ], "platform": "Camera-ffmpeg" }, { "platform": "Hikvision", "name": "Hikvision", "host": “192.168.x.x", "port": 443, "username": “myusername", "password": “mypassword”

The problem is I couldn’t even get it streamed on VLC player. It is distorted.

I have now reduced the video perimeters like yours and still not showing anything.

appreciate your help mate.

Cheers!

On 9 Mar 2021, at 2:18 pm, jamesngob @.***> wrote:

Yes, you need to enable the rtsp services in the NVR itself You may post your NVR model number and the firmware version so that other people may jump in to help

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eu-evops/homebridge-hikvision/issues/3#issuecomment-793447506, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKSI5AC2RUSTYTIZDYCWOBLTCW4UFANCNFSM4TCXYYGQ .