Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Camera Support]: Amcrest IP5M-1190W ONVIF not working #9813

Open
Sandman224 opened this issue Feb 11, 2024 · 22 comments
Open

[Camera Support]: Amcrest IP5M-1190W ONVIF not working #9813

Sandman224 opened this issue Feb 11, 2024 · 22 comments

Comments

@Sandman224
Copy link

Sandman224 commented Feb 11, 2024

Describe the problem you are having

I upgraded my frigate installation to the latest because I saw PTZ support was added. I have two PTZ cameras (Amcrest IP5M-1190W) and I added the required entries to the frigate config file for ONVIF as follows:

    onvif:
      host: 192.168.86.45
      port: 80
      user: admin
      password: (redacted)

After adding this I get an error in the frigate logs:

2024-02-11 15:28:23.889963896  [2024-02-11 15:28:23] frigate.ptz.onvif              ERROR   : Unable to connect to camera: Front: Unknown error: Sender not Authorized. Invalid username or password! You still have 28 attempt(s).

I tried this with my other Amcrest cameras which are different models and do not support PTZ and had no issues. I did make sure to enable ONVIF in the Amcrest camera settings and my username and password are definitely correct.

I am beginning to think its an issue with the camera itself, but I wanted to see if this was something anyone else has encountered. Some preliminary google searches about this camera and ONVIF support returned this thread which seems to indicate there is some issue with how authentication is handled for this camera and is an issue seen with other software. However they did eventually fix the issue although I am not certain as to how exactly the solution was accomplished.

Version

0.13.1

Frigate config file

mqtt:
  host: 192.168.86.21
  user: mqtt
  password: (redacted)

ffmpeg:
  hwaccel_args: -hwaccel vaapi
  output_args:
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
#LIBVA_DRIVER_NAME=i965

detectors:
  coral:
    type: edgetpu
    device: usb

objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
    - dog

  filters:
    dog:
      min_score: 0.6
      threshold: 0.7

    person:
      min_score: 0.6
      threshold: 0.7


motion:
  threshold: 50
  improve_contrast: true

record:
  enabled: True
  retain:
    days: 7
    mode: motion
  events:
    retain:
      default: 21
      mode: active_objects
      objects:
        dog: 30
        person: 30
        car: 7

snapshots:
  enabled: True
  timestamp: False
  bounding_box: False
  retain:
    default: 14
    objects:
      person: 14
      dog: 14
      car: 5

# Optional: birdseye configuration
# NOTE: Can (enabled, mode) be overridden at the camera level
birdseye:
  # Optional: Enable birdseye view (default: shown below)
  enabled: True
  # Optional: Width of the output resolution (default: shown below)
  width: 1920
  # Optional: Height of the output resolution (default: shown below)
  height: 1080
  # Optional: Encoding quality of the mpeg1 feed (default: shown below)
  # 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
  quality: 8
  # Optional: Mode of the view. Available options are: objects, motion, and continuous
  #   objects - cameras are included if they have had a tracked object within the last 30 seconds
  #   motion - cameras are included if motion was detected in the last 30 seconds
  #   continuous - all cameras are included always
  mode: objects

cameras:
  Garage:
    ffmpeg:
      inputs:
        - path: rtsp://admin:(redacted)@192.168.86.39:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
          roles:
            - rtmp
    detect:
      width: 2592
      height: 1944
      stationary:
        # Optional: Frequency for confirming stationary objects (default: shown below)
        # When set to 0, object detection will not confirm stationary objects until movement is detected.
        # If set to 10, object detection will run to confirm the object still exists on every 10th frame.
        #interval: 0
        # Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
        threshold: 50
        # Optional: Define a maximum number of frames for tracking a stationary object (default: not set, track forever)
        # This can help with false positives for objects that should only be stationary for a limited amount of time.
        # It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
        # car at the default.
        # WARNING: Setting these values overrides default behavior and disables stationary object tracking.
        #          There are very few situations where you would want it disabled. It is NOT recommended to
        #          copy these values from the example config into your config unless you know they are needed.
        max_frames:
          # Optional: Default for all object types (default: not set, track forever)
          default: 3000
          # Optional: Object specific values
          objects:
            car: 100
    objects:
      track:
        - person
        - dog

  Back:
    ffmpeg:
      inputs:
        - path: rtsp://admin:(redacted)@192.168.86.63:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
          roles:
            - rtmp
    detect:
      width: 2560
      height: 1920
      stationary:
        # Optional: Frequency for confirming stationary objects (default: shown below)
        # When set to 0, object detection will not confirm stationary objects until movement is detected.
        # If set to 10, object detection will run to confirm the object still exists on every 10th frame.
        #interval: 0
        # Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
        threshold: 50
        # Optional: Define a maximum number of frames for tracking a stationary object (default: not set, track forever)
        # This can help with false positives for objects that should only be stationary for a limited amount of time.
        # It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
        # car at the default.
        # WARNING: Setting these values overrides default behavior and disables stationary object tracking.
        #          There are very few situations where you would want it disabled. It is NOT recommended to
        #          copy these values from the example config into your config unless you know they are needed.
        max_frames:
          # Optional: Default for all object types (default: not set, track forever)
          default: 3000
          # Optional: Object specific values
          objects:
            car: 100
    objects:
      track:
        - person
        - dog

    zones:
      back_door:
        coordinates: 1560,1639,1652,1642,1637,1920,2560,1920,2560,1081,2153,1057,2100,843,1618,793,1601,1057

  Front:
    ffmpeg:
      inputs:
        - path: rtsp://admin:(redacted)@192.168.86.45:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
          roles:
            - rtmp
    onvif:
      host: 192.168.86.45
      port: 80
      user: admin
      password: (redacted)

    detect:
      width: 2560
      height: 1920
      stationary:
        # Optional: Frequency for confirming stationary objects (defa>
        # When set to 0, object detection will not confirm stationary>
        # If set to 10, object detection will run to confirm the obje>
        #interval: 0
        # Optional: Number of frames without a position change for an>
        threshold: 50
        # Optional: Define a maximum number of frames for tracking a >
        # This can help with false positives for objects that should >
        # It can also be used to disable stationary object tracking. >
        # car at the default.
        # WARNING: Setting these values overrides default behavior an>
        #          There are very few situations where you would want>
        #          copy these values from the example config into you>
        max_frames:
          # Optional: Default for all object types (default: not set,>
          default: 3000
          # Optional: Object specific values
          objects:
            car: 100
    objects:
      track:
        - person
        - dog
      filters:
        dog:
          mask:
            - 1185,1736,1474,1920,2203,1920,2437,1337,1909,1104
        person:
          mask:
            - 1185,1736,1474,1920,2203,1920,2437,1337,1909,1104
            - 1931,989,1942,861,2070,943,2002,1032
    motion:
      mask:
        - 1154,1728,1472,1920,2203,1920,2443,1339,1892,1050,1863,896,1776,956,1747,1229

    zones:
      front_porch:
        coordinates: 2433,1364,2560,869,2194,736,2071,850,1963,846,1765,981
 
  Alley:
    ffmpeg:
      inputs:
        - path: rtsp://admin:(redacted)@192.168.86.38:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
          roles:
            - rtmp
    detect:
      width: 3840
      height: 2160
    objects:
      track:
        - person
        - dog
        - car
      filters:
        car:
          mask:
            - 1805,0,2637,21,2601,307,2128,342,1798,314
            - 3015,0,3678,262,3559,594,2920,292,2934,157,2718,95,2718,0
        person:
          mask:
            - 1805,0,2637,21,2601,307,2128,342,1798,314
            - 3015,0,3678,262,3559,594,2920,292,2934,157,2718,95,2718,0
        dog:
          mask:
            - 1805,0,2637,21,2601,307,2128,342,1798,314
            - 3015,0,3678,262,3559,594,2920,292,2934,157,2718,95,2718,0
    

  Side:
    ffmpeg:
      inputs:
        - path: rtsp://admin:(redacted)@192.168.86.40:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
          roles:
            - record
            - detect
            - rtmp
    detect:
      width: 3840
      height: 2160
      stationary:
        # Optional: Frequency for confirming stationary objects (defa>
        # When set to 0, object detection will not confirm stationary>
        # If set to 10, object detection will run to confirm the obje>
        #interval: 0
        # Optional: Number of frames without a position change for an>
        threshold: 50
        # Optional: Define a maximum number of frames for tracking a >
        # This can help with false positives for objects that should >
        # It can also be used to disable stationary object tracking. >
        # car at the default.
        # WARNING: Setting these values overrides default behavior an>
        #          There are very few situations where you would want>
        #          copy these values from the example config into you>
        max_frames:
          # Optional: Default for all object types (default: not set,>
          default: 3000
          # Optional: Object specific values
          objects:
            dog: 3000
    objects:
      track:
        - person
        - dog

    zones:
      side_yard:
        coordinates: 914,892,1631,745,2467,593,3309,505,3509,487,3406,992,3840,1276,3840,2160,0,2160,0,1160

Relevant log output

2024-02-11 15:28:23.889963896  [2024-02-11 15:28:23] frigate.ptz.onvif              ERROR   : Unable to connect to camera: Front: Unknown error: Sender not Authorized. Invalid username or password! You still have 28 attempt(s).

FFprobe output from your camera

[{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"5/1","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":1920,"width":2560},{"avg_frame_rate":"0/0","codec_long_name":"AAC(AdvancedAudioCoding)"}]}}]

Frigate stats

No response

Operating system

Debian

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

Amcrest IP5M-1190W

Any other information that may be helpful

No response

@NickM-27
Copy link
Sponsor Collaborator

You need to make sure and add the user / pass to onvif. There is a separate list and your camera login does not carry over

@Sandman224
Copy link
Author

You need to make sure and add the user / pass to onvif. There is a separate list and your camera login does not carry over

Yes It has been added to the ONVIF section. See the config file under front

@NickM-27
Copy link
Sponsor Collaborator

no, I am saying in the camera itself there is a list of user / pass for rtsp / camera login and there is a separate part of the camera UI that holds where you add the onvif user / pass. They do not get shared automatically

@Sandman224
Copy link
Author

Well my other Amcrest cameras work with the username and password that is used for rstp/camera login. I cannot find another section of the camera UI that contains a different ONVIF username and password. This is the only section on any of the Amcrest cameras that even mentiones ONVIF:
image

@NickM-27
Copy link
Sponsor Collaborator

just checked my amcrest camera, under system -> users there is a list of users. on my camera there are headers at the top for users, onvif users, then user groups.

In any case make sure your user has ptz permission

@Sandman224
Copy link
Author

Sandman224 commented Feb 11, 2024

Hmm I don't seem to have that in my options
image
In any event my admin user has PTZ control perms
image
image

@brubaked
Copy link

Any luck getting this camera to work?

@Sandman224
Copy link
Author

Any luck getting this camera to work?

Nope still haven't figured it out. Granted I have not done much since I opened the issue because I feel like I have done everything I can.

@sdgilvey
Copy link

Just setting up one of these cameras and I ran into the onvif login problem. From the system/manage users section there is nothing about onvif. I used "onvif device manager" to log into the camera and modify the user name / password. With device manager log into the camera with the default credentials... admin admin. Once logged in you can use "user management" to change the password. I had already changed the password with the web management but still had to use the default password to change the settings in onvif device manager.
onvif
I have not power cycled the camera yet so I have not checked to see if it remembers the change.
Just starting to try to hunt down the rtsp url needed for the camera.

@Sandman224
Copy link
Author

Interesting find. I have done the same as you and now it connects to frigate. However PTZ control is still very broken in both the onvif device manager and frigate.

@BSkando
Copy link

BSkando commented Mar 19, 2024

I wrestled with this for a while and finally got PT working. My cameras have no Z, but I'm cool with that.

My specific Amcrest camera models:
IP2M-841B
IP2M-841W

I was able to login to both cameras with ONVIF Device Manager (Thank you @sdgilvey !!!). I used the same user/pass that works for logging in to the Amcrest interface.

From there, I created a new admin user for each camera.

Then added this to each of the cameras:

onvif:
  host: 10.10.6.3
  port: 80
  user: NEW-ADMIN-USER
  password: NEW-ADMIN-USER-PASS

Not sure how much, if any, of that was necessary, but it now works great with both cameras!

Side note for RTSP links...try these @sdgilvey

Main Stream:
rtsp://USER:PASS@CAMERAIP:554/cam/realmonitor?channel=1&subtype=0

Sub Stream:
rtsp://USER:PASS@CAMERAIP:554/cam/realmonitor?channel=1&subtype=1

@Sandman224
Copy link
Author

Sandman224 commented Mar 20, 2024

Hmm I tried creating a new user for my camera like @BSkando mentioned. Still no dice. ONVIF device manager gives me this error on continuous move and does nothing on the other two options:
image
Frigate gives me a Z option although this model does not have zoom. It also gives me no option for PT control:
image

@ptruman
Copy link

ptruman commented Mar 25, 2024

Interesting. Your camera UI in this post matches my Jennov. ONVIF ODM claims it's ONVIF also, but it's "not certified" and I only got PTZ to work with ZoneMinder with a proper kludge (it was mostly calling scripts, not ONVIF).

I pinged Jennov for updated f/w but was told "there is none". Camera also suffers from the leap year bug where it was 1-3 days ahead on date stamp in Feb...

@Sandman224
Copy link
Author

Updated frigate from 0.13.1 to 0.13.2 and got the options for pan and tilt in the gui. As expected they do not do anything. I definitely feel like this is a camera issue rather than frigate.

image

@ptruman
Copy link

ptruman commented Mar 26, 2024

I don't even get the UI :)
I have tried "gonvif" which says "ONVIF not supported" - so whatever some of these cameras do, it's "pseudo-ONVIF" and not "official". I would try ODM but virustotal has put me off that entirely!

@Cam-New-Ton
Copy link

Messed with this issue after the latest Amcrest update. The Cameras are trying to force https 443 on the Onvif connections with what most servers see as a invalid certificate. Simple...should I say very simple fix is to log into the camera, go to the network settings and https. Uncheck the box to use HTTPS and reboot the camera. The ONVIF will connect perfectly! Viola!!

@Sandman224
Copy link
Author

Sandman224 commented Mar 27, 2024

Messed with this issue after the latest Amcrest update. The Cameras are trying to force https 443 on the Onvif connections with what most servers see as a invalid certificate. Simple...should I say very simple fix is to log into the camera, go to the network settings and https. Uncheck the box to use HTTPS and reboot the camera. The ONVIF will connect perfectly! Viola!!

Where do you change that setting? On the camera interface or using the ONVIF device manager?

My cameras already have the enable HTTPS box unchecked in the camera settings interface so I am not sure why I would have an issue still.
image

@Cam-New-Ton
Copy link

I changed mine right where you are at. Did a reboot and it worked for every single amcrest camera we have. We are using the ONVIF-S with authentication, that may make a difference as well?

@Sandman224
Copy link
Author

Sandman224 commented Mar 27, 2024

Hmm interesting. I turned HTTPS on and got the certificate error in the frigate logs. Turning it off again just results in the same error as before.
image

When you say you are using ONVIF-S what do you mean exactly by that? Is that something I change on the camera or in Frigate?

@Cam-New-Ton
Copy link

Assume you are using port 80 yes?

@Sandman224
Copy link
Author

Assume you are using port 80 yes?

Yes I am using port 80. Tried a few more things but still couldn't get it to work properly.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants