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

Add go2rtc and add restream role / live source #4082

Merged
merged 107 commits into from
Nov 2, 2022

Conversation

NickM-27
Copy link
Sponsor Collaborator

@NickM-27 NickM-27 commented Oct 13, 2022

Adds go2rtc and enables the following:

  • restream role for a specific input
  • full res live view option
  • RTSP restream for frigate integration / other readers
  • potentially adds audio support for live view in frigate (depending on setup / camera)

To-Do:

  • Run go2rtc with S6
  • Setup go2rtc api with nginx
  • Get Add ability for API to set name of stream AlexxIT/go2rtc#76 merged so camera management can be simpler
  • Expose RTSP port
  • Add restream config tests
  • Add restream.py tests
  • Update docs around RTMP being deprecated
  • Update docs for new restream method and live view options
  • Look into why go2rtc can't see ffmpeg executable in path
  • Fix bug where switching between cameras does not refresh webRTC stream

frigate/config.py Outdated Show resolved Hide resolved
@spacebares
Copy link
Contributor

🙏

@blakeblackshear
Copy link
Owner

Just want to comment on some of what I am seeing in testing. There is no perceptible difference between connecting directly to the camera's RTSP, go2rtc's RTSP relay, and what is shown in the frigate WebUI with WebRTC. I stacked all 3 streams, lined up the timestamps, and I can't tell which is which. Pretty incredible.

Using MSE adds less than 1 second of latency for me. That seems pretty great for users unable to get everything working with WebRTC.

@blakeblackshear blakeblackshear merged commit d8123d2 into blakeblackshear:dev Nov 2, 2022
@NickM-27 NickM-27 deleted the include-go2rtc branch November 2, 2022 12:32
@spacebares
Copy link
Contributor

go2rtc has some reliability problems, would be nice to keep rtmp option available as backup.

@felipecrs
Copy link
Contributor

Hopefully by the time this gets released in Frigate the issues in go2rtc will have been fixed. I suppose you're talking about:

@NickM-27
Copy link
Sponsor Collaborator Author

NickM-27 commented Nov 3, 2022

go2rtc has some reliability problems, would be nice to keep rtmp option available as backup.

Rtmp is considered deprecated and will likely be removed in a future release

@maxi1134
Copy link

Hopefully by the time this gets released in Frigate the issues in go2rtc will have been fixed. I suppose you're talking about:

This has been fixed in "https://github.com/AlexxIT/go2rtc/releases/tag/v0.1-rc.1"

@NickM-27
Copy link
Sponsor Collaborator Author

Hopefully by the time this gets released in Frigate the issues in go2rtc will have been fixed. I suppose you're talking about:

This has been fixed in "https://github.com/AlexxIT/go2rtc/releases/tag/v0.1-rc.1"

Thanks, we've already updated the dependency in frigate to RC.3

@maxi1134
Copy link

Thanks, we've already updated the dependency in frigate to RC.3
Amzing!
Do we have an estimated release for this?

If not, is there any guide on how to compile the github on my end to try it out before release?

@NickM-27
Copy link
Sponsor Collaborator Author

There is no estimated beta timeframe. You're free to use the dev packages here on GitHub that are built on every commit to dev, but there's little documented and there may be bugs.

herostrat pushed a commit to herostrat/frigate that referenced this pull request Nov 24, 2022
* Pull go2rtc dependency

* Add go2rtc to local services and add to s6

* Add relay controller for go2rtc

* Add restream role

* Add restream role

* Add restream to nginx

* Add camera live source config

* Disable RTMP by default and use restream

* Use go2rtc for camera config

* Fix go2rtc move

* Start restream on frigate start

* Send restream to camera level

* Fix restream

* Make sure jsmpeg works as expected

* Make view rspect live size config

* Tweak player options to fit live view

* Adjust VideoPlayer to accept live option which disables irrelevant controls

* Add multiple options from restream live view

* Add base for webrtc option

* Setup specific restream modules

* Make mp4 the default streaming for now

* Expose 8554 for rtsp relay from go2rtc

* Formatting

* Update docs to suggest new restream method.

* Update docs to reflect restream role

* Update docs to reflect restream role

* Add webrtc player

* Improvements to webRTC

* Support webrtc

* Cleanup

* Adjust rtmp test and add restream test

* Fix tests

* Add restream tests

* Add live view docs and show different options

* Small docs tweak

* Support all stream types

* Update to beta 9 of go2rtc

* Formatting

* Make jsmpeg the default

* Support wss if made from https

* Support wss if made from https

* Use onEffect

* Set url outside onEffect

* Fix passed deps

* Update docs about required host mode

* Try memo instead

* Close websocket on changing camera

* Formatting

* Close pc connection

* Set video source to null on cleanup

* Use full path since go2rtc can't see PATH var

* Adjust audio codec to enable browser audio by default

* Cleanup stream creation

* Add restream tests

* Format tests

* Mock requests

* Adjust paths

* Move stream configs to restream

* Remove live source

* Remove live config

* Use live persistence for which view to use on each camera

* Fix live sizes

* Only use jsmpeg sizes for jsmpeg live

* Set max live size

* Remove access of live config

* Add selector for live view source in web view

* Remove RTMP from default list of roles

* Update docs

* Fix tests

* Fix docs for live view modes

* make default undefined to avoid race condition

* Wait until camera source is loaded to avoid race condition

* Fix tests

* Add config to go2rtc

* Work with config

* Set full path for config

* Set to use stun

* Check for mounted file

* Look for frigate-go2rtc

* Update docs to reflect webRTC configuration.

* Add link to go2rtc config

* Update docs to be more clear

* Update docs to be more clear

* Update format

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>

* Update live docs

* Improve bash startup script

* Add option to force audio compatibility

* Formatting

* Fix mapping

* Fix broken link

* Update go2rtc version

* Get go2rtc webui working

* Add support for mse

* Remove mp4 option

* Undo changes to video player

* Update docs for new live view options

* Make separate path for mse

* Remove unused

* Remove mp4 path

* Try to get go2rtc proxy working

* Try to get go2rtc proxy working

* Remove unused callback

* Allow websocket on restrea dashboard

* Make mse default stream option

* Fix mse sizing

* don't assume roles is defined

* Remove nginx mapping to go2rtc ui

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
@Arjenlodder
Copy link

I'm wondering, is it possible to use an existing go2rtc-install? Or does Frigate require it to be part of it's own system, maybe for performance-reasons?

@NickM-27
Copy link
Sponsor Collaborator Author

I'm wondering, is it possible to use an existing go2rtc-install? Or does Frigate require it to be part of it's own system, maybe for performance-reasons?

Frigate supports all go2rtc features in its embedded config at this point. If you want to use it with frigate live views and other features you'll need to use the embedded version.

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

Successfully merging this pull request may close these issues.

None yet

7 participants