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

UniFi Protect discussion #1538

Open
AlexxIT opened this issue Jan 5, 2025 · 49 comments
Open

UniFi Protect discussion #1538

AlexxIT opened this issue Jan 5, 2025 · 49 comments
Labels
camera Discussion on a particular camera model

Comments

@AlexxIT
Copy link
Owner

AlexxIT commented Jan 5, 2025

This issue is for discussing the operation of UniFi Protect software. Related links:

@AlexxIT AlexxIT added the camera Discussion on a particular camera model label Jan 5, 2025
@blockiindahood
Copy link

@AlexxIT regarding your comment on #1520 (comment)

Unifi does not accept my newly uploaded config, just throws an error.
See my code: https://gist.github.com/blockiindahood/89642419ca5947124deb16e2b1649a17

I did change the values as you described, do I have to edit anything else?

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 5, 2025

Are you sure your JSON valid (whole cameras.json file)?

@blockiindahood
Copy link

Yes, checked it.

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 5, 2025

Have you copied another ONVIF camera? Because I'm copied another go2rtc camera. I have added it via WebUI. Maybe other JSON values important. I don't know. I'll check it later.

@blockiindahood
Copy link

Yes, I've copied another ONVIF camera.

Could you share your config for one of your go2rtc cams?

@BrunoTCouto
Copy link
Contributor

#1520 (comment)

I got it right ?

Doing this way I don't need to have one instance of go2rtc for each camera ?

Or I only don't need to have one IP for each instance?

@BrunoTCouto
Copy link
Contributor

Wondering if I could connect directly to RTSP camera doing this way. Will test later

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 5, 2025

@blockiindahood this is my file https://gist.github.com/AlexxIT/d91b828171de3f2af2ca43b60d187c81
Just created it from the scratch. And tested. I'm using Protect 5.1.85.

@BrunoTCouto one go2rtc, one IP, unlimited cameras. This will work directly with any RTSP camera. Also without go2rtc.

@MartynasZilinskas
Copy link

@AlexxIT Thank you for sharing. From your configuration I only changed thirdPartyCameraInfo and it started working.

My best guess is channels misconfiguration on my side that stuck the streaming.

@blockiindahood
Copy link

@AlexxIT seems to be a zipping problem: downloading the config, unzipping it, not changing anything, zipping it, and uploading it, does not work.

only uploading an original downloaded zip file work for me

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 5, 2025

Maybe your archiver has a problem. I'm using the built in TotalCmd.

@blockiindahood
Copy link

I'll test this. I am using macOS's native one.

@BrunoTCouto
Copy link
Contributor

BrunoTCouto commented Jan 5, 2025

It works !! One go2rtc and two Hikvision facial detectors :D 🥇

image
Sem título

@BrunoTCouto
Copy link
Contributor

Hey @AlexxIT, I tried connecting directly, but Protect still need some api responses from ONVIF.

Anyways, thank you for the hack on protect. It will help a lot to manage just one go2rtsp instance :D 🎉

image
image

@BrunoTCouto
Copy link
Contributor

BrunoTCouto commented Jan 5, 2025

My config for reference:

go2rtc
streams:
  entrada_social: 'rtsp://user:[email protected]/Streaming/Channels/101/'
  entrada_servico: 'rtsp://user:[email protected]/Streaming/Channels/101/'
  porteiro_eletronico: 'rtsp://user:[email protected]/Streaming/Channels/101/'

rtsp:
  listen: ":9554"
  
log:
  api: trace
  onvif: trace  
protect
{
  "mac": "08BFB82D0680",
  "host": "192.168.1.96",
  "connectionHost": null,
  "type": " go2rtc",
  "name": " go2rtc",
  "upSince": null,
  "lastSeen": 1735606514489,
  "connectedSince": null,
  "lastDisconnect": 1735606515852,
  "authToken": null,
  "hardwareRevision": null,
  "firmwareVersion": null,
  "firmwareBuild": null,
  "isUpdating": false,
  "isAdopting": false,
  "isAdopted": true,
  "isAdoptedByOther": false,
  "isProvisioned": true,
  "isSshEnabled": false,
  "fingerprint": null,
  "password": "siMbOAuMSlyWy7zIfRWq",
  "guid": null,
  "anonymousDeviceId": null,
  "consoleId": null,
  "needForceAdopt": false,
  "lastMotion": null,
  "micVolume": 80,
  "isMicEnabled": true,
  "hdrMode": false,
  "videoMode": "default",
  "isProbingForWifi": false,
  "apMac": null,
  "apRssi": null,
  "elementInfo": null,
  "chimeDuration": 0,
  "lastRing": null,
  "activePatrolSlot": null,
  "useGlobal": false,
  "downScaleMode": 0,
  "isExtenderInstalledEver": false,
  "userConfiguredAp": false,
  "videoCodec": "h264",
  "videoCodecState": 0,
  "isThirdPartyCamera": true,
  "isPairedWithAiPort": false,
  "ptzControlEnabled": false,
  "channels": [
    {
      "id": 0,
      "videoId": "video1",
      "name": "High",
      "enabled": true,
      "isRtspEnabled": false,
      "rtspAlias": null,
      "width": 1920,
      "height": 1080,
      "fps": null,
      "bitrate": null,
      "minBitrate": null,
      "maxBitrate": null,
      "minClientAdaptiveBitRate": null,
      "minMotionAdaptiveBitRate": null,
      "fpsValues": [
        null
      ],
      "idrInterval": 5,
      "autoFps": false,
      "autoBitrate": false
    },
    {
      "id": 1,
      "videoId": "video2",
      "name": "Medium",
      "enabled": true,
      "isRtspEnabled": false,
      "rtspAlias": null,
      "width": 1920,
      "height": 1080,
      "fps": null,
      "bitrate": null,
      "minBitrate": null,
      "maxBitrate": null,
      "minClientAdaptiveBitRate": null,
      "minMotionAdaptiveBitRate": null,
      "fpsValues": [
        null
      ],
      "idrInterval": 5,
      "autoFps": false,
      "autoBitrate": false
    },
    {
      "id": 2,
      "videoId": "video3",
      "name": "Low",
      "enabled": true,
      "isRtspEnabled": false,
      "rtspAlias": null,
      "width": 1920,
      "height": 1080,
      "fps": null,
      "bitrate": null,
      "minBitrate": null,
      "maxBitrate": null,
      "minClientAdaptiveBitRate": null,
      "minMotionAdaptiveBitRate": null,
      "fpsValues": [
        null
      ],
      "idrInterval": 5,
      "autoFps": false,
      "autoBitrate": false
    }
  ],
  "ispSettings": {
    "aeMode": "auto",
    "irLedMode": "auto",
    "irLedLevel": 255,
    "wdr": 1,
    "icrSensitivity": 0,
    "icrSwitchMode": "sensitivity",
    "icrCustomValue": 2,
    "brightness": 50,
    "contrast": 50,
    "hue": 50,
    "saturation": 50,
    "sharpness": 50,
    "denoise": 50,
    "isColorNightVisionEnabled": false,
    "spotlightDuration": 15,
    "isFlippedVertical": false,
    "isFlippedHorizontal": false,
    "isAutoRotateEnabled": false,
    "isLdcEnabled": true,
    "is3dnrEnabled": true,
    "isExternalIrEnabled": false,
    "isAggressiveAntiFlickerEnabled": false,
    "isPauseMotionEnabled": false,
    "dZoomCenterX": 50,
    "dZoomCenterY": 50,
    "dZoomScale": 0,
    "dZoomStreamId": 4,
    "focusMode": "ztrig",
    "focusPosition": 0,
    "touchFocusX": 0,
    "touchFocusY": 0,
    "zoomPosition": 0,
    "mountPosition": null,
    "hdrMode": "normal",
    "sceneMode": "auto"
  },
  "audioSettings": {
    "style": [
      "nature"
    ]
  },
  "talkbackSettings": {
    "typeFmt": "aac",
    "typeIn": "serverudp",
    "bindAddr": "0.0.0.0",
    "bindPort": 7004,
    "filterAddr": null,
    "filterPort": null,
    "channels": 1,
    "samplingRate": 22050,
    "bitsPerSample": 16,
    "quality": 100
  },
  "osdSettings": {
    "isNameEnabled": false,
    "isDateEnabled": false,
    "isLogoEnabled": true,
    "isDebugEnabled": false
  },
  "ledSettings": {
    "isEnabled": true,
    "blinkRate": 0
  },
  "speakerSettings": {
    "isEnabled": true,
    "areSystemSoundsEnabled": false,
    "volume": 80,
    "ringVolume": 80
  },
  "recordingSettings": {
    "prePaddingSecs": 2,
    "postPaddingSecs": 2,
    "smartDetectPrePaddingSecs": 2,
    "smartDetectPostPaddingSecs": 2,
    "minMotionEventTrigger": 1000,
    "endMotionEventDelay": 3000,
    "suppressIlluminationSurge": false,
    "_recordingEventOnly": "detections",
    "mode": "always",
    "_inScheduleMode": "always",
    "inScheduleMode": "always",
    "_outScheduleMode": "never",
    "outScheduleMode": "never",
    "geofencing": "off",
    "motionAlgorithm": "stable",
    "enableMotionDetection": true
  },
  "smartDetectSettings": {
    "objectTypes": [],
    "autoTrackingObjectTypes": [],
    "autoTrackingWithZoom": true,
    "audioTypes": [],
    "detectionRange": {
      "max": null,
      "min": null
    }
  },
  "recordingSchedulesV2": [],
  "motionZones": [],
  "privacyZones": [],
  "smartDetectZones": [],
  "smartDetectLines": [],
  "smartDetectLoiterZones": [],
  "stats": {
    "rxBytes": 0,
    "txBytes": 0,
    "wifi": {
      "channel": null,
      "frequency": null,
      "linkSpeedMbps": null,
      "signalQuality": 50,
      "signalStrength": 0
    },
    "video": {
      "recordingStart": 1735601874840,
      "recordingEnd": 1735606474800,
      "recordingStartLQ": 1735603883520,
      "recordingEndLQ": 1735606500800,
      "timelapseStart": 1735603883520,
      "timelapseEnd": 1735606003720,
      "timelapseStartLQ": 1735603883520,
      "timelapseEndLQ": 1735604783560
    },
    "lenses": []
  },
  "featureFlags": {
    "canAdjustIrLedLevel": false,
    "canMagicZoom": false,
    "canOpticalZoom": false,
    "canTouchFocus": false,
    "hasAccelerometer": false,
    "hasVerticalFlip": true,
    "hasAec": false,
    "hasBluetooth": false,
    "hasChime": false,
    "hasExternalIr": false,
    "hasIcrSensitivity": true,
    "hasInfrared": false,
    "hasLdc": false,
    "hasLedIr": false,
    "hasLedStatus": false,
    "hasLineIn": false,
    "hasMic": false,
    "hasPrivacyMask": true,
    "hasRtc": false,
    "hasSdCard": false,
    "hasSpeaker": false,
    "hasWifi": false,
    "hasHdr": false,
    "hasAutoICROnly": false,
    "videoModes": [],
    "videoModeMaxFps": [],
    "hasMotionZones": true,
    "hasLcdScreen": false,
    "hasFingerprintSensor": false,
    "mountPositions": [],
    "videoSourceCount": 1,
    "smartDetectTypes": [],
    "smartDetectAudioTypes": [],
    "supportDoorAccessConfig": false,
    "supportNfc": false,
    "supportLpDetectionWithoutVehicle": false,
    "lensType": null,
    "lensModel": null,
    "motionAlgorithms": [],
    "hasSquareEventThumbnail": false,
    "hasPackageCamera": false,
    "audio": [],
    "audioCodecs": [],
    "videoCodecs": [],
    "audioStyle": [],
    "isDoorbell": false,
    "isPtz": false,
    "hasColorLcdScreen": false,
    "hasLiveviewTracking": false,
    "hasLineCrossing": false,
    "hasLineCrossingCounting": false,
    "hasFlash": false,
    "flashRange": null,
    "hasLuxCheck": false,
    "presetTour": false,
    "hasEdgeRecording": false,
    "hasLprReflex": false,
    "privacyMaskCapability": {
      "maxMasks": null,
      "rectangleOnly": false
    },
    "focus": {
      "steps": {
        "max": null,
        "min": null,
        "step": null
      },
      "degrees": {
        "max": null,
        "min": null,
        "step": null
      }
    },
    "pan": {
      "steps": {
        "max": null,
        "min": null,
        "step": null
      },
      "degrees": {
        "max": null,
        "min": null,
        "step": null
      }
    },
    "tilt": {
      "steps": {
        "max": null,
        "min": null,
        "step": null
      },
      "degrees": {
        "max": null,
        "min": null,
        "step": null
      }
    },
    "zoom": {
      "ratio": 22,
      "steps": {
        "max": null,
        "min": null,
        "step": null
      },
      "degrees": {
        "max": null,
        "min": null,
        "step": null
      }
    },
    "hotplug": {
      "audio": null,
      "video": null,
      "standaloneAdoption": false,
      "extender": {
        "isAttached": null,
        "hasFlash": null,
        "flashRange": null,
        "hasIR": null,
        "hasRadar": null,
        "radarRangeMax": null,
        "radarRangeMin": null
      }
    }
  },
  "lcdMessage": {},
  "streamSharing": {
    "enabled": false,
    "token": null,
    "shareLink": null,
    "expires": null,
    "sharedByUserId": null,
    "sharedByUser": null,
    "maxStreams": null
  },
  "homekitSettings": {
    "talkbackSettingsActive": false,
    "streamInProgress": false,
    "microphoneMuted": false,
    "speakerMuted": false
  },
  "shortcuts": [],
  "thirdPartyCameraInfo": {
    "port": "1984",
    "username": "admin",
    "password": "admin",
    "rtspUrl": "rtsp://192.168.1.96:9554/entrada_social",
    "rtspUrlLQ": "rtsp://192.168.1.96:9554/entrada_social",
    "snapshotUrl": "http://192.168.1.96:1984/api/frame.jpeg?src=entrada_social"
  },
  "fingerprintSettings": {
    "enable": false,
    "enablePrintLatency": false,
    "mode": "identify",
    "reportFingerTouch": false,
    "reportCaptureComplete": false
  },
  "nfcSettings": {
    "enableNfc": false,
    "supportThirdPartyCard": false
  },
  "id": "6773359103e08303e4000500"
}

On protect configuration, I changed

  • mac
  • id
  • thirdPartyCameraInfo

You will also need to change the host as yours will be different from mine

@BrunoTCouto
Copy link
Contributor

RateControl fix

#1539

@michael-blue2
Copy link

I have been trying for some hours to get this done, but no luck. I can get the go2rtc camera to show up in unify but its just offline. Just something that I though:
I am running go2rtc inside ha, which that makes my ip to be 127.0.0.1 correct?
Some trouble shooting:
I can connect though generic camera with: rtsp://127.0.0.1:9554/doorbell with ha
but if i try to connect using onvif then I cannot.

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 7, 2025

  • I have problems with stream with AAC audio. Haven't figured it out yet, but if audio is turned off, the stream works
  • 127.0.0.1 - it's localhost. Shouldn't work
  • Protect doesn't support ONVIF from any go2rtc releases. Only latest master version supported

@michael-blue2
Copy link

  1. How do you disable the audio? I haven't found anything online its a KD8003 Doorbell
  2. any idea how to find my IP on go2rtc installed in HA? sometimes on the log it does shows a 192.168.0.17 which I assume it should be.
  3. When should be expect the update with the implemented support?

@blockiindahood
Copy link

blockiindahood commented Jan 7, 2025

@michael-blue2 the IP of go2rtc is the local ip of your HA instance together with port 1984
for me its: https://10.1.50.185:1984/

@michael-blue2
Copy link

@blockiindahood thank you for that, now everything does click! ahahah

@BrunoTCouto
Copy link
Contributor

BrunoTCouto commented Jan 7, 2025

Hey @AlexxIT I am not sure if this is another thing that broke after the onvif refactor, but now I only can use the auto stream, before I was able to select low, auto and high on Protect

About audio, looks like the protect onvif integration does not work with audio at all. Even direct camera access.

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 9, 2025

If I'm not mistaken, the stream worked fine for my Tapo camera. There's PCMA audio.
And the stream didn't work at all for Dahua and Reolink cameras. They're AAC audio.

Audio can be ignored in different ways:

  • disable in the camera's settings
  • add ?video to RTSP link from go2rtc: "rtspUrl": "rtsp://192.168.1.123:8554/dahua1?video"
  • add #media=video to RTSP link in the go2rtc config dahua1: rtsp://user:[email protected]/...#media=video

@artinbastani
Copy link

artinbastani commented Jan 9, 2025

i haven't been able to manually add an rtsp camera from go2rtc

I tried taking your example configs from above and editing for my camera, no luck
I tried copying another ONVIF camera of mine and editing it and no luck

unifi just says the cameras are offline

i created a separate go2rtc lxc in proxmox with a simple config

 streams:
  livingroom: rtsp://192.168.1.2:8554/livingroom

rtsp:
  listen: ":8554"    # RTSP Server TCP port, default - 8554
  username: "admin"  # optional, default - disabled
  password: "admin" 

logs:
  api: trace
  onvif: trace

and this is the config im using in unifi...

{
    "mac": "08BFB82D0681",
    "host": "192.168.1.157",
    "connectionHost": null,
    "type": " go2rtc",
    "name": " livingroom",
    "upSince": null,
    "lastSeen": 1735606514489,
    "connectedSince": null,
    "lastDisconnect": 1735606515852,
    "authToken": null,
    "hardwareRevision": null,
    "firmwareVersion": null,
    "firmwareBuild": null,
    "isUpdating": false,
    "isAdopting": false,
    "isAdopted": true,
    "isAdoptedByOther": false,
    "isProvisioned": true,
    "isSshEnabled": false,
    "fingerprint": null,
    "password": "siMbOAuMSlyWy7zIfRWq",
    "guid": null,
    "anonymousDeviceId": null,
    "consoleId": null,
    "needForceAdopt": true,
    "lastMotion": null,
    "micVolume": 80,
    "isMicEnabled": true,
    "hdrMode": false,
    "videoMode": "default",
    "isProbingForWifi": false,
    "apMac": null,
    "apRssi": null,
    "elementInfo": null,
    "chimeDuration": 0,
    "lastRing": null,
    "activePatrolSlot": null,
    "useGlobal": false,
    "downScaleMode": 0,
    "isExtenderInstalledEver": false,
    "userConfiguredAp": false,
    "videoCodec": "h264",
    "videoCodecState": 0,
    "isThirdPartyCamera": true,
    "isPairedWithAiPort": false,
    "ptzControlEnabled": false,
    "channels": [
      {
        "id": 0,
        "videoId": "video1",
        "name": "High",
        "enabled": true,
        "isRtspEnabled": false,
        "rtspAlias": null,
        "width": 1920,
        "height": 1080,
        "fps": null,
        "bitrate": null,
        "minBitrate": null,
        "maxBitrate": null,
        "minClientAdaptiveBitRate": null,
        "minMotionAdaptiveBitRate": null,
        "fpsValues": [
          null
        ],
        "idrInterval": 5,
        "autoFps": false,
        "autoBitrate": false
      },
      {
        "id": 1,
        "videoId": "video2",
        "name": "Medium",
        "enabled": true,
        "isRtspEnabled": false,
        "rtspAlias": null,
        "width": 1920,
        "height": 1080,
        "fps": null,
        "bitrate": null,
        "minBitrate": null,
        "maxBitrate": null,
        "minClientAdaptiveBitRate": null,
        "minMotionAdaptiveBitRate": null,
        "fpsValues": [
          null
        ],
        "idrInterval": 5,
        "autoFps": false,
        "autoBitrate": false
      },
      {
        "id": 2,
        "videoId": "video3",
        "name": "Low",
        "enabled": true,
        "isRtspEnabled": false,
        "rtspAlias": null,
        "width": 1920,
        "height": 1080,
        "fps": null,
        "bitrate": null,
        "minBitrate": null,
        "maxBitrate": null,
        "minClientAdaptiveBitRate": null,
        "minMotionAdaptiveBitRate": null,
        "fpsValues": [
          null
        ],
        "idrInterval": 5,
        "autoFps": false,
        "autoBitrate": false
      }
    ],
    "ispSettings": {
      "aeMode": "auto",
      "irLedMode": "auto",
      "irLedLevel": 255,
      "wdr": 1,
      "icrSensitivity": 0,
      "icrSwitchMode": "sensitivity",
      "icrCustomValue": 2,
      "brightness": 50,
      "contrast": 50,
      "hue": 50,
      "saturation": 50,
      "sharpness": 50,
      "denoise": 50,
      "isColorNightVisionEnabled": false,
      "spotlightDuration": 15,
      "isFlippedVertical": false,
      "isFlippedHorizontal": false,
      "isAutoRotateEnabled": false,
      "isLdcEnabled": true,
      "is3dnrEnabled": true,
      "isExternalIrEnabled": false,
      "isAggressiveAntiFlickerEnabled": false,
      "isPauseMotionEnabled": false,
      "dZoomCenterX": 50,
      "dZoomCenterY": 50,
      "dZoomScale": 0,
      "dZoomStreamId": 4,
      "focusMode": "ztrig",
      "focusPosition": 0,
      "touchFocusX": 0,
      "touchFocusY": 0,
      "zoomPosition": 0,
      "mountPosition": null,
      "hdrMode": "normal",
      "sceneMode": "auto"
    },
    "audioSettings": {
      "style": [
        "nature"
      ]
    },
    "talkbackSettings": {
      "typeFmt": "aac",
      "typeIn": "serverudp",
      "bindAddr": "0.0.0.0",
      "bindPort": 7004,
      "filterAddr": null,
      "filterPort": null,
      "channels": 1,
      "samplingRate": 22050,
      "bitsPerSample": 16,
      "quality": 100
    },
    "osdSettings": {
      "isNameEnabled": false,
      "isDateEnabled": false,
      "isLogoEnabled": true,
      "isDebugEnabled": false
    },
    "ledSettings": {
      "isEnabled": true,
      "blinkRate": 0
    },
    "speakerSettings": {
      "isEnabled": true,
      "areSystemSoundsEnabled": false,
      "volume": 80,
      "ringVolume": 80
    },
    "recordingSettings": {
      "prePaddingSecs": 2,
      "postPaddingSecs": 2,
      "smartDetectPrePaddingSecs": 2,
      "smartDetectPostPaddingSecs": 2,
      "minMotionEventTrigger": 1000,
      "endMotionEventDelay": 3000,
      "suppressIlluminationSurge": false,
      "_recordingEventOnly": "detections",
      "mode": "always",
      "_inScheduleMode": "always",
      "inScheduleMode": "always",
      "_outScheduleMode": "never",
      "outScheduleMode": "never",
      "geofencing": "off",
      "motionAlgorithm": "stable",
      "enableMotionDetection": true
    },
    "smartDetectSettings": {
      "objectTypes": [],
      "autoTrackingObjectTypes": [],
      "autoTrackingWithZoom": true,
      "audioTypes": [],
      "detectionRange": {
        "max": null,
        "min": null
      }
    },
    "recordingSchedulesV2": [],
    "motionZones": [],
    "privacyZones": [],
    "smartDetectZones": [],
    "smartDetectLines": [],
    "smartDetectLoiterZones": [],
    "stats": {
      "rxBytes": 0,
      "txBytes": 0,
      "wifi": {
        "channel": null,
        "frequency": null,
        "linkSpeedMbps": null,
        "signalQuality": 50,
        "signalStrength": 0
      },
      "video": {
        "recordingStart": null,
        "recordingEnd": null,
        "recordingStartLQ": null,
        "recordingEndLQ": null,
        "timelapseStart": null,
        "timelapseEnd": null,
        "timelapseStartLQ": null,
        "timelapseEndLQ": null
      },
      "lenses": []
    },
    "featureFlags": {
      "canAdjustIrLedLevel": false,
      "canMagicZoom": false,
      "canOpticalZoom": false,
      "canTouchFocus": false,
      "hasAccelerometer": false,
      "hasVerticalFlip": true,
      "hasAec": false,
      "hasBluetooth": false,
      "hasChime": false,
      "hasExternalIr": false,
      "hasIcrSensitivity": true,
      "hasInfrared": false,
      "hasLdc": false,
      "hasLedIr": false,
      "hasLedStatus": false,
      "hasLineIn": false,
      "hasMic": false,
      "hasPrivacyMask": true,
      "hasRtc": false,
      "hasSdCard": false,
      "hasSpeaker": false,
      "hasWifi": false,
      "hasHdr": false,
      "hasAutoICROnly": false,
      "videoModes": [],
      "videoModeMaxFps": [],
      "hasMotionZones": true,
      "hasLcdScreen": false,
      "hasFingerprintSensor": false,
      "mountPositions": [],
      "videoSourceCount": 1,
      "smartDetectTypes": [],
      "smartDetectAudioTypes": [],
      "supportDoorAccessConfig": false,
      "supportNfc": false,
      "supportLpDetectionWithoutVehicle": false,
      "lensType": null,
      "lensModel": null,
      "motionAlgorithms": [],
      "hasSquareEventThumbnail": false,
      "hasPackageCamera": false,
      "audio": [],
      "audioCodecs": [],
      "videoCodecs": [],
      "audioStyle": [],
      "isDoorbell": false,
      "isPtz": false,
      "hasColorLcdScreen": false,
      "hasLiveviewTracking": false,
      "hasLineCrossing": false,
      "hasLineCrossingCounting": false,
      "hasFlash": false,
      "flashRange": null,
      "hasLuxCheck": false,
      "presetTour": false,
      "hasEdgeRecording": false,
      "hasLprReflex": false,
      "privacyMaskCapability": {
        "maxMasks": null,
        "rectangleOnly": false
      },
      "focus": {
        "steps": {
          "max": null,
          "min": null,
          "step": null
        },
        "degrees": {
          "max": null,
          "min": null,
          "step": null
        }
      },
      "pan": {
        "steps": {
          "max": null,
          "min": null,
          "step": null
        },
        "degrees": {
          "max": null,
          "min": null,
          "step": null
        }
      },
      "tilt": {
        "steps": {
          "max": null,
          "min": null,
          "step": null
        },
        "degrees": {
          "max": null,
          "min": null,
          "step": null
        }
      },
      "zoom": {
        "ratio": 22,
        "steps": {
          "max": null,
          "min": null,
          "step": null
        },
        "degrees": {
          "max": null,
          "min": null,
          "step": null
        }
      },
      "hotplug": {
        "audio": null,
        "video": null,
        "standaloneAdoption": false,
        "extender": {
          "isAttached": null,
          "hasFlash": null,
          "flashRange": null,
          "hasIR": null,
          "hasRadar": null,
          "radarRangeMax": null,
          "radarRangeMin": null
        }
      }
    },
    "lcdMessage": {},
    "streamSharing": {
      "enabled": false,
      "token": null,
      "shareLink": null,
      "expires": null,
      "sharedByUserId": null,
      "sharedByUser": null,
      "maxStreams": null
    },
    "homekitSettings": {
      "talkbackSettingsActive": false,
      "streamInProgress": false,
      "microphoneMuted": false,
      "speakerMuted": false
    },
    "shortcuts": [],
    "thirdPartyCameraInfo": {
      "port": "1984",
      "username": "admin",
      "password": "admin",
      "rtspUrl": "rtsp://192.168.1.157:8554/livingroom?video",
      "rtspUrlLQ": "rtsp://192.168.1.157:8554/livingroom?video",
      "snapshotUrl": "http://192.168.1.157:1984/api/frame.jpeg?src=livingroom"
    },
    "fingerprintSettings": {
      "enable": false,
      "enablePrintLatency": false,
      "mode": "identify",
      "reportFingerTouch": false,
      "reportCaptureComplete": false
    },
    "nfcSettings": {
      "enableNfc": false,
      "supportThirdPartyCard": false
    },
    "id": "6773359103e08303e4000501"
  }

any ideas why it just says offline?

@BrunoTCouto
Copy link
Contributor

BrunoTCouto commented Jan 10, 2025

@artinbastani remove go2rtc authentication.
Protect doesn't speak the same "auth" that go2rtc uses (basic authentication)

The admin+admin that I used is just a dummy value to make Protect happy that it is sending something to the "camera"

Try this:

streams:
    livingroom: rtsp://192.168.1.2:8554/livingroom

rtsp:
    listen: ":8554"

logs:
    api: trace
    onvif: trace

Question: Your camera doesnt have user and password ?

@artinbastani
Copy link

@BrunoTCouto
I had previously tried it without a username/password. Same result.

This is a second LXC in proxmox running go2rtc, so this is simply connecting to my main go2rtc instance. I can view the streams fine in the go2rtc web interface.

@xrh0905
Copy link

xrh0905 commented Jan 11, 2025

Same issue. Add camera, restart protect, device offline.
Dug through the log and found this

2025-01-11T10:11:17.209Z - error: Failed to readopt Camera Garden [0242C0A80207 @ 192.168.2.7] with device password. connect ECONNREFUSED 192.168.2.7:22
2025-01-11T10:11:17.245Z - error: Failed to readopt Camera Garden [0242C0A80207 @ 192.168.2.7] with nvr password. connect ECONNREFUSED 192.168.2.7:22
2025-01-11T10:11:18.511Z - error: Sent pullStream request with props:
{
  "uri": "rtsp://admin:[email protected]:8554/camera_garden",
  "localStreamName": "0242C0A80207_0"
}
2025-01-11T10:11:18.512Z - error: But got response with no localStreamName:
{
  "cliCustomParameters": null,
  "data": null,
  "description": "Stream name 0242C0A80207_0 already taken",
  "requestId": 78,
  "requestTimestamp": 1736590278,
  "responseTimestamp": 1736590278,
  "status": "FAIL"
}
2025-01-11T10:11:18.512Z - error: Error pulling stream
{
  "uri": "rtsp://admin:[email protected]:8554/camera_garden",
  "localStreamName": "0242C0A80207_0"
}
Error: invalid response data from MS cli
    at localStreamName (/usr/share/unifi-protect/app/webpack:/unifi-protect/src/middleware/video/evostream/streams.js:776:15)
    at k (/usr/share/unifi-protect/app/webpack:/unifi-protect/src/middleware/video/evostream/streams.js:208:32)

I have no idea what are these. Changed MAC address and IP and device id and nothing worked.

@BrunoTCouto
Copy link
Contributor

BrunoTCouto commented Jan 11, 2025

@xrh0905 check your thirdPartyCameraInfo > port. The log says it's trying to use port 22. Port 22 is used by ssh

ECONNREFUSED 192.168.2.7:22

@michael-blue2
Copy link

@xrh0905 can you guide me on where did you find that logs? is it on protect logs? or unifi system? I am also having problems and when I check my protect logs theres nothing showing on try to connect on third party.

@corvy
Copy link

corvy commented Jan 11, 2025

I'll test this. I am using macOS's native one.

I am too, did you find a solution @blockiindahood? I even tried to zip with 7zip but still it does not work.

❯ 7z t unifi_protect_backup.v5.1.85.202501111620371.zip 

7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,16 CPUs LE)

Scanning the drive for archives:
1 file, 16143 bytes (16 KiB)

Testing archive: unifi_protect_backup.v5.1.85.202501111620371.zip
--
Path = unifi_protect_backup.v5.1.85.202501111620371.zip
Type = zip
Physical Size = 16143

Everything is Ok

Files: 17
Size:       111937
Compressed: 16143

I get an error every time I try to upload it. Also I tried to check for syntax errors in the cameras.json but no errors I can find. Importing the exported file works fine. This is my 7zip command:

 ~/Documents/cameras                                                                                          16:19:09 
❯ 7z a -tzip unifi_protect_backup.v5.1.85.202501111554553.zip unifi_protect_backup.v5.1.85.202501111554553

@blockiindahood
Copy link

@corvy no, sadly not, just gave up for the moment

@xrh0905
Copy link

xrh0905 commented Jan 11, 2025

@xrh0905 check your thirdPartyCameraInfo > port. The log says it's trying to use port 22. Port 22 is used by ssh

ECONNREFUSED 192.168.2.7:22

I'm quite sure that's not the issue. Looks like the protect simply try to SSH every camera that isn't actived.

@corvy
Copy link

corvy commented Jan 11, 2025

Hey @blockiindahood I found a solution. Installed Commander One:

 ~/                                                                                             16:34:53 
❯ brew install --cask commander-one    

After giving it some permissions etc I just edited directly inside Commander One. It does not extract the file, you just enter the zip archive, open the cameras.json and when you close the file it saves it into the zip file and it just magically works.

image

@xrh0905
Copy link

xrh0905 commented Jan 11, 2025

@xrh0905 can you guide me on where did you find that logs? is it on protect logs? or unifi system? I am also having problems and when I check my protect logs theres nothing showing on try to connect on third party.

Well I have a UDM Pro and the log is located in /srv/unifi-protect/logs.
Hope that information helped

@deyanimay
Copy link

deyanimay commented Jan 11, 2025

I'll test this. I am using macOS's native one.

I am too, did you find a solution @blockiindahood? I even tried to zip with 7zip but still it does not work.

❯ 7z t unifi_protect_backup.v5.1.85.202501111620371.zip 

7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,16 CPUs LE)

Scanning the drive for archives:
1 file, 16143 bytes (16 KiB)

Testing archive: unifi_protect_backup.v5.1.85.202501111620371.zip
--
Path = unifi_protect_backup.v5.1.85.202501111620371.zip
Type = zip
Physical Size = 16143

Everything is Ok

Files: 17
Size:       111937
Compressed: 16143

I get an error every time I try to upload it. Also I tried to check for syntax errors in the cameras.json but no errors I can find. Importing the exported file works fine. This is my 7zip command:

 ~/Documents/cameras                                                                                          16:19:09 
❯ 7z a -tzip unifi_protect_backup.v5.1.85.202501111554553.zip unifi_protect_backup.v5.1.85.202501111554553

I had a similar issue but on windows. I looked through some of the logs and the issue seemed to be with the stored fingerprints on my g4 pro doorbell settings not wanting to import back in properly. Any chance you have a unifi device that stores credentials of some sort as those get included in the json file? My solution was to delete that info from the protect ui then export the backup again. Since then its been working ok. I never used the fingerprint functionality for anything so that was fine for me, but you may actually need that in which case this isn't really a solution.

edit: I should also add that while I can import the cameras ok I too am not able to get the streams to work whereas I have been able to get it to work with this tool: https://github.com/p10tyr/rtsp-to-onvif/. I've been having connectivity issues with that one so I wanted to switch to go2rtc, but haven't had luck getting the video stream to work, only the snapshots seem to update.

@artinbastani
Copy link

I was able to finally get it to work

livingroom: ffmpeg:rtsp://192.168.1.75/live0#video=copy#audio=pcma/16000

was the line that got the right stream for Unifi

I forgot that the community proxmox script for go2rtc doesn't run it in docker so ffmpeg isn't built in and it wasn't able to transcode the stream

Oddly I can view the stream in the protect app, but it won't stream in the web interface

@BrunoTCouto
Copy link
Contributor

BrunoTCouto commented Jan 11, 2025

I was able to finally get it to work

livingroom: ffmpeg:rtsp://192.168.1.75/live0#video=copy#audio=pcma/16000

was the line that got the right stream for Unifi

I forgot that the community proxmox script for go2rtc doesn't run it in docker so ffmpeg isn't built in and it wasn't able to transcode the stream

Oddly I can view the stream in the protect app, but it won't stream in the web interface

Check in the web interface the quality of the stream is set to auto

@brian7704
Copy link

Can go2rtc access Ubiquiti camera feeds directly via RTSP without having Unifi Protect installed?

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 13, 2025

@corvy
Copy link

corvy commented Jan 13, 2025

Anyone got any idea why I only get the snapshot photo on this setup?

    "shortcuts": [],
    "thirdPartyCameraInfo": {
      "port": "1984",
      "username": "admin",
      "password": "admin",
      "rtspUrl": "rtsp://10.2.2.12:8554/doorbell",
      "rtspUrlLQ": null,
      "snapshotUrl": "http://10.2.2.12:1984/api/frame.jpeg?src=doorbell"

This is the go2rtc setup:

streams:
  doorbell:
    - echo:bash /config/custom_components/expose_camera_stream_source/get_stream.sh camera.doorbell
    - "ffmpeg:doorbell#audio=aac#media=video"

rtsp:
  listen: ":8554"
  
log:
  api: trace
  onvif: trace  

When I open VLC and open network with the following URL I get live video: rtsp://10.2.2.12:8554/doorbell

Heres status in Unifi Protect:
image

image

@AlexxIT
Copy link
Owner Author

AlexxIT commented Jan 13, 2025

Maybe problems with audio, as I said earlier #1538 (comment)
Need to do more research on which audio UP likes and which ones it doesn't.

@corvy
Copy link

corvy commented Jan 13, 2025

Here are some logs from go2rtc, just for info. I see that there are some strange requests going to .1 IP which is my default gateway. 10.0.99.7 is the client opening Unifi Protect.

Logs from go2rtc
12:59:44.229	trace	[api] GET /api/frame.jpeg?src=doorbell 10.2.2.1:46156
12:59:44.051	trace	[api] GET /api/log 10.0.99.7:63777
12:59:41.874	trace	[onvif] server response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl">
<s:Body>
<trt:GetStreamUriResponse><trt:MediaUri><tt:Uri>rtsp://10.2.2.12:8554/doorbell</tt:Uri></trt:MediaUri></trt:GetStreamUriResponse>
</s:Body>
</s:Envelope>
12:59:41.873	trace	[onvif] server request POST /onvif/media_service:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>admin</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">T6VjfS4zlihfeVq/N2jDOSadeDQ=</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">t25MBEjc6d+L/8MeZOqJ8A==</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2025-01-13T11:59:41.049Z</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetStreamUri xmlns="http://www.onvif.org/ver10/media/wsdl"><StreamSetup><Stream xmlns="http://www.onvif.org/ver10/schema">RTP-Unicast</Stream><Transport xmlns="http://www.onvif.org/ver10/schema"><Protocol>RTSP</Protocol></Transport></StreamSetup><ProfileToken>doorbell</ProfileToken></GetStreamUri></s:Body></s:Envelope>
12:59:41.873	trace	[api] POST /onvif/media_service 10.2.2.1:46114
12:59:41.859	trace	[onvif] server response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl">
<s:Body>
<trt:GetSnapshotUriResponse><trt:MediaUri><tt:Uri>http://10.2.2.12:1984/api/frame.jpeg?src=doorbell</tt:Uri></trt:MediaUri></trt:GetSnapshotUriResponse>
</s:Body>
</s:Envelope>
12:59:41.859	trace	[onvif] server request POST /onvif/media_service:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>admin</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">e+bNqzLN9a/ubUNArrMr2ZM6Zic=</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">szmNpO36fP/6k0inQW1/+A==</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2025-01-13T11:59:41.039Z</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSnapshotUri xmlns="http://www.onvif.org/ver10/media/wsdl"><ProfileToken>doorbell</ProfileToken></GetSnapshotUri></s:Body></s:Envelope>
12:59:41.859	trace	[api] POST /onvif/media_service 10.2.2.1:46112
12:59:41.843	trace	[onvif] server response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl">
<s:Body>
<tds:GetDeviceInformationResponse>
<tds:Manufacturer></tds:Manufacturer>
<tds:Model>go2rtc</tds:Model>
<tds:FirmwareVersion>1.9.8</tds:FirmwareVersion>
<tds:SerialNumber>10.2.2.12:1984</tds:SerialNumber>
<tds:HardwareId>1.00</tds:HardwareId>
</tds:GetDeviceInformationResponse>
</s:Body>
</s:Envelope>
12:59:41.842	trace	[onvif] server request POST /onvif/device_service:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>admin</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">Qd+Rza/SsIUThE06TbPRABFORQ8=</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">ess4xVu3y/XChGxQEQnCLQ==</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2025-01-13T11:59:41.022Z</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>
12:59:41.842	trace	[api] POST /onvif/device_service 10.2.2.1:46110
12:59:41.830	trace	[onvif] server response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl">
<s:Body>
<trt:GetVideoSourcesResponse>
<trt:VideoSources token="doorbell">
<tt:Framerate>30.000000</tt:Framerate>
<tt:Resolution><tt:Width>1920</tt:Width><tt:Height>1080</tt:Height></tt:Resolution>
</trt:VideoSources>
</trt:GetVideoSourcesResponse>
</s:Body>
</s:Envelope>
12:59:41.830	trace	[onvif] server request POST /onvif/media_service:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>admin</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">CI8ZbzR0GxySayA3lV6Qy3qIWwo=</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">WmziKYdpx+lJKDTkIZ+fnQ==</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2025-01-13T11:59:41.011Z</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetVideoSources xmlns="http://www.onvif.org/ver10/media/wsdl"/></s:Body></s:Envelope>
12:59:41.830	trace	[api] POST /onvif/media_service 10.2.2.1:46108
12:59:41.830	trace	[onvif] server response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl">
<s:Body>
<trt:GetProfilesResponse>
<trt:Profiles token="doorbell" fixed="true">
<tt:Name>doorbell</tt:Name>
<tt:VideoSourceConfiguration token="doorbell">
<tt:Name>VSC</tt:Name>
<tt:SourceToken>doorbell</tt:SourceToken>
<tt:Bounds x="0" y="0" width="1920" height="1080"></tt:Bounds>
</tt:VideoSourceConfiguration>
<tt:VideoEncoderConfiguration token="vec">
<tt:Name>VEC</tt:Name>
<tt:Encoding>H264</tt:Encoding>
<tt:Resolution><tt:Width>1920</tt:Width><tt:Height>1080</tt:Height></tt:Resolution>
<tt:RateControl />
</tt:VideoEncoderConfiguration>
</trt:Profiles>
</trt:GetProfilesResponse>
</s:Body>
</s:Envelope>
12:59:41.830	trace	[onvif] server request POST /onvif/media_service:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>admin</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">y5X7CqsH8xQWa81GMa/C76VMsN4=</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">S9I8VSN02MMi40EGjsNrAw==</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2025-01-13T11:59:41.007Z</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetProfiles xmlns="http://www.onvif.org/ver10/media/wsdl"/></s:Body></s:Envelope>
12:59:41.829	trace	[api] POST /onvif/media_service 10.2.2.1:46106
12:59:41.818	trace	[onvif] server response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl">
<s:Body>
<tds:GetServicesResponse>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver10/device/wsdl</tds:Namespace>
<tds:XAddr>http://10.2.2.12:1984/onvif/device_service</tds:XAddr>
<tds:Version><tt:Major>2</tt:Major><tt:Minor>5</tt:Minor></tds:Version>
</tds:Service>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver10/media/wsdl</tds:Namespace>
<tds:XAddr>http://10.2.2.12:1984/onvif/media_service</tds:XAddr>
<tds:Version><tt:Major>2</tt:Major><tt:Minor>5</tt:Minor></tds:Version>
</tds:Service>
</tds:GetServicesResponse>
</s:Body>
</s:Envelope>
12:59:41.818	trace	[onvif] server request POST /onvif/device_service:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>admin</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">5J1ajm2iLWCf8kw27kqgr/c5a/o=</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">60freOXIlipML8v3trjnhw==</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2025-01-13T11:59:41.000Z</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetServices xmlns="http://www.onvif.org/ver10/device/wsdl"><IncludeCapability>true</IncludeCapability></GetServices></s:Body></s:Envelope>
12:59:41.818	trace	[api] POST /onvif/device_service 10.2.2.1:46104
12:59:41.810	trace	[onvif] server response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl">
<s:Body>
<tds:GetSystemDateAndTimeResponse>
<tds:SystemDateAndTime>
<tt:DateTimeType>NTP</tt:DateTimeType>
<tt:DaylightSavings>true</tt:DaylightSavings>
<tt:TimeZone>
<tt:TZ>GMT-01:00</tt:TZ>
</tt:TimeZone>
<tt:UTCDateTime>
<tt:Time><tt:Hour>11</tt:Hour><tt:Minute>59</tt:Minute><tt:Second>41</tt:Second></tt:Time>
<tt:Date><tt:Year>2025</tt:Year><tt:Month>1</tt:Month><tt:Day>13</tt:Day></tt:Date>
</tt:UTCDateTime>
<tt:LocalDateTime>
<tt:Time><tt:Hour>12</tt:Hour><tt:Minute>59</tt:Minute><tt:Second>41</tt:Second></tt:Time>
<tt:Date><tt:Year>2025</tt:Year><tt:Month>1</tt:Month><tt:Day>13</tt:Day></tt:Date>
</tt:LocalDateTime>
</tds:SystemDateAndTime>
</tds:GetSystemDateAndTimeResponse>
</s:Body>
</s:Envelope>
12:59:41.810	trace	[onvif] server request POST /onvif/device_service:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>
12:59:41.810	trace	[api] POST /onvif/device_service 10.2.2.1:46102

@corvy
Copy link

corvy commented Jan 13, 2025

Changed my go2rtc config, but the same problem remains.

streams:
  doorbell:
    - echo:bash /config/custom_components/expose_camera_stream_source/get_stream.sh camera.doorbell

rtsp:
  listen: ":8554"
  
log:
  api: trace
  onvif: trace  

Also tried with ffmpeg:doorbell (removing #audio=aac#media=video) but that made no difference.

@xrh0905
Copy link

xrh0905 commented Jan 13, 2025

Hey guys, I believe that I found the backend log which unifi used to retrieve and transcode. It's a program called ms which contains ms msp msr mst where ms is the main program and the log is located in /srv/ms/logs in Unifi Dream Machine.

/srv/ms/logs/ms.00.log

2025-01-13T12:51:28.632Z I W 1  -     TCPConnector::Connect h_id=115055 fd=63 connect_timeout=5000 [11]
2025-01-13T12:51:28.632Z I W 1  - <-# OriginApplication::operator()::post =========== pullStream AA42C0A802FF_0 [W 1] OK ================== [10]
2025-01-13T12:51:28.632Z I W 1  - #-> TCPConnector::CloseTimer h_id=115055 fd=63 [9]
2025-01-13T12:51:28.632Z I W 1  - <-# TCPConnector::CloseTimer h_id=115055 fd=63 [9]
2025-01-13T12:51:28.632Z I W 1  - #-> ProtocolFactoryManager::CreateProtocolChain [8]
2025-01-13T12:51:28.632Z I W 1  -     RTSPProtocol::RTSPProtocol p_id=415602 name= [7]
2025-01-13T12:51:28.632Z I W 1  - <-# ProtocolFactoryManager::CreateProtocolChain [6]
2025-01-13T12:51:28.632Z I W 1  - #-> BaseRTSPAppProtocolHandler::SignalProtocolCreated p_id=415602 parameters=<MAP name="" isArray="false">\n    <UINT32 name="appId">2</UINT32>\n    <STR name="audioCodecBytes"></STR>\n    <UINT64 name="configId">717160455</UINT64>\n    <UINT64 name="connect_timeout">5000</UINT64>\n    <STR name="connectionType">pull</STR>\n    <MAP name="customParameters" isArray="false">\n        <MAP name="externalStreamConfig" isArray="false">\n            <STR name="audioCodecBytes"></STR>\n            <UINT64 name="configId">717160455</UINT64>\n            <UINT64 name="connect_timeout">5000</UINT64>\n            <STR name="emulateUserAgent">Media Server (www.ui.com) player</STR>\n            <BOOL name="forceTcp">true</BOOL>\n            <STR name="httpProxy"></STR>\n            <BOOL name="isAudio">true</BOOL>\n            <BOOL name="keepAlive">true</BOOL>\n            <STR name="localStreamName">AA42C0A802FF_0</STR>\n            <UINT8 name="operationType">1</UINT8>\n            <STR name="pageUrl"></STR>\n            <STR name="ppsBytes"></STR>\n            <INT64 name="rangeEnd">-1</INT64>\n            <INT64 name="rangeStart">-2</INT64>\n            <UINT64 name="rtcpDetectionInterval">0</UINT64>\n            <BOOL name="sendOnClockSync">false</BOOL>\n            <BOOL name="sendRenewStream">false</BOOL>\n            <STR name="spsBytes"></STR>\n            <STR name="ssmIp"></STR>\n            <STR name="swfUrl"></STR>\n            <STR name="tcUrl"></STR>\n            <UINT64 name="tos">256</UINT64>\n            <UINT64 name="ttl">256</UINT64>\n            <MAP name="uri" isArray="false">\n                <STR name="document">camera_garden</STR>\n                <STR name="documentPath">/</STR>\n                <STR name="documentWithFullParameters">camera_garden?video=h264&audio=aac</STR>\n                <STR name="fullDocumentPath">/camera_garden</STR>\n                <STR name="fullDocumentPathWithParameters">/camera_garden?video=h264&audio=aac</STR>\n                <STR name="fullParameters">video=h264&audio=aac</STR>\n                <STR name="fullUri">rtsp://192.168.2.7:8554/camera_garden?video=h264&audio=aac</STR>\n                <STR name="fullUriWithAuth">rtsp://admin:[email protected]:8554/camera_garden?video=h264&audio=aac</STR>\n                <STR name="host">192.168.2.7</STR>\n                <STR name="hostAndPort">192.168.2.7:8554</STR>\n                <STR name="ip">192.168.2.7</STR>\n                <STR name="ipAndPort">192.168.2.7:8554</STR>\n                <BOOL name="isFileScheme">false</BOOL>\n                <STR name="originalUri">rtsp://admin:[email protected]:8554/camera_garden?video=h264&audio=aac</STR>\n                <MAP name="parameters" isArray="false">\n                    <STR name="audio">aac</STR>\n                    <STR name="video">h264</STR>\n                </MAP>\n                <STR name="password">admin</STR>\n                <UINT16 name="port">8554</UINT16>\n                <BOOL name="portSpecified">true</BOOL>\n                <STR name="scheme">rtsp</STR>\n                <STR name="userName">admin</STR>\n            </MAP>\n        </MAP>\n        <NULL name="httpProxy"></NULL>\n    </MAP>\n    <STR name="emulateUserAgent">Media Server (www.ui.com) player</STR>\n    <BOOL name="forceTcp">true</BOOL>\n    <STR name="httpProxy"></STR>\n    <BOOL name="isAudio">true</BOOL>\n    <BOOL name="isClient">true</BOOL>\n    <BOOL name="keepAlive">true</BOOL>\n    <STR name="localStreamName">AA42C0A802FF_0</STR>\n    <UINT8 name="operationType">1</UINT8>\n    <STR name="pageUrl"></STR>\n    <STR name="ppsBytes"></STR>\n    <INT64 name="rangeEnd">-1</INT64>\n    <INT64 name="rangeStart">-2</INT64>\n    <UINT64 name="rtcpDetectionInterval">0</UINT64>\n    <BOOL name="sendOnClockSync">false</BOOL>\n    <BOOL name="sendRenewStream">false</BOOL>\n    <STR name="spsBytes"></STR>\n    <STR name="ssmIp"></STR>\n    <STR name="swfUrl"></STR>\n    <STR name="tcUrl"></STR>\n    <UINT64 name="tos">256</UINT64>\n    <UINT64 name="ttl">256</UINT64>\n    <MAP name="uri" isArray="false">\n        <STR name="document">camera_garden</STR>\n        <STR name="documentPath">/</STR>\n        <STR name="documentWithFullParameters">camera_garden?video=h264&audio=aac</STR>\n        <STR name="fullDocumentPath">/camera_garden</STR>\n        <STR name="fullDocumentPathWithParameters">/camera_garden?video=h264&audio=aac</STR>\n        <STR name="fullParameters">video=h264&audio=aac</STR>\n        <STR name="fullUri">rtsp://192.168.2.7:8554/camera_garden?video=h264&audio=aac</STR>\n        <STR name="fullUriWithAuth">rtsp://admin:[email protected]:8554/camera_garden?video=h264&audio=aac</STR>\n        <STR name="host">192.168.2.7</STR>\n        <STR name="hostAndPort">192.168.2.7:8554</STR>\n        <STR name="ip">192.168.2.7</STR>\n        <STR name="ipAndPort">192.168.2.7:8554</STR>\n        <BOOL name="isFileScheme">false</BOOL>\n        <STR name="originalUri">rtsp://admin:[email protected]:8554/camera_garden?video=h264&audio=aac</STR>\n        <MAP name="parameters" isArray="false">\n            <STR name="audio">aac</STR>\n            <STR name="video">h264</STR>\n        </MAP>\n        <STR name="password">admin</STR>\n        <UINT16 name="port">8554</UINT16>\n        <BOOL name="portSpecified">true</BOOL>\n        <STR name="scheme">rtsp</STR>\n        <STR name="userName">admin</STR>\n    </MAP>\n</MAP> [5]
2025-01-13T12:51:28.632Z I W 1  - #-> OriginApplication::RegisterProtocol [4]
2025-01-13T12:51:28.632Z I W 1  - #-> BaseClientApplication::RegisterProtocol id=415602 type=RTSP [3]
2025-01-13T12:51:28.632Z I W 1  - #-> BaseRTSPAppProtocolHandler::RegisterProtocol [2]
2025-01-13T12:51:28.633Z I W 1  - #-> BaseRTSPAppProtocolHandler::TriggerPlayOrAnnounce [1]
2025-01-13T12:51:28.633Z I W 1  -     RTSPProtocol::SendMessage p_id=415602 AA42C0A802FF_0 OUTPUT  OPTIONS rtsp://192.168.2.7:8554/camera_garden?video=h264&audio=aac RTSP/1.0\r\nCSeq: 1\r\nDate: Mon, 13 Jan 2025 12:51:28 UTC\r\nUser-Agent: Media Server (www.ui.com)\r\nX-Powered-By: Media Server (www.ui.com)\r\n\r\n [1]
2025-01-13T12:51:28.632Z I ms  - #-> OriginApplication::PullExternalStream streamConfig: <MAP name="" isArray="false">\n    <STR name="audioCodecBytes"></STR>\n    <UINT64 name="configId">3249602562</UINT64>\n    <UINT64 name="connect_timeout">5000</UINT64>\n    <STR name="emulateUserAgent">Media Server (www.ui.com) player</STR>\n    <BOOL name="forceTcp">true</BOOL>\n    <STR name="httpProxy"></STR>\n    <BOOL name="isAudio">true</BOOL>\n    <BOOL name="keepAlive">true</BOOL>\n    <STR name="localStreamName">0242C0A80207_0</STR>\n    <UINT8 name="operationType">1</UINT8>\n    <STR name="pageUrl"></STR>\n    <STR name="ppsBytes"></STR>\n    <INT64 name="rangeEnd">-1</INT64>\n    <INT64 name="rangeStart">-2</INT64>\n    <UINT64 name="rtcpDetectionInterval">0</UINT64>\n    <BOOL name="sendOnClockSync">false</BOOL>\n    <BOOL name="sendRenewStream">false</BOOL>\n    <STR name="spsBytes"></STR>\n    <STR name="ssmIp"></STR>\n    <STR name="swfUrl"></STR>\n    <STR name="tcUrl"></STR>\n    <UINT64 name="tos">256</UINT64>\n    <UINT64 name="ttl">256</UINT64>\n    <STR name="uri">rtsp://admin:[email protected]:8554/camera_garden?video=h264&audio=aac</STR>\n</MAP> [8]
2025-01-13T12:51:28.633Z I W 1  - <-# BaseClientApplication::RegisterProtocol id=415602 type=RTSP [7]
2025-01-13T12:51:28.633Z I ms  - #-> OriginApplication::IsActive [6]
2025-01-13T12:51:28.633Z I ms  - <-# OriginApplication::IsActive Active configId=3249602562 [5]
2025-01-13T12:51:28.633Z I ms  - #-> OriginApplication::SaveConfig [4]
2025-01-13T12:51:28.633Z I ms  - #-> OriginApplication::SerializePullPushConfig [3]
2025-01-13T12:51:28.633Z I W 1  - #-> OriginApplication::SetStreamStatus status: [Connected] uniqueStreamId: 0 config: <MAP name="" isArray="false">\n    <STR name="audioCodecBytes"></STR>\n    <UINT64 name="configId">717160455</UINT64>\n    <UINT64 name="connect_timeout">5000</UINT64>\n    <STR name="emulateUserAgent">Media Server (www.ui.com) player</STR>\n    <BOOL name="forceTcp">true</BOOL>\n    <STR name="httpProxy"></STR>\n    <BOOL name="isAudio">true</BOOL>\n    <BOOL name="keepAlive">true</BOOL>\n    <STR name="localStreamName">AA42C0A802FF_0</STR>\n    <UINT8 name="operationType">1</UINT8>\n    <STR name="pageUrl"></STR>\n    <STR name="ppsBytes"></STR>\n    <INT64 name="rangeEnd">-1</INT64>\n    <INT64 name="rangeStart">-2</INT64>\n    <UINT64 name="rtcpDetectionInterval">0</UINT64>\n    <BOOL name="sendOnClockSync">false</BOOL>\n    <BOOL name="sendRenewStream">false</BOOL>\n    <STR name="spsBytes"></STR>\n    <STR name="ssmIp"></STR>\n    <STR name="swfUrl"></STR>\n    <STR name="tcUrl"></STR>\n    <UINT64 name="tos">256</UINT64>\n    <UINT64 name="ttl">256</UINT64>\n    <STR name="uri">rtsp://admin:[email protected]:8554/camera_garden?video=h264&audio=aac</STR>\n</MAP> [2]
2025-01-13T12:51:28.633Z I ms  - #-> OriginApplication::ApplyChecksum [1]
2025-01-13T12:51:28.634Z I W 1  - <-# OriginApplication::SetStreamStatus [1]
2025-01-13T12:51:28.634Z I W 1  - <-# OriginApplication::RegisterProtocol [1]
2025-01-13T12:51:28.634Z I W 1  - #-> BaseClientApplication::GetProtocolHandler [1]
2025-01-13T12:51:28.634Z I ms  - #-> OriginApplication::SetStreamStatus status: [Connecting] uniqueStreamId: 0 config: <MAP name="" isArray="false">\n    <STR name="audioCodecBytes"></STR>\n    <UINT64 name="configId">3249602562</UINT64>\n    <UINT64 name="connect_timeout">5000</UINT64>\n    <STR name="emulateUserAgent">Media Server (www.ui.com) player</STR>\n    <BOOL name="forceTcp">true</BOOL>\n    <STR name="httpProxy"></STR>\n    <BOOL name="isAudio">true</BOOL>\n    <BOOL name="keepAlive">true</BOOL>\n    <STR name="localStreamName">0242C0A80207_0</STR>\n    <UINT8 name="operationType">1</UINT8>\n    <STR name="pageUrl"></STR>\n    <STR name="ppsBytes"></STR>\n    <INT64 name="rangeEnd">-1</INT64>\n    <INT64 name="rangeStart">-2</INT64>\n    <UINT64 name="rtcpDetectionInterval">0</UINT64>\n    <BOOL name="sendOnClockSync">false</BOOL>\n    <BOOL name="sendRenewStream">false</BOOL>\n    <STR name="spsBytes"></STR>\n    <STR name="ssmIp"></STR>\n    <STR name="swfUrl"></STR>\n    <STR name="tcUrl"></STR>\n    <UINT64 name="tos">256</UINT64>\n    <UINT64 name="ttl">256</UINT64>\n    <STR name="uri">rtsp://admin:[email protected]:8554/camera_garden?video=h264&audio=aac</STR>\n</MAP> [1]
2025-01-13T12:51:28.634Z I ms  - <-# OriginApplication::SetStreamStatus [1]

Above are a sample of my machine. I'm wondering where did it get the <STR name="uri">rtsp://admin:[email protected]:8554/camera_garden?video=h264&audio=aac</STR> as the url in my config is "rtspUrl": "rtsp://192.168.2.7:8554/camera_garden?video=h264&audio=pcmu",

@BrunoTCouto
Copy link
Contributor

Anyone got any idea why I only get the snapshot photo on this setup?


    "shortcuts": [],

    "thirdPartyCameraInfo": {

      "port": "1984",

      "username": "admin",

      "password": "admin",

      "rtspUrl": "rtsp://10.2.2.12:8554/doorbell",

      "rtspUrlLQ": null,

      "snapshotUrl": "http://10.2.2.12:1984/api/frame.jpeg?src=doorbell"

This is the go2rtc setup:


streams:

  doorbell:

    - echo:bash /config/custom_components/expose_camera_stream_source/get_stream.sh camera.doorbell

    - "ffmpeg:doorbell#audio=aac#media=video"



rtsp:

  listen: ":8554"

  

log:

  api: trace

  onvif: trace  

When I open VLC and open network with the following URL I get live video: rtsp://10.2.2.12:8554/doorbell

Heres status in Unifi Protect:

image

image

Hey @corvy, I had a similar issue on my protect, changing the quality on viewer to auto solved it.

@corvy
Copy link

corvy commented Jan 13, 2025

Hey @corvy, I had a similar issue on my protect, changing the quality on viewer to auto solved it.

Thank you @xrh0905 ! Where did you find this setting?

@BrunoTCouto
Copy link
Contributor

BrunoTCouto commented Jan 13, 2025

@corvy open the stream, even if it is stuck and change it here.

image
image

@corvy
Copy link

corvy commented Jan 14, 2025

Thanks @BrunoTCouto, sadly this made no difference for me.

image

@corvy
Copy link

corvy commented Jan 14, 2025

Just for completeness, this is the media info I get from VLC:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
camera Discussion on a particular camera model
Projects
None yet
Development

No branches or pull requests

10 participants