blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.26k stars 1.76k forks source link

FFMPEG to WebRTC #1824

Closed mitchross closed 1 year ago

mitchross commented 3 years ago

Thoughts on using this for live streaming? https://github.com/ashellunts/ffmpeg-to-webrtc

blakeblackshear commented 3 years ago

Ha! I literally bookmarked that from my google feed today. Definitely worth looking into.

mitchross commented 3 years ago

Ha! I literally bookmarked that from my google feed today. Definitely worth looking into.

I cant get the local example to work yet tho... trying still.... go is kinda goofy to quickstart.

mitchross commented 3 years ago

Having issues getting the github repo to work, opened a issue

Saw this in the HN comments, will try this too https://github.com/deepch/RTSPtoWSMP4f

milankragujevic 1 day ago [–]

I personally use this project to proxy IP camera RTSP stream via Web Sockets as fragmented MP4  https://github.com/deepch/RTSPtoWSMP4f I'm not affiliated with the project, it's just really performant and reliable.

mitchross commented 3 years ago

Ok I was able to get these sample to work.

https://github.com/deepch/RTSPtoWebRTC https://github.com/deepch/RTSPtoWSMP4f ( websocket mp4 )

The question I have is what is Frigate project most interested in? FFMPEG to WebRTC? RTSP to WebRTC? Something else?

mitchross commented 3 years ago

@blakeblackshear Check this out python implementation of webRTC https://github.com/aiortc/aiortc

I did end up getting the original ffmpeg-to-webrtc project working locally too.

pgenera commented 3 years ago

The question I have is what is Frigate project most interested in? FFMPEG to WebRTC? RTSP to WebRTC? Something else?

WebRTC with a fork of the lovelace component from https://github.com/AlexxIT/WebRTC in the home-assistant integration :)

blakeblackshear commented 3 years ago

I will have to spend some time digging into the options to form an opinion.

quenthal commented 3 years ago

WebRTC is cool, but I really hope RTMP sources are not forgotten - current solutions work only with RTSP. :)

allenporter commented 3 years ago

I recently added WebRTC support to the home assistant frontend with the motivation of supporting nest cameras. Perhaps that frontend webrtc stream card would be useful for others as well. (Its less mature than the one from AlexxIT though)

foxy82 commented 2 years ago

I'm really interested in this as Alexa can support WebRTC cameras (and audio) for displaying doorbells on Alexa Echo Shows / Alexa FireTV. A while ago I managed to hack something together with aiortc however it doesn't fully support the Alexa WebRTC request (https://github.com/aiortc/aiortc/issues/503).

From the recent Home Assistant release notes WebRTC has moved on even further since Oct 2021? I did briefly try the new RTSPtoWebRTC with but it didn't work straight away with Frigate.

If I can get a reliable WebRTC stream in Home Assistant I might be able to implement the doorbell - for the moment I'm playing with other media server options like Janus to see if I can get something working that way.

allenporter commented 2 years ago

One thing possibly stopping RTSPtoWebRTC integration from working w/ frigate home assistant integration is the rtmp:// url used by frigate does not match this prefix: https://github.com/home-assistant/core/blob/42e0bc849c2854de4aac23c187ac8551ef9d6b18/homeassistant/components/camera/__init__.py#L106 -- maybe see if it works if you change it.

trvrnrth commented 2 years ago

@allenporter I've just given that a whirl and monkey-patched it from a custom component on my install which works well for me as it seems that RTSPtoWebRTC now supports rtmp sources. I'd imagine this should work for everyone as my understanding is that in the case of frigate anyway the rtmp re-stream is a straight copy of the original camera rstp stream. It'd be great to get this into core if there aren't any other gotchas for other rtmp sources.

In case anyone else wants to test here's the custom component I whipped up:

DOMAIN = "monkey_patch"

from homeassistant.components import camera

def setup(hass, config):
    camera.RTSP_PREFIXES = {"rtsp://", "rtsps://", "rtmp://"}

    return True
allenporter commented 2 years ago

@trvrnrth awesome, that's great -- want to send a PR and i'll merge it?

trvrnrth commented 2 years ago

@allenporter I've just realised I linked out to the wrong repo in my comment (the similar names are confusing!). What I meant to say is that RTSPtoWeb supports rtmp sources. I suspect that RTSPtoWebRTC does not. I'm not sure if that would be a problem though as it is no longer recommended for installation. Are there plans to deprecate that addon?

allenporter commented 2 years ago

No plans, but i think its fine since we already recommend RTSPtoWeb. Folks in this space are already pretty comfortable dealing with caveats, unfortunately :)

trvrnrth commented 2 years ago

I've opened a HA Core PR with the change :)

NickM-27 commented 1 year ago

closing this as it has been added for 0.12