openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.85k stars 3.56k forks source link

Simple RTSP support via Video Widget #10591

Open houshasen opened 3 years ago

houshasen commented 3 years ago

UPDATED to make request more clear (after learning a little bit more about OpenHAB).

Please support simple RTSP stream on Video Widget for Sitemap and Video Card on Layout Pages.

I would like to have URL field to take RTSP as a valid input and behind the scene all the necessary process is taken care of e.g. ipcamera instant creation for real time transcoding.

Your Environment

digitaldan commented 3 years ago

Have you seen the ipcamera binding which takes in a RTSP url and generates a stream that can be consumed by the video widget in the the UI?

https://www.openhab.org/addons/bindings/ipcamera/

houshasen commented 3 years ago

Have you seen the ipcamera binding which takes in a RTSP url and generates a stream that can be consumed by the video widget in the the UI?

https://www.openhab.org/addons/bindings/ipcamera/

Thank you for the quick reply. I have to be honest. I am really new to OpenHAB and currently playing phase with it. So this could well be due to my personal limitation but I did try the binding with Generic camera and got my UniFi Protect Camera recognized and got connected, but I can't seem to get the stream going.

The forum post like this: https://community.openhab.org/t/how-to-display-rtsp-streams-from-ip-cameras-in-openhab-and-habpanel-linux-only/69021 made me into believe this is not quite as simple binding.

I tried to basically enter full RTSP IP Address on the IP Camera rtsp://192.168.1.1:7447/ABCDEFGHJ then moved the port to port section. I keep getting error.

digitaldan commented 3 years ago

I have 6 Unifi camera streams that i use with that binding, there's no special configuration needed. You need to enable RTSP support in the unifi protect app for each camera, then use that url (something like rtsp://x.x.x.x:7447/KLASJDLKJLDSK) in the "FFmpeg Input" field in the UI, then link an item to the HLS stream channel, and use that item in your UI.

Good Luck.

houshasen commented 3 years ago

I have 6 Unifi camera streams that i use with that binding, there's no special configuration needed. You need to enable RTSP support in the unifi protect app for each camera, then use that url (something like rtsp://x.x.x.x:7447/KLASJDLKJLDSK) in the "FFmpeg Input" field in the UI, then link an item to the HLS stream channel, and use that item in your UI.

Good Luck.

Thank you for the information. After playing around further and reading more materials, I guess I figured out that Sitemap is a bit more legacy presentation layer. Also I didn't know the type of tiles offered on Overview interface differ based on cell size. I finally saw Video Card.

So my hope is still the same for a bit more easier access to video streaming. Perhaps make the Video Card to take RTSP feed as direct input option?

Thank you

Skinah commented 3 years ago

What your asking is very complicated and I don't know all the details so I'll give a short and long answer.

Short answer is I don't see it happening soon unless someone steps up to code it and it probably needs someone that has experience in this area. I do not and I only know a small amount of what is needed. I usually spend days reading up on the topic only to find out there are limitations which mean I am not interested anymore and it was a waste of time, feel free to do some reading on the topic to see what is possible, what limitations it has and also why everyone is not already doing it. HLS has become popular for a reason. Lastly I think you need to look at what webRTC is and what it offers and perhaps organize a bounty on that feature. However be aware that since it uses a random port it creates an issue when trying to do remote access. If you use a VPN to show up on your home network when remote, then it should be fine, otherwise HLS is based on HTTP and makes remote viewing much easier at the expense of a delay which for me is only 5-6 seconds. WebRTC I believe is around 0.5 second delay.

Longer answer:

RTSP is not a stream itself, but is more like a REMOTE CONTROL that can pause play rewind and send other commands to a RTP stream. It also describes where to get the stream from and what format the stream is in. The ipCamera binding has 80% of the coding done to unlock RTSP features, however what your really wanting is far more than just RTSP. So what can the RTSP alone do when/if completed? It can ease setup as the binding can know what format the audio and video is in, what streams the camera has, how many and what codec the stream is in etc. Since it really gives no benefits other than easier setup for non ONVIF cameras, it is not high on the todo list.

The RTSP will report a Stream in the format called RTP and that stream is usually encoded in h264 with the move now towards h265. Since the patents on h264 are going to start expiring in 2023 there is probably a reason why they are trying to move towards the newer h265 :)

So RTSP points to RTP and tells it to PLAY, then the RTP stream is encoded with a codec which h264 is most commonly used but not the only codec.

An even longer answer with information on what webRTC is can be found here: https://www.codeproject.com/Articles/800910/Broadcasting-of-a-Video-Stream-from-an-IP-camera-U

Note that down the very bottom of the article there is a section titled Why don’t we see WebRTC commonly used then? with the answer being A) royalties and B) browser support.

openhab-bot commented 2 years ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/poc-sip-client-in-mainui-for-door-intercom/133903/2

Skinah commented 1 year ago

Suggest this gets moved/closed due to this being the ADDONS repo and what the user is asking for is a widget (?) and would be best to be posted in the OPENHAB-WEBUI repo.