Coder Social home page Coder Social logo

alexxit / go2rtc Goto Github PK

View Code? Open in Web Editor NEW
3.3K 42.0 278.0 13 MB

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.

Home Page: https://github.com/AlexxIT/Blog

License: MIT License

Go 90.79% Batchfile 0.18% HTML 5.35% Dockerfile 0.43% JavaScript 3.24%
ffmpeg hassio home-assistant ngrok rtmp rtsp webrtc streaming h264 webcam-streaming

go2rtc's Introduction

Main projects

  1. go2rtc - Ultimate camera streaming application

    Golang, RTP, SRTP, RTSP, SDP, RTMP, WebRTC, HomeKit, fMP4, MSE, MJPEG, HLS, H264, ONVIF backchannel, REST, WebSocket, STUN, TURN, mDNS, Docker, FFmpeg, Ngrok
  2. SonoffLAN - Control Sonoff Devices with eWeLink (original) firmware over LAN and/or Cloud from Home Assistant

    Python, REST, WebSocket, mDNS, RF433, eWeLink API
  3. XiaomiGateway3 - Control Zigbee, BLE and Mesh devices from Home Assistant with Xiaomi Gateway 3 on original firmware

    Python, bash, Telnet, REST, MQTT, miIO, MIoT, Bluetooth Mesh, Bluetooth BLE, MiBeacon, Silicon Labs EFR32, Zigbee EZSP, ZHA, zigbee2mqtt
  4. WebRTC Camera - View an camera RTSP-stream in real time (without any delay) using WebRTC technology

    Python, golang, RTSP, WebRTC, MSE, STUN, TURN, Chromecast
  5. HassWP - Portable version of Home Assistant for Windows (no need to install)

    Windows batch scripts, Python Virtual Environments

Other projects

  1. DashCast - Cast any site from Home Assistant to Chromecast
  2. Dataplicity - Public HTTPS access to Home Assistant with Dataplicity service
  3. StreamAssist - Turn almost any camera and almost any speaker into a local voice assistant
  4. PythonScriptsPro - Advanced version of python scripts for Home Assistant without limits
  5. Ergomotion Smart Beds - Control Ergomotion Smart Beds via Bluetooth module from Home Assistant
  6. Jura Coffee Machines - Control Jura Coffee Machines via Bluetooth module from Home Assistant
  7. Hass Diagnostics - Diagnostics entities for Home Assistant
  8. SSHCommand - Run SSH commands on remote host from Home Assistant
  9. OpenmiIO - Daemon app for Xiaomi Gateways
    Golang, MIPS, ARM, MQTT, miIO, serial, Silicon Labs EFR32, Lua, JSON-RPC

Russian projects

  1. YandexStation - Управление Яндекс.Станцией и другими колонками с Алисой из Home Assistant

    Python, REST, WebSocket, mDNS, TTS, NLU, Audio streaming, DLNA
  2. YandexDialogs - Управление Home Assistant через Яндекс.Диалоги
  3. MorphNumbers - Компонент Home Assistant для работы с числительными в Jinja2
  4. GyverLamp - Home Assistant компонент для интеграции лампы Гайвера на оригинальной прошивке

Contacts

Links

Hardware

Task Device Arch
for live MacBook Pro M1 mac arm64 + amd64
for dev Parallels Desktop win arm64 + amd64
home server Intel Nuc 10 i3 linux amd64
test server Raspberry Pi 3 linux arm

My personal thanks to JetBrains for great software and license for open source.

Donation

ЮMoney (если вы в России)

BTC: bc1qd826y7z7t3k5rfk2vvuzsprmep4uncq0ux2dya
ETH: 0xC1b61c51a66bAD79C71137D47F3e1789d9fB5985
TON: UQAT3xw0_edgJeEvv3HwEcs8I61TcqaKzOtADeR1ksdAUgl9
TRC20: TVnuJ5g5qz9F2UncCWV3wLch7ZkJL6Hj95

AlexxIT

go2rtc's People

Contributors

acardace avatar alexxit avatar awatuna avatar civita avatar dbuezas avatar egmen avatar felipecrs avatar h0nig avatar inode64 avatar inrego avatar jgould-godaddy avatar jkolo avatar makuser avatar miguelangel-nubla avatar nickm-27 avatar pabst2k avatar russorat avatar skrashevich avatar testwill avatar tsightler avatar vipas-ana avatar yousong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go2rtc's Issues

Green video after ffmpeg transcoding with scale

Hey Alex,
Here's hoping you're doing good!

I've been using this since release and must say I am very pleased with the performance, except for that small kernel panic thing that you are working on.

I was thinking about an issue that I encounter, where my main PTZ camera can either send a very high resolution ( 2k) or a very low resolution (480p). The highest resolution seems too high to be properly streamed to my tablets, and the lower one is simply abhorrent quality-wise.

Feature: I was thinking, would it be wise to implement a quick argument to downscale videos?
For instance, reduce the height and width by a factor of X. This could use the hardware acceleration provided by FFmpeg.

Thanks for reading!

Stream only works for a few seconds, then gives error.

Hey, i added a frigate RTMP stream to the go2rtc.yaml file like this:

rtmp_stream: rtmp://192.168.0.200/live/bureau_fr

The stream works for a few seconds if I click on "webrtc" within the go2rtc dashboard, but stops after a few seconds, if I try to open the stream again it gives this error in docker log:

14:01:20.934 WRN [api.webrtc] add consumer error="couldn't find the matching tracks"

If I click on "info" within the go2rtc dashboard it gives me this:

[{"receive":0,"remote_addr":"192.168.0.200:1935","type":"RTMP client producer","url":"rtmp://192.168.0.200/live/bureau_fr"}]

Any idea what i'm doing wrong or what's causing this? thanks!

Remote Access

Hello friends —

I've setup go2rtc and am able to view my homeassistant generic camera card on my local network on desktop and mobile (when connected to the same internet connection as the server my go2rtc instance is on).

However, when trying to view from my homeassistant app on MOBILE data i have no luck. I get the following error in the logs:

21:57:51.786 DBG [webrtc] stun public address addr=MYIPV6ADDRESS:8554
21:57:51.786 WRN [webrtc] candidate error="address MYIPV6ADDRESS:8554: too many colons in address"

In my go2rtc.yaml i have the following (tried to follow the docs to a T):

webrtc:
  listen: ":8554"  # address of your local server (TCP)
  candidates:
    - stun:8554  # if you have dynamic public IP-address

streams:
  camera_1: rtsp://user:pass@mycamIP:554/cam/realmonitor?channel=1&subtype=1
  camera_2: rtsp://user:pass@mycamIP:554/cam/realmonitor?channel=2&subtype=1
  camera_3: rtsp://user:pass@mycamIP:554/cam/realmonitor?channel=3&subtype=1

log:
  level: info # default level
  api: trace
  exec: debug
  ngrok: info
  rtsp: debug
  streams: debug
  webrtc: debug

I've also port forwarded port 8554 on my router for the server with go2rtc. I access my homeassistant through a custom domain using cloudflare for dynamic dns routing if that matters.

Any idea what I could be doing wrong?

Adding USB-camera With Home Assistant Feedback / Suggestions

I wanted to give feedback to make the experience of adding a USB webcam to go2rtc via the Home Assistant Addon better for everyone (or anyone getting stuck can read this issue for help).

Web Interface

After adding the addon, I could see on the go2rtc web interface on the device tab my usb webcam. However I was unable to figure out how to add it via the web interface. I tried the only option I had (entering the name "/dev/video1" into the url field and pressing add.) There is also no way to go back to the main page after clicking into the device tab.

I saw that usb cameras were just recently added a week ago, I would suggest if possible a button within the web interface to quickly add the device. Or at least a warning that one has to add usb cam streams via the go2rtc.yaml

go2rtc.yaml

After creating a go2rtc.yaml in my Home Assistant config folder, I tried following the guide for adding a USB camera stream however I think that it needs to be updated to explain that you have to add the full device name / path after "ffmpeg:device?" instead of just "video0" (ie, in my case it needed to be "ffmpeg:device?/dev/video1")

After following the "windows_webcam" stream example using the device name / path after device? the usb camera was added and I tested webrtc and rtsp streams working well (great fps compared to getting like 1fps with motioneye on a Wyse Thinclient). I misread the different stream types not as where the usb cameras are located but rather the viewing source (thats why I used windows_webcam when usb camera is plugged into my Home Assistant so I should have used "linux_usbcam" where one of the arguments is manually setting the resolution).


I apologize if this sounds like simple problems but every bit of easy of use goes a long way for anyone. I have been researching for a long time for a high framerate / simple way to stream a usb camera plugged into Home Assistant over my network and happy to have found this today and it works very well.

Dahua VTO support

Browser is asking for microphone permission, but no audio from VTO and unmute button is disabled

api:
  base_path: "/go2rtc"
streams:
  vto:
    - rtsp://admin:[email protected]/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
[
  {
    "media:0": "video, sendonly, 96 H264/90000",
    "media:1": "audio, sendonly, 97 L16/16000",
    "media:2": "application, sendonly, 107 VND.ONVIF.METADATA/90000",
    "media:3": "audio, recvonly, 97 L16/16000",
    "receive": 824840,
    "remote_addr": "192.168.124.30:554",
    "send": 0,
    "track:0": "96 H264/90000, sinks=1",
    "type": "RTSP client producer",
    "url": "rtsp://192.168.124.30:554/cam/realmonitor?channel=1\u0026subtype=0\u0026unicast=true\u0026proto=Onvif/"
  },
  {
    "remote_addr": "udp4 host 192.168.123.33:63426",
    "send": 826301,
    "type": "WebRTC server consumer",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.4976.0 Safari/537.36"
  }
]
v=0
o=- 8819968399131000794 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1
a=extmap-allow-mixed
a=msid-semantic: WMS mUTzunk2m8gOBSbMpIqZr9ZW7amqcT2Uu8h0
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 123 35 36 127 122 125 107 108 109 124 121 120 119 114 37
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:cSCj
a=ice-pwd:azQ5DYFApCx3rzPQWvEqknTA
a=ice-options:trickle
a=fingerprint:sha-256 2A:0A:DC:2B:B9:B5:CC:A3:07:E0:98:E7:B3:65:7A:2B:98:5E:AA:AE:0E:76:DB:71:3F:52:3D:E8:55:2B:F8:F7
a=setup:actpass
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:toffset
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 urn:3gpp:video-orientation
a=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space
a=extmap:9 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:98 VP9/90000
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=fmtp:98 profile-id=0
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 VP9/90000
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 transport-cc
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=fmtp:100 profile-id=2
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:102 VP9/90000
a=rtcp-fb:102 goog-remb
a=rtcp-fb:102 transport-cc
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=fmtp:102 profile-id=1
a=rtpmap:123 rtx/90000
a=fmtp:123 apt=102
a=rtpmap:35 AV1/90000
a=rtcp-fb:35 goog-remb
a=rtcp-fb:35 transport-cc
a=rtcp-fb:35 ccm fir
a=rtcp-fb:35 nack
a=rtcp-fb:35 nack pli
a=rtpmap:36 rtx/90000
a=fmtp:36 apt=35
a=rtpmap:127 H264/90000
a=rtcp-fb:127 goog-remb
a=rtcp-fb:127 transport-cc
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 nack
a=rtcp-fb:127 nack pli
a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtpmap:122 rtx/90000
a=fmtp:122 apt=127
a=rtpmap:125 H264/90000
a=rtcp-fb:125 goog-remb
a=rtcp-fb:125 transport-cc
a=rtcp-fb:125 ccm fir
a=rtcp-fb:125 nack
a=rtcp-fb:125 nack pli
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f
a=rtpmap:107 rtx/90000
a=fmtp:107 apt=125
a=rtpmap:108 H264/90000
a=rtcp-fb:108 goog-remb
a=rtcp-fb:108 transport-cc
a=rtcp-fb:108 ccm fir
a=rtcp-fb:108 nack
a=rtcp-fb:108 nack pli
a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f
a=rtpmap:109 rtx/90000
a=fmtp:109 apt=108
a=rtpmap:124 H264/90000
a=rtcp-fb:124 goog-remb
a=rtcp-fb:124 transport-cc
a=rtcp-fb:124 ccm fir
a=rtcp-fb:124 nack
a=rtcp-fb:124 nack pli
a=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:121 rtx/90000
a=fmtp:121 apt=124
a=rtpmap:120 red/90000
a=rtpmap:119 rtx/90000
a=fmtp:119 apt=120
a=rtpmap:114 ulpfec/90000
a=rtpmap:37 flexfec-03/90000
a=rtcp-fb:37 goog-remb
a=rtcp-fb:37 transport-cc
a=fmtp:37 repair-window=10000000
m=audio 9 UDP/TLS/RTP/SAVPF 111 63 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:cSCj
a=ice-pwd:azQ5DYFApCx3rzPQWvEqknTA
a=ice-options:trickle
a=fingerprint:sha-256 2A:0A:DC:2B:B9:B5:CC:A3:07:E0:98:E7:B3:65:7A:2B:98:5E:AA:AE:0E:76:DB:71:3F:52:3D:E8:55:2B:F8:F7
a=setup:actpass
a=mid:1
a=extmap:14 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:9 urn:ietf:params:rtp-hdrext:sdes:mid
a=sendrecv
a=msid:mUTzunk2m8gOBSbMpIqZr9ZW7amqcT2Uu8h0 9654a211-5d7a-4500-8034-3b17b1c6c7a7
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:63 red/48000/2
a=fmtp:63 111/111
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
a=ssrc:1443778823 cname:5sgtTCGio9Mf4sP8
a=ssrc:1443778823 msid:mUTzunk2m8gOBSbMpIqZr9ZW7amqcT2Uu8h0 9654a211-5d7a-4500-8034-3b17b1c6c7a7
a=ssrc:1443778823 mslabel:mUTzunk2m8gOBSbMpIqZr9ZW7amqcT2Uu8h0
a=ssrc:1443778823 label:9654a211-5d7a-4500-8034-3b17b1c6c7a7

6webrtc.html:1 Uncaught (in promise) DOMException: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': The remote description was null

sometimes 1 of my cmaeras didn't show related stream on HASS card

Hi,
thank you for this great successor pluign that seems already working cmoothly even if in alpha stage.
I'm running it as HASS Add-on

I currently have 4 IP cameras:
2 Hikvision
1 ezviz
1 reolink

I putted all my camera on same HASS card.
Sometimes it happened that the stream related to the Reolink camera (that is the latest one) didn't show up on the page.

in BDG log i can just see the following

15:35:00.223 DBG [streams] probe producer url=rtsp://admin:[email protected]:1240
15:35:00.234 DBG [streams] start producer url=rtsp://admin:[email protected]:1240
15:35:00.269 DBG [streams] probe producer url=rtsp://admin:[email protected]:1241
15:35:00.270 DBG [streams] probe producer url=rtsp://admin:[email protected]:554
15:35:00.271 DBG [streams] probe producer url=rtsp://admin:xxxxxxx%[email protected]:554/h264Preview_01_sub
15:35:00.289 DBG [streams] start producer url=rtsp://admin:[email protected]:1241
15:35:00.296 DBG [webrtc] stun public address addr=79.54.208.253:8555
15:35:00.314 DBG [streams] start producer url=rtsp://admin:xxxxxxx%[email protected]:554/h264Preview_01_sub
15:35:00.336 DBG [webrtc] stun public address addr=79.54.208.253:8555
15:35:00.338 DBG [streams] start producer url=rtsp://admin:[email protected]:554
15:35:00.369 DBG [webrtc] stun public address addr=79.54.208.253:8555
15:35:00.394 DBG [webrtc] stun public address addr=79.54.208.253:8555
15:35:28.602 DBG [streams] stop producer url=rtsp://admin:[email protected]:1241
15:35:28.607 DBG [streams] stop producer url=rtsp://admin:[email protected]:1240
15:35:28.720 DBG [streams] stop producer url=rtsp://admin:xxxxxxx%[email protected]:554/h264Preview_01_sub
15:35:28.748 DBG [streams] stop producer url=rtsp://admin:[email protected]:554

I can only highlight three things looking at the logs but not really helpful....

  • timestamp seems UTC and not my local timezone
  • the Reolink password is diplayed in log ending with %21 instead of !
  • i see log with probe producer and start producer, but not any logs related to webrtc module

praobably i need to enhance the log level of one of the module and collect new logs. if so, can you suggest me which module and which level i should configure in order to have intersting logs?
thanks

What's a recommended way to watch streams outside of the network?

Hi - first off I wanna say, that this is great work. Both go2rtc and WebRTC is really great. However, my wife has a problem with her iPhone and the Home Asisstant companion app: She cannot view the WebRTC cameras outside of our network, and sometimes not on our network either. My Android phone can easily view the cameras. What my wife tends to do, is open the TuYa app we have for one of our Sonoff cameras and use that. It's not great, because only 1 of our cameras is in that app.

Our RTSP cameras are set up like this in Home Assistant (Dahua and Sonoff):

type: custom:webrtc-camera
url: rtsp://cam:[email protected]:554/live

I've now tried go2rtc and I'm guessing it's the same, because of how Home Assistant proxies the network traffic from the cameras.

I want my wife to be able to open an app (or browser) and view all of our cameras nice and easily in one app. I have the following stuff to help:

  • Home Assistant
  • Unraid on a server (meaning I can spawn any VM or Docker container)
  • I'm a web developer, so creating a page with the streams on it is not a problem
  • I have a domain and can easily do proxying to that domain

What would you recommend? Obviously keeping it in Home Assistant would be the best, so we have everything in one place, but I honestly cannot figure out why her phone cannot view the streams, so I'm forced to find an alternative.

[Feature Request] Transposing/Rotation support for FFMPEG

As the title state, an easy way to rotate cameras would be amazing!

Thanks again for this cool tool!

EDIT:

Here is the solution for all those looking for this:

streams:
  rotate: ffmpeg:rtsp://...#raw=-vf transpose=1#video=h264

Be sure to use the right codec

THANK YOU

Man! You made my day!! Thank you so much. I open this issue to thank you! Camera integration, i think, the worst thing in Home Assistant. It should be solved within Core product but I think they are busy with blueth or icons. Your project work like a charm. Thank you very much. I had a problem with External Access and with your project I solved it without doing anything!

Finally, to help people who have Chinese IP cams, here is what I did.

  • Find your rtsp urls (Via ONVIF Manager or anything)
  • Add your cameras via Home Assistant Generic Camera Integration. Use your rtsp urls
  • Install go2rtc add on. Start it. Type 192.168.1.XX:1984 (XX is your raspberry IP no). Add your rtsp urls as stream
  • create go2rtc.yaml in your config folder. Add your streams to it. (I am not sure this step is necessary)
  streams:
      frontyard: <<rtsp link you found>>
      backyard: <<rtsp link you found>>
  • Go to your lovelace. Add picture entity or picture element card. Use your generic cameras

panic: runtime error: slice bounds out of range [:8192] with capacity 4096

Seeing these quite frequently. I didn't see these reported but if they have, please close as duplicate.

panic: runtime error: slice bounds out of range [:8192] with capacity 4096
goroutine 500 [running]:
bufio.(*Reader).ReadSlice(0x4000460ea0, 0xc?)
	bufio/bufio.go:346 +0x230
bufio.(*Reader).ReadLine(0x4000460ea0)
	bufio/bufio.go:400 +0x28
net/textproto.(*Reader).readLineSlice(0x400009fe20)
	net/textproto/reader.go:57 +0x7c
net/textproto.(*Reader).ReadLine(...)
	net/textproto/reader.go:38
github.com/AlexxIT/go2rtc/pkg/tcp.ReadRequest(0x4000460ea0)
	github.com/AlexxIT/go2rtc/pkg/tcp/textproto.go:115 +0x68
github.com/AlexxIT/go2rtc/pkg/rtsp.(*Conn).Handle(0x4000106f70)
	github.com/AlexxIT/go2rtc/pkg/rtsp/conn.go:628 +0x11c
github.com/AlexxIT/go2rtc/pkg/rtsp.(*Conn).Start(0x4000106f70)
	github.com/AlexxIT/go2rtc/pkg/rtsp/streamer.go:37 +0x9c
github.com/AlexxIT/go2rtc/cmd/streams.(*Producer).start.func1()
	github.com/AlexxIT/go2rtc/cmd/streams/producer.go:93 +0x34
created by github.com/AlexxIT/go2rtc/cmd/streams.(*Producer).start
	github.com/AlexxIT/go2rtc/cmd/streams/producer.go:92 +0x168

Panic: streams.(*Stream).RemoveConsumer

Hi, I am using Beta 11, and the software seems to crash after 20-22 hours of runnings and then needs to be restarted.

This is the error that is spammed when that happens;

2022/09/03 04:54:54 http: panic serving 192.168.0.15:47054: runtime error: invalid memory address or nil pointer dereference
Which is odd since the machine still has free ram

alpha 0.9 "add" button is not working

Hello
in HASS I've just upgraded to alpha 0.9 and all my cameras disappeared. Trying to add result in "add" button not working
Auto discovering not working also (Axis IPCam and Anran/Dahua)

[Feature Request] Card for Home Assistant

Hello AlexxIt,
i'm very pleased you are working oin this project. Is possible to add a card in Home Assistant that uses go2rtc as a source?
I didn't find any new card after installation. Should we use Glance card maybe? What's the address for various go2rtc stream to point at?
Thank you

Added streams in go2rtc.yaml not showing in go2rtc addons dashboard

Hi Alex
First of all I want to make it clear that I am using WebRTC without problems, but I have read that this addon will be a replacement in the future.
Likewise, I am not understanding the README well, how to configure or configure it, as I see instead with SonoffLAN (totally clear and complete)

I have 2 problems that I couldn't solve:

  1. I have added as statements in go2rtc.yaml the streams of my 2 rtsp cameras, but then they do not appear in the addon panel
    I did this because the camera key appears in the URL
  2. Can the listening port be changed? I have put it in the yaml but it keeps listening to the api in 1984

Thank you very much and I hope I am not being too "dumb" by these questions.

Regards

go2rtc.yaml (the indent are ok)

> streams:
>   comedor: 
>     - rtsp://xxxx:[email protected]:554
>   calle: 
>     - rtsp://xxxx:[email protected]:554
> 
> webrtc:
>   listen: ":8555"  # address of your local server (TCP)
>   candidates:
>     - stun:8555  # if you have dynamic public IP-address
> 
> api:
>   listen: "127.0.0.1:2000" # localhost
> 
> log:
>   rtsp: trace
> 

1234

A couple of questions

So I have it all set up and everything is working including external access by port forwarding (TCP 8555 port) and so I have a security question... is this safe and what are potential risks?

Now I read through the documents and found nothing on how I could access cameras via HTTP url. I had to find it in the posts from users in the Home Assistant forums.
http://IP:1984/webrtc.html?src=CAM <--- These urls should be documented or if it is then it's not apperent

Hass to go2rtc support

Last release we can now reference internal HASS entity_id feeds like this which is great (thank-you):

streams:
  "camera.kitchen_2": 
    - "{input}"
    - ffmpeg:{input}#audio=opus

This brings a bit of a confusion to the UI and documentation though. We can access that camera via the webrtc link in the UI (but only while its actually also being viewed in HASS):

https://xxxxx.org/go2rtc/webrtc.html?src=camera.kitchen_display

^ you can't do that before viewing that camera in HASS directly to initialize it within go2rtc. Which also means these won't work in HASS:

rtsp://xxxxx.org:8554/camera.kitchen_2

We get this:

18:56:48.532 DBG [rtsp] new consumer stream=camera.kitchen_2
18:56:48.637 WRN [streams] start error="malformed MIME header: missing colon: \"\\xb9G%i7\\x9c@\\x16\\xaa\\x9b\\x9e\\x95G^r\\ax\\xa1ϥji\\xb2\\xcd!\\x15f@|\\xfdȥ\\xe4\\x05vb\\xfd\\xa1Tt[,\"" 

I'm not sure if this is supposed to work. But my use case is I would like to expose these 'dynamic url' cameras or other integration cameras via entitiy_id in the go2rtc.yaml. Like this:

  "camera.kitchen_2":
    - "{input}"
    - ffmpeg:{input}#audio=opus
  kitchen_2_noaudio:
    - rtsp://127.0.0.1:8554/camera.kitchen_2?video

and also be able to reference those cameras as rtsp streams outside of HA..

The list of cameras disappears from the server

go2rtc is installed as docker container on my Linux server.
I use RTSPtoWebRTC and generic camera with RTSP stream to the server in HA.
And the Picture Entity card works fine with one laptop (Chrome, Win 10).
But if I open the camera card in the (official) mobile app of HA or on another laptop (Brave, Win 11), the list of cameras on the server disappears. As the result, I can't watch video on these devices.

I face the same problem if I try to view the camera from the server (webrtc link). MSE link works fine everywhere.

Log of webrtc (restart the container, try to open the card from the first laptop, and try to open the card from the second one):

s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
exit OK
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
14:41:58.468 INF [rtsp] listen addr=:8554
14:41:58.468 INF [api] listen addr=:1984
14:41:58.469 INF [webrtc] listen addr=:8555
14:42:18.781 TRC [rtsp] client request:
DESCRIBE rtsp://IP:8554/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
Require: www.onvif.org/ver20/backchannel
CSeq: 1


14:42:18.795 TRC [rtsp] client response:
RTSP/1.0 401 Unauthorized
Www-Authenticate: Digest realm="admin", nonce="40078a4a68047f67a31d1317fa57dc1c", stale="FALSE"
Cseq: 1
Date: Thu Aug 25 17:42:18 2022
Server: rtsp_demo


14:42:18.795 TRC [rtsp] client request:
DESCRIBE rtsp://IP:8554/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
Require: www.onvif.org/ver20/backchannel
CSeq: 2
Authorization: Digest username="user", realm="admin", nonce="40078a4a68047f67a31d1317fa57dc1c", uri="/Streaming/Channels/101", response="713e906ecf0439c518618132c82ecbc2"


14:42:18.806 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 2
Date: Thu Aug 25 17:42:18 2022
Content-Length: 502
Server: rtsp_demo
Content-Type: application/sdp

v=0
o=- 0 0 IN IP4 0.0.0.0
s=pps_rtsp
t=0 0
a=control:rtsp://IP:8554/Streaming/Channels/101
a=range:npt=0-
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;sprop-parameter-sets=J00AKOdAPAET8uApQUFBfAAAAwAEAAADAKLAgAEk+AAbd1//wKA=,KO48gA==
a=control:rtsp://IP:8554/Streaming/Channels/101/track1
m=audio 0 RTP/AVP 97
c=IN IP4 0.0.0.0
a=rtpmap:97 PCMU/8000/1
a=control:rtsp://IP:8554/Streaming/Channels/101/track2

14:42:18.807 TRC [rtsp] client request:
SETUP rtsp://IP:8554/Streaming/Channels/101/track2 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
CSeq: 3
Authorization: Digest username="user", realm="admin", nonce="40078a4a68047f67a31d1317fa57dc1c", uri="/Streaming/Channels/101/track2", response="8f228629d8d71b5422e23b10e516deb9"


14:42:18.816 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 3
Date: Thu Aug 25 17:42:18 2022
Session: 00000075
Transport: RTP/AVP/TCP;ssrc=2234569E;interleaved=2-3
Server: rtsp_demo


14:42:18.817 TRC [rtsp] client request:
SETUP rtsp://IP:8554/Streaming/Channels/101/track1 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
CSeq: 4
Authorization: Digest username="user", realm="admin", nonce="40078a4a68047f67a31d1317fa57dc1c", uri="/Streaming/Channels/101/track1", response="26c0e254d91cd24fc5dbfbe56bba4233"
Session: 00000075


14:42:18.857 TRC [rtsp] client response:
RTSP/1.0 200 OK
Date: Thu Aug 25 17:42:18 2022
Session: 00000075
Transport: RTP/AVP/TCP;ssrc=2234569F;interleaved=0-1
Server: rtsp_demo
Cseq: 4


14:42:18.857 TRC [rtsp] client request:
PLAY rtsp://IP:8554/Streaming/Channels/101 RTSP/1.0
Session: 00000075
CSeq: 5
Authorization: Digest username="user", realm="admin", nonce="40078a4a68047f67a31d1317fa57dc1c", uri="/Streaming/Channels/101", response="17cad323941b5e80d062c61d2967e419"


14:42:18.865 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 5
Date: Thu Aug 25 17:42:18 2022
Session: 00000075
Server: rtsp_demo


14:42:31.167 TRC [rtsp] client request:
TEARDOWN rtsp://IP:8554/Streaming/Channels/101 RTSP/1.0
CSeq: 6
Authorization: Digest username="user", realm="admin", nonce="40078a4a68047f67a31d1317fa57dc1c", uri="/Streaming/Channels/101", response="a03481aca819de2fb29c28098ec2a580"
Session: 00000075


14:42:31.801 TRC [rtsp] client request:
DESCRIBE rtsp://IP:8554/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
Require: www.onvif.org/ver20/backchannel
CSeq: 1


14:42:31.816 TRC [rtsp] client response:
RTSP/1.0 401 Unauthorized
Www-Authenticate: Digest realm="admin", nonce="40078a5768047f67a31d1317fa57dc01", stale="FALSE"
Cseq: 1
Date: Thu Aug 25 17:42:31 2022
Server: rtsp_demo


14:42:31.816 TRC [rtsp] client request:
DESCRIBE rtsp://IP:8554/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
Require: www.onvif.org/ver20/backchannel
CSeq: 2
Authorization: Digest username="user", realm="admin", nonce="40078a5768047f67a31d1317fa57dc01", uri="/Streaming/Channels/101", response="745b9e510bd65354122f9541d08c4503"


14:42:31.825 TRC [rtsp] client response:
RTSP/1.0 200 OK
Content-Type: application/sdp
Cseq: 2
Date: Thu Aug 25 17:42:31 2022
Server: rtsp_demo
Content-Length: 502

v=0
o=- 0 0 IN IP4 0.0.0.0
s=pps_rtsp
t=0 0
a=control:rtsp://IP:8554/Streaming/Channels/101
a=range:npt=0-
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;sprop-parameter-sets=J00AKOdAPAET8uApQUFBfAAAAwAEAAADAKLAgAEk+AAbd1//wKA=,KO48gA==
a=control:rtsp://IP:8554/Streaming/Channels/101/track1
m=audio 0 RTP/AVP 97
c=IN IP4 0.0.0.0
a=rtpmap:97 PCMU/8000/1
a=control:rtsp://IP:8554/Streaming/Channels/101/track2

14:42:31.825 TRC [rtsp] client request:
SETUP rtsp://IP:8554/Streaming/Channels/101/track2 RTSP/1.0
Authorization: Digest username="user", realm="admin", nonce="40078a5768047f67a31d1317fa57dc01", uri="/Streaming/Channels/101/track2", response="071b5a1ca51d55bcf9a680caaf2fa51e"
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
CSeq: 3


14:42:31.838 TRC [rtsp] client response:
RTSP/1.0 200 OK
Date: Thu Aug 25 17:42:31 2022
Session: 00000076
Transport: RTP/AVP/TCP;ssrc=223456A0;interleaved=2-3
Server: rtsp_demo
Cseq: 3


14:42:31.839 TRC [rtsp] client request:
SETUP rtsp://IP:8554/Streaming/Channels/101/track1 RTSP/1.0
Session: 00000076
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
CSeq: 4
Authorization: Digest username="user", realm="admin", nonce="40078a5768047f67a31d1317fa57dc01", uri="/Streaming/Channels/101/track1", response="c567a4143fd44afcc3cf6c7b8f9bef6d"


14:42:31.845 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 4
Date: Thu Aug 25 17:42:31 2022
Session: 00000076
Transport: RTP/AVP/TCP;ssrc=223456A1;interleaved=0-1
Server: rtsp_demo


14:42:31.846 TRC [rtsp] client request:
PLAY rtsp://IP:8554/Streaming/Channels/101 RTSP/1.0
CSeq: 5
Authorization: Digest username="user", realm="admin", nonce="40078a5768047f67a31d1317fa57dc01", uri="/Streaming/Channels/101", response="a102b83a2ec1cf9db51aa3ef9cf0300d"
Session: 00000076


14:42:31.855 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 5
Date: Thu Aug 25 17:42:31 2022
Session: 00000076
Server: rtsp_demo


2022/08/25 14:42:42 http: panic serving 192.168.1.152:50929: runtime error: invalid memory address or nil pointer dereference
goroutine 111 [running]:
net/http.(*conn).serve.func1()
	net/http/server.go:1825 +0xbf
panic({0x98a580, 0xe33460})
	runtime/panic.go:844 +0x258
encoding/json.(*encodeState).marshal.func1()
	encoding/json/encode.go:328 +0x6e
panic({0x98a580, 0xe33460})
	runtime/panic.go:838 +0x207
encoding/json.(*encodeState).marshal.func1()
	encoding/json/encode.go:328 +0x6e
panic({0x98a580, 0xe33460})
	runtime/panic.go:838 +0x207
github.com/AlexxIT/go2rtc/pkg/webrtc.(*Conn).remote(0x986960?)
	github.com/AlexxIT/go2rtc/pkg/webrtc/conn.go:133 +0xef
github.com/AlexxIT/go2rtc/pkg/webrtc.(*Conn).MarshalJSON(0xc000379ea0)
	github.com/AlexxIT/go2rtc/pkg/webrtc/streamer.go:113 +0x7f
encoding/json.marshalerEncoder(0xc000508680, {0x9ee840?, 0xc000379ea0?, 0x40?}, {0x20?, 0x8?})
	encoding/json/encode.go:479 +0xbe
encoding/json.(*encodeState).reflectValue(0x979000?, {0x9ee840?, 0xc000379ea0?, 0xc000229120?}, {0xb2?, 0xbd?})
	encoding/json/encode.go:360 +0x78
encoding/json.interfaceEncoder(0xc000508680, {0x979000?, 0xc0005e80f0?, 0xc0002291b8?}, {0x3d?, 0xbd?})
	encoding/json/encode.go:716 +0xc8
encoding/json.arrayEncoder.encode({0xc0002291c8?}, 0xc000508680, {0x957220?, 0xc00022d788?, 0xc000582000?}, {0x8?, 0x92?})
	encoding/json/encode.go:916 +0xb5
encoding/json.sliceEncoder.encode({0xc000206220?}, 0xc000508680, {0x957220?, 0xc00022d788?, 0x957220?}, {0x88?, 0x9?})
	encoding/json/encode.go:889 +0x2ca
encoding/json.(*encodeState).reflectValue(0x0?, {0x957220?, 0xc00022d788?, 0x40d627?}, {0x78?, 0x0?})
	encoding/json/encode.go:360 +0x78
encoding/json.(*encodeState).marshal(0x18?, {0x957220?, 0xc00022d788?}, {0x0?, 0x0?})
	encoding/json/encode.go:332 +0xfa
encoding/json.Marshal({0x957220, 0xc00022d788})
	encoding/json/encode.go:161 +0x45
github.com/AlexxIT/go2rtc/cmd/streams.(*Stream).MarshalJSON(0xc0001740c0)
	github.com/AlexxIT/go2rtc/cmd/streams/stream.go:156 +0x215
encoding/json.marshalerEncoder(0xc000508580, {0x9dd780?, 0xc0001740c0?, 0x0?}, {0x1?, 0x0?})
	encoding/json/encode.go:479 +0xbe
encoding/json.(*encodeState).reflectValue(0x979000?, {0x9dd780?, 0xc0001740c0?, 0xa65fb0?}, {0x58?, 0xd7?})
	encoding/json/encode.go:360 +0x78
encoding/json.interfaceEncoder(0xc000508580, {0x979000?, 0xc00054ea10?, 0xc000154a01?}, {0xd0?, 0xe9?})
	encoding/json/encode.go:716 +0xc8
encoding/json.mapEncoder.encode({0xc0002061d8?}, 0xc000508580, {0x986960?, 0xc000097bc0?, 0x986960?}, {0x0?, 0x30?})
	encoding/json/encode.go:814 +0x583
encoding/json.(*encodeState).reflectValue(0x0?, {0x986960?, 0xc000097bc0?, 0x40d627?}, {0x78?, 0x0?})
	encoding/json/encode.go:360 +0x78
encoding/json.(*encodeState).marshal(0x9d0780?, {0x986960?, 0xc000097bc0?}, {0x0?, 0x0?})
	encoding/json/encode.go:332 +0xfa
encoding/json.Marshal({0x986960, 0xc000097bc0})
	encoding/json/encode.go:161 +0x45
github.com/AlexxIT/go2rtc/cmd/api.streamsHandler({0xafce70, 0xc0000fa1c0}, 0xc000246200)
	github.com/AlexxIT/go2rtc/cmd/api/api.go:90 +0x171
net/http.HandlerFunc.ServeHTTP(0x7fb18c433b70?, {0xafce70?, 0xc0000fa1c0?}, 0x40d2c5?)
	net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0x0?, {0xafce70, 0xc0000fa1c0}, 0xc000246200)
	net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0xc0000971d0?}, {0xafce70, 0xc0000fa1c0}, 0xc000246200)
	net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc0000d8000, {0xafd228, 0xc000096600})
	net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
	net/http/server.go:3071 +0x4db
2022/08/25 14:42:42 http: panic serving 192.168.1.152:50930: runtime error: invalid memory address or nil pointer dereference
goroutine 146 [running]:
net/http.(*conn).serve.func1()
	net/http/server.go:1825 +0xbf
panic({0x98a580, 0xe33460})
	runtime/panic.go:844 +0x258
encoding/json.(*encodeState).marshal.func1()
	encoding/json/encode.go:328 +0x6e
panic({0x98a580, 0xe33460})
	runtime/panic.go:838 +0x207
encoding/json.(*encodeState).marshal.func1()
	encoding/json/encode.go:328 +0x6e
panic({0x98a580, 0xe33460})
	runtime/panic.go:838 +0x207
github.com/AlexxIT/go2rtc/pkg/webrtc.(*Conn).remote(0x986960?)
	github.com/AlexxIT/go2rtc/pkg/webrtc/conn.go:133 +0xef
github.com/AlexxIT/go2rtc/pkg/webrtc.(*Conn).MarshalJSON(0xc000379ea0)
	github.com/AlexxIT/go2rtc/pkg/webrtc/streamer.go:113 +0x7f
encoding/json.marshalerEncoder(0xc000202400, {0x9ee840?, 0xc000379ea0?, 0x40?}, {0x20?, 0x8?})
	encoding/json/encode.go:479 +0xbe
encoding/json.(*encodeState).reflectValue(0x979000?, {0x9ee840?, 0xc000379ea0?, 0xc000225120?}, {0xb2?, 0xbd?})
	encoding/json/encode.go:360 +0x78
encoding/json.interfaceEncoder(0xc000202400, {0x979000?, 0xc00052a010?, 0x403de9?}, {0x1b?, 0x6a?})
	encoding/json/encode.go:716 +0xc8
encoding/json.arrayEncoder.encode({0x41554cee9531983d?}, 0xc000202400, {0x957220?, 0xc00000c858?, 0x403bb2?}, {0xf0?, 0x51?})
	encoding/json/encode.go:916 +0xb5
encoding/json.sliceEncoder.encode({0xc000202400?}, 0xc000202400, {0x957220?, 0xc00000c858?, 0x957220?}, {0x0?, 0x1?})
	encoding/json/encode.go:889 +0x2ca
encoding/json.(*encodeState).reflectValue(0x0?, {0x957220?, 0xc00000c858?, 0x40d627?}, {0x78?, 0x0?})
	encoding/json/encode.go:360 +0x78
encoding/json.(*encodeState).marshal(0x18?, {0x957220?, 0xc00000c858?}, {0x0?, 0x0?})
	encoding/json/encode.go:332 +0xfa
encoding/json.Marshal({0x957220, 0xc00000c858})
	encoding/json/encode.go:161 +0x45
github.com/AlexxIT/go2rtc/cmd/streams.(*Stream).MarshalJSON(0xc0001740c0)
	github.com/AlexxIT/go2rtc/cmd/streams/stream.go:156 +0x215
encoding/json.marshalerEncoder(0xc000202280, {0x9dd780?, 0xc0001740c0?, 0x0?}, {0x1?, 0x0?})
	encoding/json/encode.go:479 +0xbe
encoding/json.(*encodeState).reflectValue(0x979000?, {0x9dd780?, 0xc0001740c0?, 0xa65fb0?}, {0x40?, 0xc8?})
	encoding/json/encode.go:360 +0x78
encoding/json.interfaceEncoder(0xc000202280, {0x979000?, 0xc000525f50?, 0x1?}, {0xe9?, 0x3d?})
	encoding/json/encode.go:716 +0xc8
encoding/json.mapEncoder.encode({0xc000202280?}, 0xc000202280, {0x986960?, 0xc00059a570?, 0x986960?}, {0x1c?, 0x0?})
	encoding/json/encode.go:814 +0x583
encoding/json.(*encodeState).reflectValue(0x0?, {0x986960?, 0xc00059a570?, 0x40d627?}, {0x78?, 0x0?})
	encoding/json/encode.go:360 +0x78
encoding/json.(*encodeState).marshal(0x9d0780?, {0x986960?, 0xc00059a570?}, {0x0?, 0x0?})
	encoding/json/encode.go:332 +0xfa
encoding/json.Marshal({0x986960, 0xc00059a570})
	encoding/json/encode.go:161 +0x45
github.com/AlexxIT/go2rtc/cmd/api.streamsHandler({0xafce70, 0xc0001f60e0}, 0xc000278100)
	github.com/AlexxIT/go2rtc/cmd/api/api.go:90 +0x171
net/http.HandlerFunc.ServeHTTP(0x7fb18c433b70?, {0xafce70?, 0xc0001f60e0?}, 0x40d2c5?)
	net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0x0?, {0xafce70, 0xc0001f60e0}, 0xc000278100)
	net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0xc00059a450?}, {0xafce70, 0xc0001f60e0}, 0xc000278100)
	net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc0000d80a0, {0xafd228, 0xc000096600})
	net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
	net/http/server.go:3071 +0x4db

Inbound audio as ffmpeg stream

I'm trying to implement 2-way audio for Eufy's Doorbells which support only P2P.
For that I would need to route the webrtc audio stream to an ffmpeg process that trancodes the audio and sends it to a tcp socket.

Is something like that possible with go2rtx?

Issues with casting and delay

Hi,

At this moment I am testing a Google Nest Hub for casting some dashboards.

Unfortunately, the streams doesn’t show anything except a black screen with a red banner with the text ‘Error with media stream’ for a few seconds.

With a browser such as Edge on Windows the stream is working with the default HA cards but with a delay of 2 seconds. The ‘old’ webRTC Camera integration doesn’t have this delay.

Home Assistant 2022.8.7
Supervisor 2022.08.3
Operating System 8.5
Frontend 20220802.0 - latest

go2RTC
Current version: 0.1-alpha.11

RTMP sources

I tried to add Frigate RTMP -cameras, however this doesn't work:
18:13:49.125 INF [streams] create new stream url=rtmp://192.168.1.142/live/Etuovi
2022/08/21 21:14:19 http: panic serving 172.30.32.2:51410: not implemented
goroutine 193 [running]:
net/http.(*conn).serve.func1()
net/http/server.go:1825 +0xbf
panic({0x960640, 0xaf73a0})
runtime/panic.go:844 +0x258
github.com/AlexxIT/go2rtc/pkg/rtmp.(*Client).Dial(0xc0000ca8c0)
github.com/AlexxIT/go2rtc/pkg/rtmp/client.go:73 +0x5ec
github.com/AlexxIT/go2rtc/cmd/rtmp.handle({0xc00043a095, 0x20})
github.com/AlexxIT/go2rtc/cmd/rtmp/rtmp.go:15 +0x65
github.com/AlexxIT/go2rtc/cmd/streams.GetProducer({0xc00043a095, 0x20})
github.com/AlexxIT/go2rtc/cmd/streams/handlers.go:31 +0x87
github.com/AlexxIT/go2rtc/cmd/streams.(*Producer).GetMedias(0xc000066480)
github.com/AlexxIT/go2rtc/cmd/streams/producer.go:31 +0x85
github.com/AlexxIT/go2rtc/cmd/streams.(*Stream).AddConsumer(0xc000556300, {0xafbfa0?, 0xc0000cb9d0})
github.com/AlexxIT/go2rtc/cmd/streams/stream.go:52 +0x305
github.com/AlexxIT/go2rtc/cmd/webrtc.offerHandler(0xc0000e1080, 0xc000642040)
github.com/AlexxIT/go2rtc/cmd/webrtc/webrtc.go:109 +0x428
github.com/AlexxIT/go2rtc/cmd/api.apiWS({0xafcc30, 0xc000512000}, 0xc000144600)
github.com/AlexxIT/go2rtc/cmd/api/api.go:129 +0x1bc
net/http.HandlerFunc.ServeHTTP(0x7fe63d2cefb8?, {0xafcc30?, 0xc000512000?}, 0x40d2c5?)
net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc00043a0cc?, {0xafcc30, 0xc000512000}, 0xc000144600)
net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0xc000556150?}, {0xafcc30, 0xc000512000}, 0xc000144600)
net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc0001920a0, {0xafcfe8, 0xc00001e150})
net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
net/http/server.go:3071 +0x4db

I also tried directly to one of my cameras using RTSP, this was fine. This was tested by using HASS, generic camera, webrtc.

RTSP Camera: wrong response on DESCRIBE

Windows version, camera: Laxihub M3-TY with root by guino.
rtsp: rtsp://user:pass@ip:8554/Streaming/Channels/101

Log:

06:14:16.752 INF [streams] create new stream url=rtsp://user:pass@ip:8554/Streaming/Channels/101
06:14:27.164 TRC [rtsp] client request:
DESCRIBE rtsp://192.168.1.119:8554/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
Require: www.onvif.org/ver20/backchannel
Cseq: 1


06:14:27.205 TRC [rtsp] client response:
RTSP/1.0 400 Bad Request
Date: Mon Aug 22 09:14:27 2022
Server: rtsp_demo


06:14:27.206 TRC [rtsp] client request:
DESCRIBE rtsp://192.168.1.119:8554/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
Cseq: 2


06:14:27.218 TRC [rtsp] client response:
RTSP/1.0 400 Bad Request
Date: Mon Aug 22 09:14:27 2022
Server: rtsp_demo


06:14:27.219 ERR [streams] probe producer error="wrong response on DESCRIBE" url=rtsp://user:[email protected]:8554/Streaming/Channels/101
06:14:27.223 TRC [rtsp] client request:
DESCRIBE rtsp://192.168.1.119:8554/Streaming/Channels/101 RTSP/1.0
Require: www.onvif.org/ver20/backchannel
Cseq: 1
Accept: application/sdp


06:14:27.260 TRC [rtsp] client response:
RTSP/1.0 400 Bad Request
Date: Mon Aug 22 09:14:27 2022
Server: rtsp_demo


06:14:27.262 TRC [rtsp] client request:
DESCRIBE rtsp://192.168.1.119:8554/Streaming/Channels/101 RTSP/1.0
Cseq: 2
Accept: application/sdp


06:14:27.278 TRC [rtsp] client response:
RTSP/1.0 400 Bad Request
Date: Mon Aug 22 09:14:27 2022
Server: rtsp_demo


06:14:27.279 ERR [streams] probe producer error="wrong response on DESCRIBE" url=rtsp://user:[email protected]:8554/Streaming/Channels/101

Support RTSP without codec

17:59:12.181 TRC [rtsp] client request:
DESCRIBE rtsp://192.168.3.28:554/ISAPI/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
Require: www.onvif.org/ver20/backchannel
CSeq: 1

17:59:12.230 TRC [rtsp] client response:
RTSP/1.0 401 Unauthorized
Cseq: 1
Www-Authenticate: xxx
Date: Mon, Sep 12 2022 20:59:11 GMT

17:59:12.230 TRC [rtsp] client request:
DESCRIBE rtsp://192.168.3.28:554/ISAPI/Streaming/Channels/101 RTSP/1.0
Accept: application/sdp
Require: www.onvif.org/ver20/backchannel
CSeq: 2
Authorization: xxx

17:59:12.252 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 2
Content-Length: 603
Content-Type: application/sdp
Content-Base: rtsp://192.168.3.28:554/ISAPI/Streaming/Channels/101/

v=0
o=- 1663016351058115 1663016351058115 IN IP4 192.168.3.28
s=Media Presentation
e=NONE
b=AS:5100
t=0 0
a=control:rtsp://192.168.3.28:554/ISAPI/Streaming/Channels/101/
m=video 0 RTP/AVP 96
b=AS:5000
a=control:rtsp://192.168.3.28:554/ISAPI/Streaming/Channels/101/trackID=1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=
m=audio 0 RTP/AVP 0
b=AS:50
a=control:rtsp://192.168.3.28:554/ISAPI/Streaming/Channels/101/trackID=2
a=rtpmap:0 PCMU/8000
a=Media_header:MEDIAINFO=494D4B48010100000400010010710110401F0000000;
a=appversion:1.0
17:59:12.252 TRC [streams] producer:0:0 candidate media="video, sendonly, 96 H264/90000"
17:59:12.252 TRC [streams] match producer:0:0 => consumer:0:0 codec="96 H264/90000"
17:59:12.252 TRC [rtsp] client request:
SETUP rtsp://192.168.3.28:554/ISAPI/Streaming/Channels/101/trackID=1 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
CSeq: 3
Authorization: xxx

17:59:12.258 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 3
Session: 232819480;timeout=60
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=38cc48a9;mode="play"
Date: Mon, Sep 12 2022 20:59:11 GMT

17:59:12.258 DBG [streams] start producer url=rtsp://admin:[email protected]:554/ISAPI/Streaming/Channels/101
17:59:12.258 DBG [streams] stop producer url=rtsp://admin:[email protected]:554/ISAPI/Streaming/Channels/101
17:59:12.258 TRC [rtsp] client request:
TEARDOWN rtsp://192.168.3.28:554/ISAPI/Streaming/Channels/101/ RTSP/1.0
CSeq: 4
Authorization: xxx
Session: 232819480

17:59:12.258 TRC [rtsp] client request:
PLAY rtsp://192.168.3.28:554/ISAPI/Streaming/Channels/101/ RTSP/1.0
CSeq: 5
Authorization: xxx
Session: 232819480

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x767437]
goroutine 75 [running]:
github.com/AlexxIT/go2rtc/pkg/tcp.(*Request).Write(0xa56100?, {0x0, 0x0})
	github.com/AlexxIT/go2rtc/pkg/tcp/textproto.go:108 +0x37
github.com/AlexxIT/go2rtc/pkg/rtsp.(*Conn).Request(0xc000108900, 0xc0001ed810)
	github.com/AlexxIT/go2rtc/pkg/rtsp/conn.go:171 +0x3fe
github.com/AlexxIT/go2rtc/pkg/rtsp.(*Conn).Play(...)
	github.com/AlexxIT/go2rtc/pkg/rtsp/conn.go:424
github.com/AlexxIT/go2rtc/pkg/rtsp.(*Conn).Start(0xc000108900)
	github.com/AlexxIT/go2rtc/pkg/rtsp/streamer.go:34 +0x71
created by github.com/AlexxIT/go2rtc/cmd/streams.(*Producer).start
	github.com/AlexxIT/go2rtc/cmd/streams/producer.go:82 +0x139
17:59:17.267 DBG [app] arch=amd64 conf_size=387 cwd=/config os=linux
17:59:17.268 INF [rtsp] listen addr=:8554
17:59:17.268 INF [api] listen addr=:1984
17:59:17.269 INF [webrtc] listen addr=:8555
17:59:17.269 INF [srtp] listen addr=:8443

basebath breaks ingress panel

When using something like this in the go2rtc config, the ingress panel in HA is broken for go2rtc. The basepath should be added to the panel.

api:
base_path: "/webrtc"

Docker install not using config file

Hey there,
Me again!

I ran this docker-compose file to get the docker to run:

version: '3.3'
services:
    go2rtc:
        volumes:
            - '/home/maxi1134/docker/go2rtc/go2rtc.yaml:/app/go2rtc.yaml'
        network_mode: host
        restart: always
        logging:
            options:
                max-size: 1m
        image: 'alexxit/go2rtc:latest'
        container_name: go2rtc

But it seems like the file is not picked up.

Could someone head me in the right direction? My go2rtc.yaml file looks like this:

streams:
  front_door_camera:
    - rtsp://user:[email protected]/h264Preview_01_main
    - rtsp://user:[email protected]/h264Preview_01_sub
  patio_camera:
    - rtmp://192.168.50.10:1935/livemain
  faceshot_camera:
    - rtsp://user:[email protected]:8554/12
  back_door_camera:
    - rtsp://192.168.50.1:8554/CH001.sdp

image

Stream Freezes and Skips Randomly on Home Assistant Companion App

On my local network on the Android and iOS home assistant companion app my stream freezes after a few seconds and I can’t get it to unfreeze without navigating away on the app. Sometimes it’ll freeze, then jump forward a bunch of seconds and freeze again. It works perfectly in my browser.

It only happens with WebRTC. RTMP, RTSP, and JSMpeg play without any issues.

Here’s my current config:

Camera → RTSP → Frigate → RTMP → Home Assistant. I have RTSPtoWebRTC pointing to go2rtc. My go2rtc.yaml is empty. I see the RTMP stream added automatically in the go2rtc UI when I start a stream.

I see the freezing issue with the Frigate Lovelace Card as well as the Picture Glace card.

Troubleshooting I’ve done:
If I remove go2rtc and RTSPtoWebRTC and add a generic camera with a direct RTSP from the camera it does not freeze.
If I add the RTMP stream from Frigate the stream does no freeze.
I tried using your older WebRTC plugin only and I get the same issue, stream freezes when it flips to WebRTC (I know it’s webrtc because I’ve verified in developer tools and the icon flipped to webrtc in the corner)

Additional testing. I have 3 types of Amcrest cameras and it seems like the issue is mainly happening on one model the ip4m-1051. Is there anything I can do to troubleshoot or resolve the issue?

Thanks.

Q: More Details on 2 Way Audio

Default Home Assistant lovelace cards don't support 2-way audio. You can use 2-way audio from Add-on Web UI. But you need use HTTPS to access the microphone. This is a browser restriction and cannot be avoided.

Can you please provide a configuration example of using 2 way audio in Home Assistant? Also clarification on the statement about needing https to access the microphone please?

I have several cameras that are 2 way audio capable but have not been able to use this feature. Looking forward to experimenting!

Thank you!

Beta 6 broken- panic slice bounds out of range

Latest beta 6 won't run at all. COnstant panics. Had to roll back.

2022/09/17 14:52:00 http: panic serving 127.0.0.1:37908: runtime error: slice bounds out of range [8:7]
goroutine 25 [running]:
net/http.(*conn).serve.func1()
	net/http/server.go:1825 +0xb8
panic({0x69af60, 0x4000036198})
	runtime/panic.go:844 +0x260
github.com/AlexxIT/go2rtc/cmd/hass.initAPI.func3({0x7dd5b0, 0x400007c620}, 0x4000032a00)
	github.com/AlexxIT/go2rtc/cmd/hass/api.go:57 +0x52c
net/http.HandlerFunc.ServeHTTP(0x72?, {0x7dd5b0?, 0x400007c620?}, 0x1cd20?)
	net/http/server.go:2084 +0x3c
net/http.(*ServeMux).ServeHTTP(0x0?, {0x7dd5b0, 0x400007c620}, 0x4000032a00)
	net/http/server.go:2462 +0x144
net/http.serverHandler.ServeHTTP({0x400007e600?}, {0x7dd5b0, 0x400007c620}, 0x4000032a00)
	net/http/server.go:2916 +0x408
net/http.(*conn).serve(0x400031cf00, {0x7ddc40, 0x400007e0c0})
	net/http/server.go:1966 +0x550
created by net/http.(*Server).Serve
	net/http/server.go:3071 +0x448

Docker network issue

I do understand that network_mode: host is needed for all those ports used for browser communication.
My docker-compose uses frigate hostname for frigate container. My home assistant - frigate integration, was configured to connect using docker internal network with 'frigate:5000' url. Home assistant is asking go2rtc for rtmp://frigate/live/wejscie but go2rtc do not know docker internal hostnames because of network_mode: host.

Additional info is that for public access I am using HA behind traefic https proxy with go2rtc using same hostname but with api: base_path: "/go2rtc"

  1. What is the best way to communicate those 3 (frigate, ha, go2rtc) using docker-compose
  2. Do I just need to reconfigure frigate ha integration to use 127.0.0.1:5000 || lan_ip:5000, and this will solve my issue ?
  3. Docs say that 2-way audio need https. This is needed only for go2rtc <--> browser or also between go2rtc <--> ha ? Docs use http in connection between go2rtc and ha.
  4. If I will use ha interface is this a way to go ? browser <-https-> ha < -http-> go2rtc . Or ha-go2rtc is only api for AV stream creation/status
  5. Will only https access via port forwarding and traefik to HA and go2rtc, be enough for 2way audio from internet ?

ffmpeg.go calls for video flag instead of audio - Beta 6

Go2RTC Beta 6

If using the following RTSP stream to scale a 4k camera to 1080p and copy the AAC audio track:

ffmpeg:rtsp://User:[email protected]:554/cam/realmonitor?channel=1&subtype=0#raw=-s hd1080#video=h264#audio=copy

The copy audio flag instead tries to copy the video. Line 123 of ffmpeg.go states the following instead of -codec:a copy:

			for _, audio := range query["audio"] {
				if audio == "copy" {
					s += " -codec:v copy"
				} else {
					s += " " + tpl[audio]
				}
			}

This causes the following error: "couldn't find the matching tracks"

Home assistant (Nest) stream into Frigate

I have my Nest cameras integrated into Home Assistant. The camera streams are available for me to view but I haven't found anywhere to get them into Frigate. The docs for this project kind of hint that I should be able to convert the HLS stream from HA into an RTSP stream but I haven't managed to make it work. Is this something that could work or am I misunderstanding the capabilities ?

I'm running HA and Frigate as containers in Docker. Thanks in advance for anyone's input.

There is no retry mechanism for timeouts

There is no retry mechanism for timeouts

I'm through FRP camera port public network, such as RTSP: / / 192.168.4.190:554 / ch01, the port 554 through the public network, and then to public server, link through the server, run for a few hours, if the network fluctuations, or FRP penetration is not stable, lead to broken links, Go2rtc, there is no way to re-link, can only restart GO2RTC

err log

�[36murl=�[0m"ffmpeg:rtsp://127.0.0.1:54189/ch0#channel=1#subtype=0#audio=opus#unicast=true#resolution=1280x720#video=vp9#raw=-vf transpose=2"
�[90m09:25:04.397�[0m �[1m�[31mERR�[0m�[0m [exec] timeout �[36murl=�[0m"exec:ffmpeg -hide_banner -allowed_media_types video+audio -fflags nobuffer -flags low_delay -rtsp_transport tcp -i rtsp://127.0.0.1:54189/ch0 -vf transpose=2 -codec:a libopus -ar 48000 -ac 2 -rtsp_transport tcp -f rtsp rtsp://localhost:8554/d40d0930ba209bfe3ee7a339de5253e4"

Ingress and webrtc connections not working on non-standard port.

I am running the latest beta: 0.1-beta.1

I've tried a few ways to connect from within home assistant through ingress. Each time it fails with similar messages in the supervisor logs:

ERROR (MainThread) [supervisor.api.ingress] Ingress error: 403, message='Invalid response status', url=URL('http://172.30.32.1:1984/api/ws?src=xxxx

and my go2rtc logs:

16:45:57.049 ERR [api.ws] upgrade error="websocket: request origin not allowed by Upgrader.CheckOrigin"
16:46:30.592 ERR [api.ws] upgrade error="websocket: request origin not allowed by Upgrader.CheckOrigin"

From within the UI it tells me 'bad gateway' not matter what (via ingress)

If I hit the URL directly, it works fine: http://ha.local:1984/

WebSocket is already in CLOSING or CLOSED state.

Hi there,

Thanks for the project!

When trying to use it (With the HA addon install) I get the following browser console error:

(anonymous) @ webrtc.html?url=rtsp%3A%2F%2Fadmin%3AJesus420%40192.168.0.210%2Fh264Preview_01_main:69

The addon logs show:

net/http.serverHandler.ServeHTTP({0xc0002f1ef0?}, {0xafcc30, 0xc00061e380}, 0xc0004c4e00)
	net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc000150000, {0xafcfe8, 0xc000202180})
	net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
	net/http/server.go:3071 +0x4db
2022/08/21 15:23:23 http: panic serving 172.30.32.2:54344: runtime error: invalid memory address or nil pointer dereference
goroutine 242 [running]:
net/http.(*conn).serve.func1()
	net/http/server.go:1825 +0xbf
panic({0x98a500, 0xe33400})
	runtime/panic.go:844 +0x258
github.com/AlexxIT/go2rtc/pkg/webrtc.(*Conn).AddTrack(0xc0000b8600?, 0xa3ce6b?, 0x0?)
	github.com/AlexxIT/go2rtc/pkg/webrtc/streamer.go:18 +0x29
github.com/AlexxIT/go2rtc/cmd/streams.(*Stream).AddConsumer(0xc0001b0d50, {0xafbfa0?, 0xc0000ca2a0})
	github.com/AlexxIT/go2rtc/cmd/streams/stream.go:66 +0x568
github.com/AlexxIT/go2rtc/cmd/webrtc.offerHandler(0xc000130840, 0xc0000cc280)
	github.com/AlexxIT/go2rtc/cmd/webrtc/webrtc.go:109 +0x428
github.com/AlexxIT/go2rtc/cmd/api.apiWS({0xafcc30, 0xc00021e0e0}, 0xc0004f0100)
	github.com/AlexxIT/go2rtc/cmd/api/api.go:129 +0x1bc
net/http.HandlerFunc.ServeHTTP(0x7f9b8672b568?, {0xafcc30?, 0xc00021e0e0?}, 0x40d2c5?)
	net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc0003be0fc?, {0xafcc30, 0xc00021e0e0}, 0xc0004f0100)
	net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0xc003b07f80?}, {0xafcc30, 0xc00021e0e0}, 0xc0004f0100)
	net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc00064a0a0, {0xafcfe8, 0xc000202180})
	net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
	net/http/server.go:3071 +0x4db
2022/08/21 15:25:49 http: panic serving 172.30.32.2:60590: runtime error: invalid memory address or nil pointer dereference
goroutine 218 [running]:
net/http.(*conn).serve.func1()
	net/http/server.go:1825 +0xbf
panic({0x98a500, 0xe33400})
	runtime/panic.go:844 +0x258
github.com/AlexxIT/go2rtc/pkg/mse.(*Consumer).AddTrack(0xc0000b8600?, 0xa3ce6b?, 0x0?)
	github.com/AlexxIT/go2rtc/pkg/mse/consumer.go:48 +0x29
github.com/AlexxIT/go2rtc/cmd/streams.(*Stream).AddConsumer(0xc0001b0d50, {0xafbf40?, 0xc0000ca2a0})
	github.com/AlexxIT/go2rtc/cmd/streams/stream.go:66 +0x568
github.com/AlexxIT/go2rtc/cmd/mse.handler(0xc000159d40, 0x94a220?)
	github.com/AlexxIT/go2rtc/cmd/mse/mse.go:31 +0x1ec
github.com/AlexxIT/go2rtc/cmd/api.apiWS({0xafcc30, 0xc00024e000}, 0xc00066cc00)
	github.com/AlexxIT/go2rtc/cmd/api/api.go:129 +0x1bc
net/http.HandlerFunc.ServeHTTP(0x7f9b8672b568?, {0xafcc30?, 0xc00024e000?}, 0x40d2c5?)
	net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc00044200c?, {0xafcc30, 0xc00024e000}, 0xc00066cc00)
	net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0xc000255680?}, {0xafcc30, 0xc00024e000}, 0xc00066cc00)
	net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc00044a5a0, {0xafcfe8, 0xc000202180})
	net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
	net/http/server.go:3071 +0x4db
2022/08/21 15:26:22 http: panic serving 172.30.32.2:54718: runtime error: invalid memory address or nil pointer dereference
goroutine 276 [running]:
net/http.(*conn).serve.func1()
	net/http/server.go:1825 +0xbf
panic({0x98a500, 0xe33400})
	runtime/panic.go:844 +0x258
github.com/AlexxIT/go2rtc/pkg/keyframe.(*Consumer).AddTrack(0xc000314260, 0xa3ce6b?, 0x0)
	github.com/AlexxIT/go2rtc/pkg/keyframe/consumer.go:30 +0x49
github.com/AlexxIT/go2rtc/cmd/streams.(*Stream).AddConsumer(0xc0001b0d50, {0xafbf10?, 0xc000314260})
	github.com/AlexxIT/go2rtc/cmd/streams/stream.go:66 +0x568
github.com/AlexxIT/go2rtc/cmd/api.frameHandler({0xafcc30, 0xc0001460e0}, 0xc00014e300)
	github.com/AlexxIT/go2rtc/cmd/api/keyframe.go:28 +0x1ef
net/http.HandlerFunc.ServeHTTP(0x7f9b8672b568?, {0xafcc30?, 0xc0001460e0?}, 0x40d2c5?)
	net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc003c56c73?, {0xafcc30, 0xc0001460e0}, 0xc00014e300)
	net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0xc0003cdd70?}, {0xafcc30, 0xc0001460e0}, 0xc00014e300)
	net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc00044a0a0, {0xafcfe8, 0xc000202180})
	net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
	net/http/server.go:3071 +0x4db
2022/08/21 15:26:29 http: panic serving 172.30.32.2:44780: runtime error: invalid memory address or nil pointer dereference
goroutine 169 [running]:
net/http.(*conn).serve.func1()
	net/http/server.go:1825 +0xbf
panic({0x98a500, 0xe33400})
	runtime/panic.go:844 +0x258
github.com/AlexxIT/go2rtc/pkg/webrtc.(*Conn).AddTrack(0xc0000b8600?, 0xa3ce6b?, 0x0?)
	github.com/AlexxIT/go2rtc/pkg/webrtc/streamer.go:18 +0x29
github.com/AlexxIT/go2rtc/cmd/streams.(*Stream).AddConsumer(0xc0001b0d50, {0xafbfa0?, 0xc0000ca2a0})
	github.com/AlexxIT/go2rtc/cmd/streams/stream.go:66 +0x568
github.com/AlexxIT/go2rtc/cmd/webrtc.offerHandler(0xc00058c680, 0xc0003142a0)
	github.com/AlexxIT/go2rtc/cmd/webrtc/webrtc.go:109 +0x428
github.com/AlexxIT/go2rtc/cmd/api.apiWS({0xafcc30, 0xc0001461c0}, 0xc0004f1d00)
	github.com/AlexxIT/go2rtc/cmd/api/api.go:129 +0x1bc
net/http.HandlerFunc.ServeHTTP(0x7f9b8672b568?, {0xafcc30?, 0xc0001461c0?}, 0x40d2c5?)
	net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc00044200c?, {0xafcc30, 0xc0001461c0}, 0xc0004f1d00)
	net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0xc0002e0540?}, {0xafcc30, 0xc0001461c0}, 0xc0004f1d00)
	net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc0000c01e0, {0xafcfe8, 0xc000202180})
	net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
	net/http/server.go:3071 +0x4db


Webpages/api need a microphone mute button

We desperately need a mute button on the webrtc.html pages. For anyone using 2-way audio, there is currently no way to actually stop your audio from being transmitted to the camera when viewing the feed. Ideally the mute should default to MUTED. This should only be for the outgoing audio.

There's been multiple occasions when I am talking to someone in my house and its accidentally being transmitted to the doobell camera. LOL Not good!

I tried to modify the javascript myself but I could NOT get it working.

go2rtc eventually crashes with INVALIDARGUMENT status when running as a service

~ $ sudo systemctl status go2rtc.service
● go2rtc.service - go2rtc
   Loaded: loaded (/etc/systemd/system/go2rtc.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2022-09-17 22:50:04 MSK; 34min ago
  Process: 383 ExecStart=/home/homeassistant/.homeassistant/go2rtc_linux_arm (code=exited, status=2)
 Main PID: 383 (code=exited, status=2)

Sep 17 22:50:04 hostname go2rtc_linux_arm[383]: github.com/AlexxIT/go2rtc/cmd/webrtc.ExchangeSDP.func1({0x607af0, 0xa6a740})
Sep 17 22:50:04 hostname go2rtc_linux_arm[383]:         github.com/AlexxIT/go2rtc/cmd/webrtc/webrtc.go:156 +0x68
Sep 17 22:50:04 hostname go2rtc_linux_arm[383]: github.com/AlexxIT/go2rtc/pkg/streamer.(*Element).Fire(0x360cd40, {0x607af0, 0xa6a740})
Sep 17 22:50:04 hostname go2rtc_linux_arm[383]:         github.com/AlexxIT/go2rtc/pkg/streamer/streamer.go:27 +0x4c
Sep 17 22:50:04 hostname go2rtc_linux_arm[383]: github.com/AlexxIT/go2rtc/pkg/webrtc.(*Conn).Init.func3(0x6)
Sep 17 22:50:04 hostname go2rtc_linux_arm[383]:         github.com/AlexxIT/go2rtc/pkg/webrtc/conn.go:75 +0x44
Sep 17 22:50:04 hostname go2rtc_linux_arm[383]: created by github.com/pion/webrtc/v3.(*PeerConnection).onConnectionStateChange
Sep 17 22:50:04 hostname go2rtc_linux_arm[383]:         github.com/pion/webrtc/[email protected]/peerconnection.go:492 +0x114
Sep 17 22:50:04 hostname systemd[1]: go2rtc.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Sep 17 22:50:04 hostname systemd[1]: go2rtc.service: Failed with result 'exit-code'.

Stale online connections

Hey there, thanks for this amazing project. Works perfect for me.
However I noticed that sometimes the go2rtc web interface shows an "online" connection to a camera from e.g. my mobiule phone's browser even though I closed that tab long time ago and even when put the fone in airplane mode.
It seems like this connection is "stale".

I wonder if there's a way to cope with this situation. Any ideas how I could further debug this?

Thanks!

Clarification with the Installation

Hello @AlexxIT ,

I am using WebRTC at the moment and it works seamlessly on my side. I wanted to try the go2rtc but encountered several issues as Im very new for this.

Since I am using the docker version, I have pulled the go2rtc and added the go2rtc.yaml file in config folder (Where the automations.yaml, configuration.yaml located). I have attached my go2rtc.yaml file for your reference. But, I couldnt encounter any stream options in my home assistant. Im clueless at this point. Could you further assist me in this project please? Willing to learn here.

Streams:
Camera1: rtsp://USER:[email protected]/Streaming/Channels/101

Panic while MJPEG processing

11:40:25.812 TRC [api] GET url=/api/stream.mjpeg?src=camera2
11:40:25.812 TRC [streams] consumer:1:0 candidate media="video, recvonly, 0 JPEG/0"
11:40:25.812 TRC [streams] producer:0:0 candidate media="video, sendonly, 26 JPEG/90000"
11:40:25.812 TRC [streams] match producer:0:0 => consumer:1:0 codec="26 JPEG/90000"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x5b9f8c]

goroutine 68 [running]:
bufio.(*Writer).Write(0xc000119940, {0xc00071c000, 0x0, 0xc0004f9a00})
        bufio/bufio.go:639 +0xec
net/http.(*response).write(0xc0000941c0, 0x15f9f, {0xc00071c000, 0x15f9f, 0x16000}, {0x0, 0x0})
        net/http/server.go:1593 +0x21e
net/http.(*response).Write(0x0, {0xc00071c000, 0x38, 0xc0000360b0})
        net/http/server.go:1551 +0x30
github.com/AlexxIT/go2rtc/cmd/mjpeg.handler.func1({0xa2a280, 0xc00000c030})
        github.com/AlexxIT/go2rtc/cmd/mjpeg/mjpeg.go:36 +0x1c3
github.com/AlexxIT/go2rtc/pkg/streamer.(*Element).Fire(0xc000706000, {0xa2a280, 0xc00000c030})
        github.com/AlexxIT/go2rtc/pkg/streamer/streamer.go:27 +0x47
github.com/AlexxIT/go2rtc/pkg/mjpeg.(*Consumer).AddTrack.func1(0xc000181810)
        github.com/AlexxIT/go2rtc/pkg/mjpeg/consumer.go:78 +0x44c
github.com/AlexxIT/go2rtc/pkg/streamer.(*Track).WriteRTP(0xc0003fd260, 0xc0003fd230)
        github.com/AlexxIT/go2rtc/pkg/streamer/track.go:28 +0xa4
github.com/AlexxIT/go2rtc/pkg/rtsp.(*Conn).Handle(0xc000308000)
        github.com/AlexxIT/go2rtc/pkg/rtsp/conn.go:664 +0x359
github.com/AlexxIT/go2rtc/cmd/rtsp.worker.func1({0xafd940, 0xc000280028})
        github.com/AlexxIT/go2rtc/cmd/rtsp/rtsp.go:181 +0x465
github.com/AlexxIT/go2rtc/pkg/streamer.(*Element).Fire(0x0, {0xafd940, 0xc000280028})
        github.com/AlexxIT/go2rtc/pkg/streamer/streamer.go:27 +0x47
github.com/AlexxIT/go2rtc/pkg/tcp.(*Server).Serve.func1()
        github.com/AlexxIT/go2rtc/pkg/tcp/server.go:28 +0x45
created by github.com/AlexxIT/go2rtc/pkg/tcp.(*Server).Serve
        github.com/AlexxIT/go2rtc/pkg/tcp/server.go:27 +0x29
    Last message repeated 3 timesge repeated 3 times
av_interleaved_write_frame(): Broken pipe
    Last message repeated 1 times
frame=18990 fps= 30 q=3.0 Lsize=N/A time=00:10:32.83 bitrate=N/A dup=9580 drop=0 speed=   1x
video:1624518kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

Tasks

Release 1.0

  • WebRTC Camera integration
  • RTSP with filters from Hass
  • Empty SPS for H265
  • Show version in UI

Later

  • Keyframe cache
  • HomeKit source reliability
  • Faster start for active connection #96
  • Check MSE/H265 stability in Safari
  • Nest API source
  • HTTP-MP4 source
  • Check fake H264 profile for devices, which do not support [email protected]
  • Remove RTSP login/pass from streams list
  • HLS
  • TelegramBot
  • Check RTSP with two audio to Hass
  • Check RTSP with two audio to Frigate
  • Two way audio in Hass card support
  • Hardware acceleration for MJPEG

Diagnostics

  • Server NAT type
  • Client NAT type
  • Supported codecs for MSE
  • Supported H265 for WebRTC
  • Open RTSP port
  • WebRTC connection type

Question: video freezes

Hello!

Are there any restrictions (from the go2rtc server, browsers, or other platforms) on continuous video viewing from the server?

I can view a continuous video for a minute or two. Then the video freezes. At the same time, the log is good.

Bug with macOS facetime camera

04:07:43.105 INF [api] listen addr=:1984
04:07:43.105 INF [rtsp] listen addr=:8554
2022/08/28 10:07:57 http: panic serving 192.168.1.23:56371: runtime error: slice bounds out of range [42:0]
goroutine 18 [running]:
net/http.(*conn).serve.func1()
	net/http/server.go:1802 +0xb9
panic({0x15bc680, 0xc00048b4d0})
	runtime/panic.go:1047 +0x266
github.com/AlexxIT/go2rtc/cmd/ffmpeg.loadMedias()
	github.com/AlexxIT/go2rtc/cmd/ffmpeg/device_darwin.go:53 +0x4bf
github.com/AlexxIT/go2rtc/cmd/ffmpeg.getDevice({0xc000060127, 0x15})
	github.com/AlexxIT/go2rtc/cmd/ffmpeg/devices.go:15 +0x47
github.com/AlexxIT/go2rtc/cmd/ffmpeg.Init.func1({0xc000060120, 0x54})
	github.com/AlexxIT/go2rtc/cmd/ffmpeg/ffmpeg.go:68 +0x168
github.com/AlexxIT/go2rtc/cmd/streams.GetProducer({0xc000060120, 0x54})
	github.com/AlexxIT/go2rtc/cmd/streams/handlers.go:34 +0x87
github.com/AlexxIT/go2rtc/cmd/streams.(*Producer).GetMedias(0xc000054480)
	github.com/AlexxIT/go2rtc/cmd/streams/producer.go:36 +0x105
github.com/AlexxIT/go2rtc/cmd/streams.(*Stream).AddConsumer(0xc000170090, {0x16b2e58, 0xc0002d6000})
	github.com/AlexxIT/go2rtc/cmd/streams/stream.go:54 +0x345
github.com/AlexxIT/go2rtc/cmd/webrtc.offerHandler(0xc00029c140, 0xc000296020)
	github.com/AlexxIT/go2rtc/cmd/webrtc/webrtc.go:109 +0x428
github.com/AlexxIT/go2rtc/cmd/api.apiWS({0x16b3ae8, 0xc0002aa0e0}, 0xc0002a4000)
	github.com/AlexxIT/go2rtc/cmd/api/api.go:120 +0x1bc
net/http.HandlerFunc.ServeHTTP(0x0, {0x16b3ae8, 0xc0002aa0e0}, 0x0)
	net/http/server.go:2047 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc0002a600c, {0x16b3ae8, 0xc0002aa0e0}, 0xc0002a4000)
	net/http/server.go:2425 +0x149
net/http.serverHandler.ServeHTTP({0xc000290090}, {0x16b3ae8, 0xc0002aa0e0}, 0xc0002a4000)
	net/http/server.go:2879 +0x43b
net/http.(*conn).serve(0xc000294000, {0x16b89c0, 0xc0000980c0})
	net/http/server.go:1930 +0xb08
created by net/http.(*Server).Serve
	net/http/server.go:3034 +0x4e8
2022/08/28 10:08:05 http: panic serving 192.168.1.23:56372: runtime error: slice bounds out of range [42:0]
goroutine 50 [running]:
net/http.(*conn).serve.func1()
	net/http/server.go:1802 +0xb9
panic({0x15bc680, 0xc000026828})
	runtime/panic.go:1047 +0x266
github.com/AlexxIT/go2rtc/cmd/ffmpeg.loadMedias()
	github.com/AlexxIT/go2rtc/cmd/ffmpeg/device_darwin.go:53 +0x4bf
github.com/AlexxIT/go2rtc/cmd/ffmpeg.getDevice({0xc000060127, 0x15})
	github.com/AlexxIT/go2rtc/cmd/ffmpeg/devices.go:15 +0x47
github.com/AlexxIT/go2rtc/cmd/ffmpeg.Init.func1({0xc000060120, 0x54})
	github.com/AlexxIT/go2rtc/cmd/ffmpeg/ffmpeg.go:68 +0x168
github.com/AlexxIT/go2rtc/cmd/streams.GetProducer({0xc000060120, 0x54})
	github.com/AlexxIT/go2rtc/cmd/streams/handlers.go:34 +0x87
github.com/AlexxIT/go2rtc/cmd/streams.(*Producer).GetMedias(0xc000054480)
	github.com/AlexxIT/go2rtc/cmd/streams/producer.go:36 +0x105
github.com/AlexxIT/go2rtc/cmd/streams.(*Stream).AddConsumer(0xc000170090, {0x16b2df8, 0xc00020a690})
	github.com/AlexxIT/go2rtc/cmd/streams/stream.go:54 +0x345
github.com/AlexxIT/go2rtc/cmd/mse.handler(0xc000192200, 0x151e960)
	github.com/AlexxIT/go2rtc/cmd/mse/mse.go:31 +0x1ec
github.com/AlexxIT/go2rtc/cmd/api.apiWS({0x16b3ae8, 0xc0001ac1c0}, 0xc0001c0100)
	github.com/AlexxIT/go2rtc/cmd/api/api.go:120 +0x1bc
net/http.HandlerFunc.ServeHTTP(0x0, {0x16b3ae8, 0xc0001ac1c0}, 0x0)
	net/http/server.go:2047 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc0001a403c, {0x16b3ae8, 0xc0001ac1c0}, 0xc0001c0100)
	net/http/server.go:2425 +0x149
net/http.serverHandler.ServeHTTP({0xc000182270}, {0x16b3ae8, 0xc0001ac1c0}, 0xc0001c0100)
	net/http/server.go:2879 +0x43b
net/http.(*conn).serve(0xc0001c2000, {0x16b89c0, 0xc0000980c0})
	net/http/server.go:1930 +0xb08
created by net/http.(*Server).Serve
	net/http/server.go:3034 +0x4e8

Failed to start WebRTC stream: Timeout handling WebRTC offer

I´ve setup the addon in a HAOS running in a PI 4 and I´m trying to view my camera in picture-entity in live mode, however I´m getting the following error: Failed to start WebRTC stream: Timeout handling WebRTC offer

The log of the addon follows:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
14:24:01.324 INF go2rtc linux/arm64
14:24:01.326 INF [api] listen addr=:1984
14:24:01.326 INF [rtsp] listen addr=:8554
14:24:25.959 INF [streams] create new stream url=rtsp://user:password@IP_ADDRESS:554/cam/realmonitor?channel=1&subtype=1
14:24:29.724 ERR [streams] probe producer error=EOF url=rtsp://user:password@IP_ADDRESS:554/cam/realmonitor?channel=1&subtype=1
14:24:33.723 ERR [streams] probe producer error=EOF url=rtsp://user:password@IP_ADDRESS:554/cam/realmonitor?channel=1&subtype=1
14:24:37.705 ERR [streams] probe producer error=EOF url=rtsp://user:password@IP_ADDRESS:554/cam/realmonitor?channel=1&subtype=1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.