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

Stream not starting #58

Closed
tillkruss opened this issue Jul 23, 2020 · 6 comments
Closed

Stream not starting #58

tillkruss opened this issue Jul 23, 2020 · 6 comments

Comments

@tillkruss
Copy link

tillkruss commented Jul 23, 2020

Describe the bug
The 3 cameras are successfully detected and even snapshots work, but when I open the stream for any of the cameras in the Home app it just loads forever.

Specifications
Homebridge runs on RP4B
NVR is CK Gen2 Plus
Client is iOS 14 Beta

Logging
See next comment

To Reproduce
Steps to reproduce the behavior:

  1. Go to Home app
  2. Click on any UniFi Protect camer
  3. See loading screen forever

Expected behavior
See the video stream

Config

{
            "name": "UniFi Protect",
            "unifi": {
                "enhanced_classes": [
                    "person",
                    "dog",
                    "bear"
                ],
                "controller": "https://10.0.1.3:7443",
                "controller_rtsp": "rtsp://10.0.1.3:7447",
                "username": "...",
                "password": "...",
                "motion_interval": 5000,
                "motion_repeat_interval": 30000,
                "motion_score": 50,
                "enhanced_motion": true,
                "enhanced_motion_score": 50,
                "save_snapshot": true,
                "debug": false
            },
            "videoConfig": {
                "maxStreams": 3,
                "maxWidth": 1920,
                "maxHeight": 1024,
                "maxFPS": 25,
                "maxBitrate": 6000,
                "vcodec": "h264_omx",
                "packetSize": 376,
                "audio": false,
                "additionalCommandline": "-protocol_whitelist https,crypto,srtp,rtp,udp"
            },
            "platform": "UnifiProtectMotion"
        }
@tillkruss
Copy link
Author

patch: { 'Content-Type': 'application/x-www-form-urlencoded' },
'Content-Type': 'application/json',
Authorization:
 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMThkYzE2MDI2ZGRhMDNlNzAwNGU5NyIsImlhdCI6MTU5NTQ2NjQzNn0.GQ2UF-Z38FKBx7BlU-eFs9-Rzr7hVsq8aK7S5B0nzH4' },
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 1000,
withCredentials: true,
adapter: [Function: httpAdapter],
responseType: 'json',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
httpsAgent:
Agent {
_events: [Object: null prototype] { free: [Function] },
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: { rejectUnauthorized: false, path: null },
requests: {},
sockets: {},
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: { map: [Object], list: [Array] } } }
[7/22/2020, 6:07:29 PM] [UniFi Protect] { status: 200,
statusText: 'OK',
headers:
{ 'x-powered-by': 'Express',
vary: 'Origin',
'access-control-allow-credentials': 'true',
'content-type': 'application/json; charset=utf-8',
'content-length': '2',
etag: 'W/"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w"',
date: 'Thu, 23 Jul 2020 01:07:29 GMT',
connection: 'close' },
config:
{ url:
 'https://10.0.1.3:7443/api/events?end=1595466449478&start=1595466439478&type=motion',
method: 'get',
headers:
 { Accept: 'application/json, text/plain, */*',
   'Content-Type': 'application/json',
   Authorization:
    'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMThkYzE2MDI2ZGRhMDNlNzAwNGU5NyIsImlhdCI6MTU5NTQ2NjQzNn0.GQ2UF-Z38FKBx7BlU-eFs9-Rzr7hVsq8aK7S5B0nzH4',
   'User-Agent': 'axios/0.19.2' },
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 1000,
withCredentials: true,
adapter: [Function: httpAdapter],
responseType: 'json',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
httpsAgent:
 Agent {
   _events: [Object],
   _eventsCount: 1,
   _maxListeners: undefined,
   defaultPort: 443,
   protocol: 'https:',
   options: [Object],
   requests: {},
   sockets: [Object],
   freeSockets: {},
   keepAliveMsecs: 1000,
   keepAlive: false,
   maxSockets: Infinity,
   maxFreeSockets: 256,
   maxCachedSessions: 100,
   _sessionCache: [Object] },
data: undefined },
request:
ClientRequest {
_events:
 [Object: null prototype] {
   socket: [Array],
   abort: [Function],
   aborted: [Function],
   error: [Function],
   timeout: [Array],
   prefinish: [Function: requestOnPrefinish] },
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket:
 TLSSocket {
   _tlsOptions: [Object],
   _secureEstablished: true,
   _securePending: false,
   _newSessionPending: false,
   _controlReleased: true,
   _SNICallback: null,
   servername: '10.0.1.3',
   alpnProtocol: false,
   authorized: false,
   authorizationError: 'DEPTH_ZERO_SELF_SIGNED_CERT',
   encrypted: true,
   _events: [Object],
   _eventsCount: 9,
   connecting: false,
   _hadError: false,
   _handle: [TLSWrap],
   _parent: null,
   _host: null,
   _readableState: [ReadableState],
   readable: true,
   _maxListeners: undefined,
   _writableState: [WritableState],
   writable: false,
   allowHalfOpen: false,
   _sockname: null,
   _pendingData: null,
   _pendingEncoding: '',
   server: undefined,
   _server: null,
   ssl: [TLSWrap],
   _requestCert: true,
   _rejectUnauthorized: false,
   parser: null,
   _httpMessage: [Circular],
   timeout: 1000,
   [Symbol(res)]: [TLSWrap],
   [Symbol(asyncId)]: 11416,
   [Symbol(lastWriteQueueSize)]: 0,
   [Symbol(timeout)]:
    Timeout {
      _called: false,
      _idleTimeout: 1000,
      _idlePrev: [TimersList],
      _idleNext: [TimersList],
      _idleStart: 19305,
      _onTimeout: [Function: bound ],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: false,
      [Symbol(unrefed)]: true,
      [Symbol(asyncId)]: 11424,
      [Symbol(triggerId)]: 11420 },
   [Symbol(kBytesRead)]: 0,
   [Symbol(kBytesWritten)]: 0,
   [Symbol(connect-options)]: [Object] },
connection:
 TLSSocket {
   _tlsOptions: [Object],
   _secureEstablished: true,
   _securePending: false,
   _newSessionPending: false,
   _controlReleased: true,
   _SNICallback: null,
   servername: '10.0.1.3',
   alpnProtocol: false,
   authorized: false,
   authorizationError: 'DEPTH_ZERO_SELF_SIGNED_CERT',
   encrypted: true,
   _events: [Object],
   _eventsCount: 9,
   connecting: false,
   _hadError: false,
   _handle: [TLSWrap],
   _parent: null,
   _host: null,
   _readableState: [ReadableState],
   readable: true,
   _maxListeners: undefined,
   _writableState: [WritableState],
   writable: false,
   allowHalfOpen: false,
   _sockname: null,
   _pendingData: null,
   _pendingEncoding: '',
   server: undefined,
   _server: null,
   ssl: [TLSWrap],
   _requestCert: true,
   _rejectUnauthorized: false,
   parser: null,
   _httpMessage: [Circular],
   timeout: 1000,
   [Symbol(res)]: [TLSWrap],
   [Symbol(asyncId)]: 11416,
   [Symbol(lastWriteQueueSize)]: 0,
   [Symbol(timeout)]:
    Timeout {
      _called: false,
      _idleTimeout: 1000,
      _idlePrev: [TimersList],
      _idleNext: [TimersList],
      _idleStart: 19305,
      _onTimeout: [Function: bound ],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: false,
      [Symbol(unrefed)]: true,
      [Symbol(asyncId)]: 11424,
      [Symbol(triggerId)]: 11420 },
   [Symbol(kBytesRead)]: 0,
   [Symbol(kBytesWritten)]: 0,
   [Symbol(connect-options)]: [Object] },
_header:
 'GET /api/events?end=1595466449478&start=1595466439478&type=motion HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nContent-Type: application/json\r\nAuthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMThkYzE2MDI2ZGRhMDNlNzAwNGU5NyIsImlhdCI6MTU5NTQ2NjQzNn0.GQ2UF-Z38FKBx7BlU-eFs9-Rzr7hVsq8aK7S5B0nzH4\r\nUser-Agent: axios/0.19.2\r\nHost: 10.0.1.3:7443\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent:
 Agent {
   _events: [Object],
   _eventsCount: 1,
   _maxListeners: undefined,
   defaultPort: 443,
   protocol: 'https:',
   options: [Object],
   requests: {},
   sockets: [Object],
   freeSockets: {},
   keepAliveMsecs: 1000,
   keepAlive: false,
   maxSockets: Infinity,
   maxFreeSockets: 256,
   maxCachedSessions: 100,
   _sessionCache: [Object] },
socketPath: undefined,
timeout: undefined,
method: 'GET',
insecureHTTPParser: undefined,
path:
 '/api/events?end=1595466449478&start=1595466439478&type=motion',
_ended: true,
res:
 IncomingMessage {
   _readableState: [ReadableState],
   readable: false,
   _events: [Object],
   _eventsCount: 3,
   _maxListeners: undefined,
   socket: [TLSSocket],
   connection: [TLSSocket],
   httpVersionMajor: 1,
   httpVersionMinor: 1,
   httpVersion: '1.1',
   complete: true,
   headers: [Object],
   rawHeaders: [Array],
   trailers: {},
   rawTrailers: [],
   aborted: false,
   upgrade: false,
   url: '',
   method: null,
   statusCode: 200,
   statusMessage: 'OK',
   client: [TLSSocket],
   _consuming: true,
   _dumped: false,
   req: [Circular],
   responseUrl:
    'https://10.0.1.3:7443/api/events?end=1595466449478&start=1595466439478&type=motion',
   redirects: [] },
aborted: undefined,
timeoutCb: [Function: emitRequestTimeout],
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable:
 Writable {
   _writableState: [WritableState],
   writable: true,
   _events: [Object],
   _eventsCount: 2,
   _maxListeners: undefined,
   _options: [Object],
   _redirectCount: 0,
   _redirects: [],
   _requestBodyLength: 0,
   _requestBodyBuffers: [],
   _onNativeResponse: [Function],
   _currentRequest: [Circular],
   _currentUrl:
    'https://10.0.1.3:7443/api/events?end=1595466449478&start=1595466439478&type=motion' },
[Symbol(isCorked)]: false,
[Symbol(outHeadersKey)]:
 [Object: null prototype] {
   accept: [Array],
   'content-type': [Array],
   authorization: [Array],
   'user-agent': [Array],
   host: [Array] } },
data: [] }
Last message repeated 120 times
[rtsp @ 0x2a68f60] max_analyze_duration 5000000 reached at 5013333 microseconds st:0
[rtsp @ 0x2a68f60] decoding for stream 1 failed

Input #0, rtsp, from 'rtsp://10.0.1.3:7447/pNEEojM7mieLG9d9':
Metadata:
title           : 7483C23FB7D9_0

Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0, 237, 1/48000: Audio: aac (LC), 48000 Hz, mono, fltp
Stream #0:1, 122, 1/90000: Video: h264 (Main), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 0/1, 25 fps, 25 tbr, 90k tbn, 50 tbc
Successfully opened the file.
Parsing a group of options: output url srtp://10.0.1.8:54265?rtcpport=54265&localrtcpport=54265&pkt_size=376.
Applying option map (set input stream mapping) with argument 0:0.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument h264_omx.
Applying option pix_fmt (set pixel format) with argument yuv420p.
Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 25.
Applying option f (force format) with argument rawvideo.
Applying option vf (set video filters) with argument scale=1280:720.
Applying option b:v (video bitrate (please use -b:v)) with argument 299k.
Applying option f (force format) with argument rtp.
Successfully parsed a group of options.
Opening an output file: srtp://10.0.1.8:54265?rtcpport=54265&localrtcpport=54265&pkt_size=376.

Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (srtp://10.0.1.8:54265?rtcpport=54265&localrtcpport=54265&pkt_size=376) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Successfully opened the file.

Stream mapping:
Stream #0:0 -> #0:0 (aac (native) -> pcm_mulaw (native))
Press [q] to stop, [?] for help

cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)

detected 4 logical cores

[graph_0_in_0_0 @ 0x2b72c40] Setting 'time_base' to value '1/48000'
[graph_0_in_0_0 @ 0x2b72c40] Setting 'sample_rate' to value '48000'

[graph_0_in_0_0 @ 0x2b72c40] Setting 'sample_fmt' to value 'fltp'
[graph_0_in_0_0 @ 0x2b72c40] Setting 'channel_layout' to value '0x4'
[graph_0_in_0_0 @ 0x2b72c40] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x4
[format_out_0_0 @ 0x2a68e70] Setting 'sample_fmts' to value 's16'

[format_out_0_0 @ 0x2a68e70] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'

[AVFilterGraph @ 0x2be7590] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x2a75e80] [SWR @ 0x2beaef0] Using fltp internally between filters
[auto_resampler_0 @ 0x2a75e80] ch:1 chl:mono fmt:fltp r:48000Hz -> ch:1 chl:mono fmt:s16 r:48000Hz

Output #0, rtp, to 'srtp://10.0.1.8:54265?rtcpport=54265&localrtcpport=54265&pkt_size=376':
Metadata:
title           : 7483C23FB7D9_0
encoder         : Lavf58.29.100

Stream #0:0, 0, 1/48000: Audio: pcm_mulaw, 48000 Hz, mono, s16, 384 kb/s
Metadata:
 encoder         : Lavc58.54.100 pcm_mulaw

size=      25kB time=00:00:00.51 bitrate= 397.9kbits/s speed=1.01x    
size=      50kB time=00:00:01.02 bitrate= 397.7kbits/s speed=1.01x    
size=      75kB time=00:00:01.53 bitrate= 397.6kbits/s speed=1.01x    
size=      98kB time=00:00:02.02 bitrate= 397.6kbits/s speed=   1x    
size=     123kB time=00:00:02.53 bitrate= 397.6kbits/s speed=   1x    
size=     148kB time=00:00:03.05 bitrate= 397.6kbits/s speed=   1x    
size=     173kB time=00:00:03.56 bitrate= 397.6kbits/s speed=1.01x    
size=     197kB time=00:00:04.05 bitrate= 397.6kbits/s speed=   1x    
[7/22/2020, 6:07:34 PM] [UniFi Protect] { url:
'https://10.0.1.3:7443/api/events?end=1595466454478&start=1595466444478&type=motion',
method: 'get',
headers:
{ common: { Accept: 'application/json, text/plain, */*' },
delete: {},
get: {},
head: {},
post: { 'Content-Type': 'application/x-www-form-urlencoded' },
put: { 'Content-Type': 'application/x-www-form-urlencoded' },
patch: { 'Content-Type': 'application/x-www-form-urlencoded' },
'Content-Type': 'application/json',
Authorization:
 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMThkYzE2MDI2ZGRhMDNlNzAwNGU5NyIsImlhdCI6MTU5NTQ2NjQzNn0.GQ2UF-Z38FKBx7BlU-eFs9-Rzr7hVsq8aK7S5B0nzH4' },
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 1000,
withCredentials: true,
adapter: [Function: httpAdapter],
responseType: 'json',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
httpsAgent:
Agent {
_events: [Object: null prototype] { free: [Function] },
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: { rejectUnauthorized: false, path: null },
requests: {},
sockets: {},
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: { map: [Object], list: [Array] } } }
[7/22/2020, 6:07:34 PM] [UniFi Protect] { status: 200,
statusText: 'OK',
headers:
{ 'x-powered-by': 'Express',
vary: 'Origin',
'access-control-allow-credentials': 'true',
'content-type': 'application/json; charset=utf-8',
'content-length': '2',
etag: 'W/"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w"',
date: 'Thu, 23 Jul 2020 01:07:34 GMT',
connection: 'close' },
config:
{ url:
 'https://10.0.1.3:7443/api/events?end=1595466454478&start=1595466444478&type=motion',
method: 'get',
headers:
 { Accept: 'application/json, text/plain, */*',
   'Content-Type': 'application/json',
   Authorization:
    'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMThkYzE2MDI2ZGRhMDNlNzAwNGU5NyIsImlhdCI6MTU5NTQ2NjQzNn0.GQ2UF-Z38FKBx7BlU-eFs9-Rzr7hVsq8aK7S5B0nzH4',
   'User-Agent': 'axios/0.19.2' },
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 1000,
withCredentials: true,
adapter: [Function: httpAdapter],
responseType: 'json',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
httpsAgent:
 Agent {
   _events: [Object],
   _eventsCount: 1,
   _maxListeners: undefined,
   defaultPort: 443,
   protocol: 'https:',
   options: [Object],
   requests: {},
   sockets: [Object],
   freeSockets: {},
   keepAliveMsecs: 1000,
   keepAlive: false,
   maxSockets: Infinity,
   maxFreeSockets: 256,
   maxCachedSessions: 100,
   _sessionCache: [Object] },
data: undefined },
request:
ClientRequest {
_events:
 [Object: null prototype] {
   socket: [Array],
   abort: [Function],
   aborted: [Function],
   error: [Function],
   timeout: [Array],
   prefinish: [Function: requestOnPrefinish] },
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket:
 TLSSocket {
   _tlsOptions: [Object],
   _secureEstablished: true,
   _securePending: false,
   _newSessionPending: false,
   _controlReleased: true,
   _SNICallback: null,
   servername: '10.0.1.3',
   alpnProtocol: false,
   authorized: false,
   authorizationError: 'DEPTH_ZERO_SELF_SIGNED_CERT',
   encrypted: true,
   _events: [Object],
   _eventsCount: 9,
   connecting: false,
   _hadError: false,
   _handle: [TLSWrap],
   _parent: null,
   _host: null,
   _readableState: [ReadableState],
   readable: true,
   _maxListeners: undefined,
   _writableState: [WritableState],
   writable: false,
   allowHalfOpen: false,
   _sockname: null,
   _pendingData: null,
   _pendingEncoding: '',
   server: undefined,
   _server: null,
   ssl: [TLSWrap],
   _requestCert: true,
   _rejectUnauthorized: false,
   parser: null,
   _httpMessage: [Circular],
   timeout: 1000,
   [Symbol(res)]: [TLSWrap],
   [Symbol(asyncId)]: 11608,
   [Symbol(lastWriteQueueSize)]: 0,
   [Symbol(timeout)]:
    Timeout {
      _called: false,
      _idleTimeout: 1000,
      _idlePrev: [TimersList],
      _idleNext: [TimersList],
      _idleStart: 24313,
      _onTimeout: [Function: bound ],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: false,
      [Symbol(unrefed)]: true,
      [Symbol(asyncId)]: 11616,
      [Symbol(triggerId)]: 11612 },
   [Symbol(kBytesRead)]: 0,
   [Symbol(kBytesWritten)]: 0,
   [Symbol(connect-options)]: [Object] },
connection:
 TLSSocket {
   _tlsOptions: [Object],
   _secureEstablished: true,
   _securePending: false,
   _newSessionPending: false,
   _controlReleased: true,
   _SNICallback: null,
   servername: '10.0.1.3',
   alpnProtocol: false,
   authorized: false,
   authorizationError: 'DEPTH_ZERO_SELF_SIGNED_CERT',
   encrypted: true,
   _events: [Object],
   _eventsCount: 9,
   connecting: false,
   _hadError: false,
   _handle: [TLSWrap],
   _parent: null,
   _host: null,
   _readableState: [ReadableState],
   readable: true,
   _maxListeners: undefined,
   _writableState: [WritableState],
   writable: false,
   allowHalfOpen: false,
   _sockname: null,
   _pendingData: null,
   _pendingEncoding: '',
   server: undefined,
   _server: null,
   ssl: [TLSWrap],
   _requestCert: true,
   _rejectUnauthorized: false,
   parser: null,
   _httpMessage: [Circular],
   timeout: 1000,
   [Symbol(res)]: [TLSWrap],
   [Symbol(asyncId)]: 11608,
   [Symbol(lastWriteQueueSize)]: 0,
   [Symbol(timeout)]:
    Timeout {
      _called: false,
      _idleTimeout: 1000,
      _idlePrev: [TimersList],
      _idleNext: [TimersList],
      _idleStart: 24313,
      _onTimeout: [Function: bound ],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: false,
      [Symbol(unrefed)]: true,
      [Symbol(asyncId)]: 11616,
      [Symbol(triggerId)]: 11612 },
   [Symbol(kBytesRead)]: 0,
   [Symbol(kBytesWritten)]: 0,
   [Symbol(connect-options)]: [Object] },
_header:
 'GET /api/events?end=1595466454478&start=1595466444478&type=motion HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nContent-Type: application/json\r\nAuthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMThkYzE2MDI2ZGRhMDNlNzAwNGU5NyIsImlhdCI6MTU5NTQ2NjQzNn0.GQ2UF-Z38FKBx7BlU-eFs9-Rzr7hVsq8aK7S5B0nzH4\r\nUser-Agent: axios/0.19.2\r\nHost: 10.0.1.3:7443\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent:
 Agent {
   _events: [Object],
   _eventsCount: 1,
   _maxListeners: undefined,
   defaultPort: 443,
   protocol: 'https:',
   options: [Object],
   requests: {},
   sockets: [Object],
   freeSockets: {},
   keepAliveMsecs: 1000,
   keepAlive: false,
   maxSockets: Infinity,
   maxFreeSockets: 256,
   maxCachedSessions: 100,
   _sessionCache: [Object] },
socketPath: undefined,
timeout: undefined,
method: 'GET',
insecureHTTPParser: undefined,
path:
 '/api/events?end=1595466454478&start=1595466444478&type=motion',
_ended: true,
res:
 IncomingMessage {
   _readableState: [ReadableState],
   readable: false,
   _events: [Object],
   _eventsCount: 3,
   _maxListeners: undefined,
   socket: [TLSSocket],
   connection: [TLSSocket],
   httpVersionMajor: 1,
   httpVersionMinor: 1,
   httpVersion: '1.1',
   complete: true,
   headers: [Object],
   rawHeaders: [Array],
   trailers: {},
   rawTrailers: [],
   aborted: false,
   upgrade: false,
   url: '',
   method: null,
   statusCode: 200,
   statusMessage: 'OK',
   client: [TLSSocket],
   _consuming: true,
   _dumped: false,
   req: [Circular],
   responseUrl:
    'https://10.0.1.3:7443/api/events?end=1595466454478&start=1595466444478&type=motion',
   redirects: [] },
aborted: undefined,
timeoutCb: [Function: emitRequestTimeout],
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable:
 Writable {
   _writableState: [WritableState],
   writable: true,
   _events: [Object],
   _eventsCount: 2,
   _maxListeners: undefined,
   _options: [Object],
   _redirectCount: 0,
   _redirects: [],
   _requestBodyLength: 0,
   _requestBodyBuffers: [],
   _onNativeResponse: [Function],
   _currentRequest: [Circular],
   _currentUrl:
    'https://10.0.1.3:7443/api/events?end=1595466454478&start=1595466444478&type=motion' },
[Symbol(isCorked)]: false,
[Symbol(outHeadersKey)]:
 [Object: null prototype] {
   accept: [Array],
   'content-type': [Array],
   authorization: [Array],
   'user-agent': [Array],
   host: [Array] } },
data: [] }
size=     222kB time=00:00:04.56 bitrate= 397.5kbits/s speed=   1x    
size=     246kB time=00:00:05.07 bitrate= 397.6kbits/s speed=   1x    
[7/22/2020, 6:07:35 PM] [Occupancy Sensor] 0 monitored device(s) found. Accessory is in mode "any" so NOT triggering occupancy.
size=     271kB time=00:00:05.58 bitrate= 397.6kbits/s speed=   1x    
size=     295kB time=00:00:06.08 bitrate= 397.6kbits/s speed=   1x    
size=     320kB time=00:00:06.59 bitrate= 397.6kbits/s speed=   1x    
size=     345kB time=00:00:07.10 bitrate= 397.6kbits/s speed=   1x    
size=     369kB time=00:00:07.59 bitrate= 397.6kbits/s speed=   1x    
size=     393kB time=00:00:08.10 bitrate= 397.6kbits/s speed=   1x    
size=     418kB time=00:00:08.61 bitrate= 397.6kbits/s speed=   1x    
size=     443kB time=00:00:09.13 bitrate= 397.5kbits/s speed=   1x    
[7/22/2020, 6:07:39 PM] [UniFi Protect] { url:
'https://10.0.1.3:7443/api/events?end=1595466459478&start=1595466449478&type=motion',
method: 'get',
headers:
{ common: { Accept: 'application/json, text/plain, */*' },
delete: {},
get: {},
head: {},
post: { 'Content-Type': 'application/x-www-form-urlencoded' },
put: { 'Content-Type': 'application/x-www-form-urlencoded' },
patch: { 'Content-Type': 'application/x-www-form-urlencoded' },
'Content-Type': 'application/json',
Authorization:
 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMThkYzE2MDI2ZGRhMDNlNzAwNGU5NyIsImlhdCI6MTU5NTQ2NjQzNn0.GQ2UF-Z38FKBx7BlU-eFs9-Rzr7hVsq8aK7S5B0nzH4' },
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 1000,
withCredentials: true,
adapter: [Function: httpAdapter],
responseType: 'json',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
httpsAgent:
Agent {
_events: [Object: null prototype] { free: [Function] },
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: { rejectUnauthorized: false, path: null },
requests: {},
sockets: {},
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: { map: [Object], list: [Array] } } }
[7/22/2020, 6:07:39 PM] [UniFi Protect] { status: 200,
statusText: 'OK',
headers:
{ 'x-powered-by': 'Express',
vary: 'Origin',
'access-control-allow-credentials': 'true',
'content-type': 'application/json; charset=utf-8',
'content-length': '2',
etag: 'W/"2-l9Fw4VUO7kr8CvBlt4zaMCqXZ0w"',
date: 'Thu, 23 Jul 2020 01:07:39 GMT',
connection: 'close' },
config:
{ url:
 'https://10.0.1.3:7443/api/events?end=1595466459478&start=1595466449478&type=motion',
method: 'get',
headers:
 { Accept: 'application/json, text/plain, */*',
   'Content-Type': 'application/json',
   Authorization:
    'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMThkYzE2MDI2ZGRhMDNlNzAwNGU5NyIsImlhdCI6MTU5NTQ2NjQzNn0.GQ2UF-Z38FKBx7BlU-eFs9-Rzr7hVsq8aK7S5B0nzH4',
   'User-Agent': 'axios/0.19.2' },
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 1000,
withCredentials: true,
adapter: [Function: httpAdapter],
responseType: 'json',
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
httpsAgent:
 Agent {
   _events: [Object],
   _eventsCount: 1,
   _maxListeners: undefined,
   defaultPort: 443,
   protocol: 'https:',
   options: [Object],
   requests: {},
   sockets: [Object],
   freeSockets: {},
   keepAliveMsecs: 1000,
   keepAlive: false,
   maxSockets: Infinity,
   maxFreeSockets: 256,
   maxCachedSessions: 100,
   _sessionCache: [Object] },
data: undefined },
request:
ClientRequest {
_events:
 [Object: null prototype] {
   socket: [Array],
   abort: [Function],
   aborted: [Function],
   error: [Function],
   timeout: [Array],
   prefinish: [Function: requestOnPrefinish] },
_eventsCount: 6,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket:
 TLSSocket {
   _tlsOptions: [Object],
   _secureEstablished: true,
   _securePending: false,
   _newSessionPending: false,
   _controlReleased: true,
   _SNICallback: null,
   servername: '10.0.1.3',
   alpnProtocol: false,
   authorized: false,
   authorizationError: 'DEPTH_ZERO_SELF_SIGNED_CERT',
   encrypted: true,
   _events: [Object],
   _eventsCount: 9,
   connecting: false,
   _hadError: false,
   _handle: [TLSWrap],
   _parent: null,
   _host: null,
   _readableState: [ReadableState],
   readable: true,
   _maxListeners: undefined,
   _writableState: [WritableState],
   writable: false,
   allowHalfOpen: false,
   _sockname: null,
   _pendingData: null,
   _pendingEncoding: '',
   server: undefined,
   _server: null,
   ssl: [TLSWrap],
   _requestCert: true,
   _rejectUnauthorized: false,
   parser: null,
   _httpMessage: [Circular],
   timeout: 1000,
   [Symbol(res)]: [TLSWrap],
   [Symbol(asyncId)]: 11822,
   [Symbol(lastWriteQueueSize)]: 0,
   [Symbol(timeout)]:
    Timeout {
      _called: false,
      _idleTimeout: 1000,
      _idlePrev: [TimersList],
      _idleNext: [TimersList],
      _idleStart: 29317,
      _onTimeout: [Function: bound ],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: false,
      [Symbol(unrefed)]: true,
      [Symbol(asyncId)]: 11830,
      [Symbol(triggerId)]: 11826 },
   [Symbol(kBytesRead)]: 0,
   [Symbol(kBytesWritten)]: 0,
   [Symbol(connect-options)]: [Object] },
connection:
 TLSSocket {
   _tlsOptions: [Object],
   _secureEstablished: true,
   _securePending: false,
   _newSessionPending: false,
   _controlReleased: true,
   _SNICallback: null,
   servername: '10.0.1.3',
   alpnProtocol: false,
   authorized: false,
   authorizationError: 'DEPTH_ZERO_SELF_SIGNED_CERT',
   encrypted: true,
   _events: [Object],
   _eventsCount: 9,
   connecting: false,
   _hadError: false,
   _handle: [TLSWrap],
   _parent: null,
   _host: null,
   _readableState: [ReadableState],
   readable: true,
   _maxListeners: undefined,
   _writableState: [WritableState],
   writable: false,
   allowHalfOpen: false,
   _sockname: null,
   _pendingData: null,
   _pendingEncoding: '',
   server: undefined,
   _server: null,
   ssl: [TLSWrap],
   _requestCert: true,
   _rejectUnauthorized: false,
   parser: null,
   _httpMessage: [Circular],
   timeout: 1000,
   [Symbol(res)]: [TLSWrap],
   [Symbol(asyncId)]: 11822,
   [Symbol(lastWriteQueueSize)]: 0,
   [Symbol(timeout)]:
    Timeout {
      _called: false,
      _idleTimeout: 1000,
      _idlePrev: [TimersList],
      _idleNext: [TimersList],
      _idleStart: 29317,
      _onTimeout: [Function: bound ],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: false,
      [Symbol(unrefed)]: true,
      [Symbol(asyncId)]: 11830,
      [Symbol(triggerId)]: 11826 },
   [Symbol(kBytesRead)]: 0,
   [Symbol(kBytesWritten)]: 0,
   [Symbol(connect-options)]: [Object] },
_header:
 'GET /api/events?end=1595466459478&start=1595466449478&type=motion HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nContent-Type: application/json\r\nAuthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMThkYzE2MDI2ZGRhMDNlNzAwNGU5NyIsImlhdCI6MTU5NTQ2NjQzNn0.GQ2UF-Z38FKBx7BlU-eFs9-Rzr7hVsq8aK7S5B0nzH4\r\nUser-Agent: axios/0.19.2\r\nHost: 10.0.1.3:7443\r\nConnection: close\r\n\r\n',
_onPendingData: [Function: noopPendingOutput],
agent:
 Agent {
   _events: [Object],
   _eventsCount: 1,
   _maxListeners: undefined,
   defaultPort: 443,
   protocol: 'https:',
   options: [Object],
   requests: {},
   sockets: [Object],
   freeSockets: {},
   keepAliveMsecs: 1000,
   keepAlive: false,
   maxSockets: Infinity,
   maxFreeSockets: 256,
   maxCachedSessions: 100,
   _sessionCache: [Object] },
socketPath: undefined,
timeout: undefined,
method: 'GET',
insecureHTTPParser: undefined,
path:
 '/api/events?end=1595466459478&start=1595466449478&type=motion',
_ended: true,
res:
 IncomingMessage {
   _readableState: [ReadableState],
   readable: false,
   _events: [Object],
   _eventsCount: 3,
   _maxListeners: undefined,
   socket: [TLSSocket],
   connection: [TLSSocket],
   httpVersionMajor: 1,
   httpVersionMinor: 1,
   httpVersion: '1.1',
   complete: true,
   headers: [Object],
   rawHeaders: [Array],
   trailers: {},
   rawTrailers: [],
   aborted: false,
   upgrade: false,
   url: '',
   method: null,
   statusCode: 200,
   statusMessage: 'OK',
   client: [TLSSocket],
   _consuming: true,
   _dumped: false,
   req: [Circular],
   responseUrl:
    'https://10.0.1.3:7443/api/events?end=1595466459478&start=1595466449478&type=motion',
   redirects: [] },
aborted: undefined,
timeoutCb: [Function: emitRequestTimeout],
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable:
 Writable {
   _writableState: [WritableState],
   writable: true,
   _events: [Object],
   _eventsCount: 2,
   _maxListeners: undefined,
   _options: [Object],
   _redirectCount: 0,
   _redirects: [],
   _requestBodyLength: 0,
   _requestBodyBuffers: [],
   _onNativeResponse: [Function],
   _currentRequest: [Circular],
   _currentUrl:
    'https://10.0.1.3:7443/api/events?end=1595466459478&start=1595466449478&type=motion' },
[Symbol(isCorked)]: false,
[Symbol(outHeadersKey)]:
 [Object: null prototype] {
   accept: [Array],
   'content-type': [Array],
   authorization: [Array],
   'user-agent': [Array],
   host: [Array] } },
data: [] }
size=     468kB time=00:00:09.64 bitrate= 397.5kbits/s speed=   1x    
size=     493kB time=00:00:10.15 bitrate= 397.6kbits/s speed=   1x    
size=     517kB time=00:00:10.64 bitrate= 397.6kbits/s speed=   1x    
[7/22/2020, 6:07:41 PM] [UniFi Protect] Snapshot from Backyard at 1280:720
ffmpeg -i http://10.0.1.89/snap.jpeg -t 1 -vf scale=1280:720 -f image2 -
[7/22/2020, 6:07:41 PM] [UniFi Protect] Snapshot from Compost at 1280:720
ffmpeg -i http://10.0.1.39/snap.jpeg -t 1 -vf scale=1280:720 -f image2 -
[7/22/2020, 6:07:41 PM] [UniFi Protect] Snapshot from Driveway at 1280:720
ffmpeg -i http://10.0.1.88/snap.jpeg -t 1 -vf scale=1280:720 -f image2 -
size=     541kB time=00:00:11.15 bitrate= 397.6kbits/s speed=   1x    
size=     553kB time=00:00:11.39 bitrate= 397.6kbits/s speed=   1x    
video:0kB audio:534kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.530987%
Input file #0 (rtsp://10.0.1.3:7447/pNEEojM7mieLG9d9):
Input stream #0:0 (audio): 534 packets read (87398 bytes); 534 frames decoded (546816 samples); 
Input stream #0:1 (video): 122 packets read (120976 bytes); 
Total: 656 packets (208374 bytes) demuxed
Output file #0 (srtp://10.0.1.8:54265?rtcpport=54265&localrtcpport=54265&pkt_size=376):
Output stream #0:0 (audio): 534 frames encoded (546816 samples); 534 packets muxed (546816 bytes); 
Total: 534 packets (546816 bytes) muxed
534 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x2a9ff10] Statistics: 0 seeks, 1605 writeouts

Exiting normally, received signal 15.

[7/22/2020, 6:07:41 PM] [UniFi Protect] Stopped streaming

@beele
Copy link
Owner

beele commented Jul 23, 2020

Could you try with the latest beta: [email protected]

@tillkruss
Copy link
Author

tillkruss commented Jul 23, 2020

Maybe related: homebridge-plugins/homebridge-camera-ffmpeg#633

I've installed this:

sudo npm -g install [email protected] --unsafe-perm

And the HB logs show:

[7/23/2020, 1:01:32 PM] [UniFi Protect] Cameras retrieved, enumerating motion sensors
[7/23/2020, 1:01:32 PM] [UniFi Protect] Adding c0f461f6-7442-4211-8e78-6c194e5d485a
[7/23/2020, 1:01:32 PM] [UniFi Protect] Configuring accessory Backyard
(node:12767) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'Switch' of undefined
    at Function.setupMotionSensor (/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/src/characteristics/unifi-camera-motion-sensor.js:19:49)
    at UnifiProtectMotionPlatform.configureAccessory (/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/src/unifi-protect-motion-platform.js:102:62)
    at cameras.forEach (/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/src/unifi-protect-motion-platform.js:71:26)
    at Array.forEach (<anonymous>)
    at UnifiProtectMotionPlatform.didFinishLaunching (/usr/local/lib/node_modules/homebridge-unifi-protect-camera-motion/src/unifi-protect-motion-platform.js:55:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:12767) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12767) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The 3 cameras aren't showing up as accessories any longer.

@beele
Copy link
Owner

beele commented Jul 25, 2020

[email protected] should fix this (on my local machine this error does not occur because I have homebridge as a dev dependency)

@tillkruss
Copy link
Author

tillkruss commented Jul 25, 2020

The accessories are back, the snapshots work again, but the stream is still not showing up on macOS or iOS.

Opening the rtsp://10.0.1.3:7447/2JCNcPsvfvPFTvLi stream in VLC works, just to be sure.

[7/25/2020, 12:13:51 PM] [Occupancy Sensor] 0 monitored device(s) found. Accessory is in mode "any" so NOT triggering occupancy.
[7/25/2020, 12:14:01 PM] [Occupancy Sensor] 0 monitored device(s) found. Accessory is in mode "any" so NOT triggering occupancy.
[7/25/2020, 12:14:02 PM] [UniFi Protect] Handling snapshot request for Camera: undefined
[7/25/2020, 12:14:02 PM] [UniFi Protect] Getting snapshot via FFmpeg
[7/25/2020, 12:14:02 PM] [UniFi Protect] Sending snapshot: 1280x720 Backyard
[7/25/2020, 12:14:02 PM] [UniFi Protect] Handling snapshot request for Camera: undefined
[7/25/2020, 12:14:02 PM] [UniFi Protect] Getting snapshot via FFmpeg
[7/25/2020, 12:14:02 PM] [UniFi Protect] Sending snapshot: 1280x720 Compost
[7/25/2020, 12:14:03 PM] [UniFi Protect] Handling snapshot request for Camera: undefined
[7/25/2020, 12:14:03 PM] [UniFi Protect] Getting snapshot via FFmpeg
[7/25/2020, 12:14:03 PM] [UniFi Protect] Sending snapshot: 1280x720 Driveway
[7/25/2020, 12:14:08 PM] [UniFi Protect] Starting video stream: 1280x720, 25 fps, 299 kbps Backyard
[7/25/2020, 12:14:11 PM] [Occupancy Sensor] 0 monitored device(s) found. Accessory is in mode "any" so NOT triggering occupancy.
[7/25/2020, 12:14:21 PM] [Occupancy Sensor] 0 monitored device(s) found. Accessory is in mode "any" so NOT triggering occupancy.
[7/25/2020, 12:14:29 PM] [UniFi Protect] Handling snapshot request for Camera: undefined
[7/25/2020, 12:14:29 PM] [UniFi Protect] Getting snapshot via FFmpeg
[7/25/2020, 12:14:29 PM] [UniFi Protect] Sending snapshot: 1280x720 Backyard
[7/25/2020, 12:14:30 PM] [UniFi Protect] Handling snapshot request for Camera: undefined
[7/25/2020, 12:14:30 PM] [UniFi Protect] Getting snapshot via FFmpeg
[7/25/2020, 12:14:30 PM] [UniFi Protect] Sending snapshot: 1280x720 Compost
[7/25/2020, 12:14:30 PM] [UniFi Protect] Handling snapshot request for Camera: undefined
[7/25/2020, 12:14:30 PM] [UniFi Protect] Getting snapshot via FFmpeg
[7/25/2020, 12:14:30 PM] [UniFi Protect] Sending snapshot: 1280x720 Driveway
[7/25/2020, 12:14:30 PM] [UniFi Protect] Stopped video stream. Backyard

@beele
Copy link
Owner

beele commented Aug 2, 2020

Please refer to: #62

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

No branches or pull requests

2 participants