koush / scrypted

Scrypted is a high performance video integration and automation platform
https://scrypted.app
Other
4.32k stars 255 forks source link

Packet loss in HomeKit #1639

Closed gaurav85 closed 2 weeks ago

gaurav85 commented 2 weeks ago

Unable to view live steam via HomeKit and always ends up in packet loss. Here are the logs that I am seeing. I am running scrypted as an addon on Home Assistant.


[Front Door] rtsp incoming message
 RTSP/1.0 200 OK
Session: da9a034d
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
CSeq: 2
request headers SETUP rtsp://127.0.0.1:43695/trackID=1 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
CSeq: 3
User-Agent: Scrypted
Session: da9a034d
response headers RTSP/1.0 200 OK
Session: da9a034d
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
CSeq: 3
[Front Door]
[Front Door] rtsp outgoing message
 SETUP rtsp://127.0.0.1:43695/trackID=1 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
CSeq: 3
User-Agent: Scrypted
Session: da9a034d
[Front Door]
[Front Door] rtsp incoming message
 RTSP/1.0 200 OK
Session: da9a034d
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
CSeq: 3
request headers PLAY rtsp://127.0.0.1:43695 RTSP/1.0
Range: npt=0.000-
CSeq: 4
User-Agent: Scrypted
Session: da9a034d
response headers RTSP/1.0 200 OK
RTP-Info: url=rtsp://127.0.0.1:43695/trackID=0,url=rtsp://127.0.0.1:43695/trackID=1
Range: npt=now-
Session: da9a034d
CSeq: 4
[Front Door]
[Front Door] refreshing media stream in 89740
[Front Door] rtsp outgoing message
 PLAY rtsp://127.0.0.1:43695 RTSP/1.0
Range: npt=0.000-
CSeq: 4
User-Agent: Scrypted
Session: da9a034d
[Front Door]
[Front Door] rtsp incoming message
 RTSP/1.0 200 OK
RTP-Info: url=rtsp://127.0.0.1:43695/trackID=0,url=rtsp://127.0.0.1:43695/trackID=1
Range: npt=now-
Session: da9a034d
CSeq: 4
[Front Door]
[Front Door] { tool: undefined, rtpSender: 'Default' }
[Front Door] H264 oddities are reported in the stream. Using FFmpeg.
[Front Door] Waiting for video RTCP packet before sending video.
[Front Door] packet loss 1
[Front Door] Received first video RTCP packet.
[Front Door] video codec/container not matched, transcoding: transcode {"url":"rtsp://127.0.0.1:43505/23dbb81288f3a40e/58","container":"rtsp","inputArguments":["-analyzeduration","0","-probesize","500000","-reorder_queue_size","0","-rtsp_transport","tcp","-f","rtsp","-i","rtsp://127.0.0.1:43505/23dbb81288f3a40e/58"],"mediaStreamOptions":{"id":"sip","name":"SIP","container":"rtsp","video":{"codec":"h264","h264Info":{"sei":true,"stapb":true,"mtap16":true,"mtap32":true,"fuab":true,"reserved0":true,"reserved30":true,"reserved31":true}},"audio":{"codec":"pcm_mulaw","sampleRate":8000},"source":"cloud","userConfigurable":false,"refreshAt":1730987055915,"sdp":"v=0\r\no=- 3747 461 IN IP4\r\ns=-\r\nc=IN IP4 127.0.0.1\r\nt=0 0\r\nm=audio 0 RTP/SAVPF 0\r\na=control:trackID=0\r\na=rtpmap:0 PCMU/8000\r\na=rtcp:40141 IN IP4 18.116.189.4\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:TrEfNcYjGwzoJDJae7Dhs2s0Fx5mJqN0efd395TY\r\na=ptime:20\r\nm=video 0 RTP/SAVPF 99\r\na=control:trackID=1\r\na=rtpmap:99 H264/90000\r\na=fmtp:99 profile-level-id=42801F\r\na=rtcp:37338 IN IP4 18.116.189.4\r\na=rtcp-fb:99 nack\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:K9L+wD51yDU9ehSmg/X0/zRIij8dgknAhVxCnF8W","prebuffer":4000,"prebufferBytes":0},"destinationVideoBitrate":2000000}
[Front Door] -hide_banner -analyzeduration 0 -probesize 500000 -reorder_queue_size 0 -rtsp_transport tcp -f rtsp -i rtsp:[REDACTED] -vcodec copy -payload_type 99 -ssrc 15263519 -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params tTvFl9YmWGD5nv9oinSxJtKW1jGJc4fnKhKHqVm9 -dn -sn -an -f rtp srtp://192.168.7.104:55279?rtcpport=55279&pkt_size=1200 -acodec libopus -application lowdelay -frame_duration 20 -flags +global_header -ar 24k -b:a 24k -bufsize 96k -ac 1 -payload_type 110 -ssrc 2363384 -dn -sn -vn -f rtp rtp://127.0.0.1:50856?pkt_size=400 -sdp_file pipe:4
[Front Door] SIP active rebroadcast clients: 1
[Front Door] H264 oddity detected.
[Front Door] Guessed Channel Layout for Input Stream #0.0 : mono
[Front Door] Input #0, rtsp, from 'rtsp://127.0.0.1:43505/23dbb81288f3a40e/58':
  Metadata:
    title           : -
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
  Stream #0:1: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 20 fps, 20 tbr, 90k tbn, 40 tbc
[Front Door] Output #0, rtp, to 'srtp://192.168.7.104:55279?rtcpport=55279&pkt_size=1200':
  Metadata:
    title           : -
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 20 fps, 20 tbr, 90k tbn, 20 tbc
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #1:0 (pcm_mulaw (native) -> opus (libopus))
Press [q] to stop, [?] for help
[Front Door] video/audio detected, discarding further input
[Front Door] received first audio packet
[Front Door] packet loss 62
[Front Door] packet loss 85
[Front Door] packet loss 100
[Front Door] packet loss 117
[Front Door] packet loss 149
[Front Door] packet loss 168
[Front Door] packet loss 195
[Front Door] packet loss 214
[Front Door] packet loss 232
[Front Door] packet loss 252
[Front Door] packet loss 264
[Front Door] packet loss 278
[Front Door] packet loss 300
[Front Door] packet loss 322
[Front Door] packet loss 341
[Front Door] packet loss 362