Page 1 of 1

rtsp2web - How does it work?

Posted: Sat Sep 07, 2024 9:02 pm
by Bluemax
Hi,
is there any documentation how to set up rtsp2web? I've compiled and installed rtsp2web but not sure what to do with it (it is not shipped with "zoneminder-dbg/jammy 1.37.63~20240906093428-jammy amd64" (iconnor/zoneminder-master) and the "demo:demo" url showing in the logs doesn't work (or connect to anything) out-of-the-box. There also is no new process/port listening).

Zoneminder somewhat reacts to my rtsp2ws server (Attempted to send to webroot:www@127.0.0.1:8080/stream/1/info and got Server returned nothing (no headers, no data)) but i don't know what i'm doing here.

Code: Select all

$ rtsp2ws -c /usr/local/share/rtsp2ws/keycert.pem rtsp://192.168.1.123/ISAPI/streaming/channels/101
Started on port:8080s webroot:www
[:0] sslize error: error:0A00009C:SSL routines::http request
[:0] sslize error: error:0A00009C:SSL routines::http request
[:0] sslize error: error:0A00009C:SSL routines::http request
[:0] sslize error: error:0A00009C:SSL routines::http request
[:0] sslize error: error:0A00009C:SSL routines::http request
Edit:
When i look at RTSPtoWeb there is a demo:demo account (that could be the pre-set url of Zoneminder). Application names might be mixed up here (rtsp2web<>RTSPtoWeb).

Re: rtsp2web - How does it work?

Posted: Tue Jan 28, 2025 1:05 pm
by IgorA100
I don't know what was meant in ZM as RTSP2Web, but I was able to run in test mode "RTSPtoWeb".
In "HLS" mode it works not so bad, more stable than Janus.
Probably it is necessary to use RTSPtoWeb and not RTSP2Web!

Re: rtsp2web - How does it work?

Posted: Tue Jan 28, 2025 3:29 pm
by IgorA100
Description of the complete installation process on Ubuntu:

Code: Select all

cd /usr/share
git clone https://github.com/deepch/RTSPtoWeb
On the page https://go.dev/dl/ we find the required option, for example https://go.dev/dl/go1.24.1.linux-amd64.tar.gz
and download:

Code: Select all

wget https://go.dev/dl/go1.24.1.linux-amd64.tar.gz
sudo tar -xvf go1.24.1.linux-amd64.tar.gz
rm go1.24.1.linux-amd64.tar.gz
export GOROOT=/usr/share/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
source ~/.profile
Check with the command:

Code: Select all

go version
Checking the work RTSPtoWeb

Code: Select all

cd RTSPtoWeb/
GO111MODULE=on go run *.go
After first executing this command, the necessary dependencies will be downloaded and RTSPtoWeb will be launched.
If everything went well, then create a daemon for automatic loading.

Code: Select all

cat > /etc/systemd/system/rtsptoweb.service
Insert code (You must specify your own paths!):

Code: Select all

[Unit]
Description=Service for RTSPtoWeb

[Service]
User=root
WorkingDirectory=/usr/share/RTSPtoWeb
ExecStart=/bin/bash -c 'cd /usr/share/RTSPtoWeb && GO111MODULE=on /usr/share/go/bin/go run *.go'
Restart=on-failure
RestartSec=10
TimeoutStopSec=30
Type=simple
SyslogIdentifier=RTSPtoWeb_service

[Install]
WantedBy=multi-user.target
Press Ctrl+C and the data will be saved in the file. Then execute the commands

Code: Select all

systemctl enable rtsptoweb.service
systemctl start rtsptoweb.service
Check:

Code: Select all

netstat -lnp | grep 8083

Re: rtsp2web - How does it work?

Posted: Sun Feb 02, 2025 7:44 pm
by IgorA100
For type=WebRTC use audio codec "G.711A"
For type=MSE use audio codec "AAC"

Re: rtsp2web - How does it work?

Posted: Tue Feb 25, 2025 9:05 am
by IgorA100

Re: rtsp2web - How does it work?

Posted: Fri Mar 07, 2025 4:03 pm
by IgorA100
Rules for Iptables:

Code: Select all

-A PREROUTING -p tcp --dport 8083 -j DNAT --to-destination LOCAL_IP_ZM:8083  --dst WAN_IP_GW
-A POSTROUTING -p tcp --dport 8083 -j SNAT --to-source LOCAL_IP_GW  --dst LOCAL_IP_ZM
-A OUTPUT -p tcp --dport 8083 -j DNAT --to-destination LOCAL_IP_ZM:8083  --dst WAN_IP_GW
-A INPUT -p tcp -m tcp --dport 8083 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 8083 -j ACCEPT
WAN_IP_GW - External IP of the gateway
LOCAL_IP_GW - Local IP of the gateway
LOCAL_IP_ZM - Local IP where ZM is installed

Re: rtsp2web - How does it work?

Posted: Mon Mar 10, 2025 9:05 pm
by baddog
Now that the latest version of firefox (version 137) supports h.265 natively (!), I'd like to get RTSP streaming working for my monitor viewing.

Can someone detail a bit more how to configure rtsptoweb to make this work with zoneminder?

First, I started up the rtsptoweb on my fedora server running zoneminder, and opened up port 8083 in the firewall. I'm able to connect to rtsptoweb at port 8083.

In zoneminder, under monitor->viewing I turned on "RTSP2Web Live Stream".
This change is apparently insufficient, as with this, live viewing still streams the monitor using built-in decoding.

Next, under options->system->RTSP2WEB_PATH, the documentation claims "This value points to the location of the RTSP2Web install, including username and password. If left blank, this will default to demo:demo@127.0.0.1:8083 port 8083."
But I found that in Monitor.php, the check for whether or not to attempt rtsp is based upon whether or not this value is set to something. So I set this to demo:demo@127.0.0.1:8083. At this point, I'm apparently closer to success as live streaming is no longer decoding this monitor, instead I see a blank window with playback controls but no video appearing.

What else do I need to do get this to work?

I can see from netstat (and tcpdump) that zoneminder is making a bunch of connections to port 8083. Yet rtsptoweb's trace level debugging is not showing me anything.

Re: rtsp2web - How does it work?

Posted: Tue Mar 11, 2025 7:25 am
by IgorA100
baddog wrote: Mon Mar 10, 2025 9:05 pm What else do I need to do get this to work?
Perhaps you need to write rules on the firewall. I wrote these rules above.
Are you on the same network as the ZM server?
Are you accessing the ZM server by IP address (white or gray) or by host name?

Re: rtsp2web - How does it work?

Posted: Tue Mar 11, 2025 3:34 pm
by baddog
IgorA100 wrote: Tue Mar 11, 2025 7:25 am
baddog wrote: Mon Mar 10, 2025 9:05 pm What else do I need to do get this to work?
Perhaps you need to write rules on the firewall. I wrote these rules above.
Are you on the same network as the ZM server?
Are you accessing the ZM server by IP address (white or gray) or by host name?
My zoneminder machine is a fedora server, so it's using firewalld. As I wrote, I did open up my firewall and test access to port 8083. Locally and over the LAN. I can document how one does this with firewalld if there is interest.
Yes, I'm on the same network as the zoneminder server, which I access via https by IP address.

Re: rtsp2web - How does it work?

Posted: Tue Mar 11, 2025 3:52 pm
by IgorA100
baddog wrote: Tue Mar 11, 2025 3:34 pm Yes, I'm on the same network as the zoneminder server, which I access via https by IP address.
Then everything is very strange...
Oh yeah... What type of RTSP2Web are you using? Type MSE definitely does not support h.265.
First try changing the stream on the camera to H264 to make sure that RTSP2Web works as part of ZM.

Re: rtsp2web - How does it work?

Posted: Sun Mar 16, 2025 12:16 am
by baddog
IgorA100 wrote: Tue Mar 11, 2025 3:52 pm Then everything is very strange...
Oh yeah... What type of RTSP2Web are you using? Type MSE definitely does not support h.265.
First try changing the stream on the camera to H264 to make sure that RTSP2Web works as part of ZM.
I was using the default, so webrtc. I tried all rtsp format choices with my h.265 hikvision camera, and only MSE produces some video, but even with that setting, only the left edge of the frame appears and the stream playback quickly stops. When I switch the camera to h.264, and use MSE, then rtsptoweb is able to stream the camera's video. However I don't want to capture video at that high data rate.

I see that homekit deprecated rtsptoweb and switched to go2rtc instead. I tried that and it's able to correctly stream my hikvision h.265 rtsp stream into firefox, with audio even. Horray. Maybe zoneminder can be changed to offer go2rtc as a viewing option.

Re: rtsp2web - How does it work?

Posted: Sun Mar 16, 2025 1:01 am
by baddog
Er, I meant homeassistant not homekit. Specifically:
https://community.home-assistant.io/t/a ... rtc/387846

Re: rtsp2web - How does it work?

Posted: Sun Mar 16, 2025 8:22 am
by IgorA100
baddog wrote: Sun Mar 16, 2025 12:16 am Maybe zoneminder can be changed to offer go2rtc as a viewing option.
Thanks for the interesting information.
I will definitely watch go2rtc

Re: rtsp2web - How does it work?

Posted: Wed Apr 09, 2025 9:18 pm
by IgorA100
Type WebRTC not working in Firefox !