Delay issue in live stream

Forum for questions and support relating to the 1.30.x releases only.
Locked
francis3
Posts: 17
Joined: Wed Jan 16, 2019 8:30 am

Delay issue in live stream

Post by francis3 »

Hi all,
first post here!
Wanna say a HUGE "thank you" for the great work in this project.

I've just set up a ZoneMinder server grabbing two remote IP camera,
and I'm pretty happy with it.

The big annoyance in the current setup is a delay of about 10 seconds in the live stream view.

The setup:

** ZM cloud server:
KVM cloud server
cpu 2.0 Ghz
ram 2 GB
hdd 20 GB
Running Debian 9 stable with ZoneMinder 1.30.4

** 2 ip camera located behind a DSL line
IP cameras
2 Foscam C1 V3, with the last firmware
Video settings:
--
720p
512k bitrate
10 FPS
variable NO
--

The DSL line is managed by an OpenWrt router, and the connection to the ZM server is over an OpenVPN link.

The results of some network test:

**ZM stopped
*Ping test to one remote camera (wireless link) from the ZM server
root@zm:~# ping 192.168.1.251 -c5
PING 192.168.1.251 (192.168.1.251) 56(84) bytes of data.
64 bytes from 192.168.1.251: icmp_seq=1 ttl=63 time=31.6 ms
64 bytes from 192.168.1.251: icmp_seq=2 ttl=63 time=33.2 ms
64 bytes from 192.168.1.251: icmp_seq=3 ttl=63 time=32.8 ms
64 bytes from 192.168.1.251: icmp_seq=4 ttl=63 time=32.3 ms
64 bytes from 192.168.1.251: icmp_seq=5 ttl=63 time=31.3 ms

--- 192.168.1.251 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4002ms
rtt min/avg/max/mdev = 31.318/32.268/33.206/0.705 ms


*BandWidth test to the OpenWrt Router from ZM server
root@zm:~# bwm-ng -o plain -c 1
bwm-ng v0.6.1 (delay 0.500s); input: /proc/net/dev
iface Rx Tx Total
==============================================================================
eth0: 0.13 KB/s 1.86 KB/s 1.99 KB/s
lo: 0.00 KB/s 0.00 KB/s 0.00 KB/s
tun0: 0.00 KB/s 0.00 KB/s 0.00 KB/s
------------------------------------------------------------------------------
total: 0.13 KB/s 1.86 KB/s 1.99 KB/s


*Iperf3 test to the OpenWrt Router from ZM server
root@zm:~# iperf3 -c 192.168.1.1
Connecting to host 192.168.1.1, port 5201
[ 4] local 10.0.0.2 port 59710 connected to 192.168.1.1 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 1.52 MBytes 12.7 Mbits/sec 0 99.2 KBytes
[ 4] 1.00-2.00 sec 444 KBytes 3.64 Mbits/sec 9 1.32 KBytes
[ 4] 2.00-3.00 sec 0.00 Bytes 0.00 bits/sec 1 1.32 KBytes
[ 4] 3.00-4.00 sec 0.00 Bytes 0.00 bits/sec 1 1.32 KBytes
[ 4] 4.00-5.00 sec 0.00 Bytes 0.00 bits/sec 0 1.32 KBytes
[ 4] 5.00-6.00 sec 0.00 Bytes 0.00 bits/sec 1 1.32 KBytes
[ 4] 6.00-7.00 sec 0.00 Bytes 0.00 bits/sec 0 1.32 KBytes
[ 4] 7.00-8.00 sec 0.00 Bytes 0.00 bits/sec 0 1.32 KBytes
[ 4] 8.00-9.00 sec 0.00 Bytes 0.00 bits/sec 0 1.32 KBytes
[ 4] 9.00-10.00 sec 0.00 Bytes 0.00 bits/sec 0 1.32 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 1.95 MBytes 1.64 Mbits/sec 12 sender
[ 4] 0.00-10.00 sec 1.58 MBytes 1.32 Mbits/sec receiver

iperf Done.



**ZM running
*Ping test
root@zm:~# ping 192.168.1.251 -c5
PING 192.168.1.251 (192.168.1.251) 56(84) bytes of data.
64 bytes from 192.168.1.251: icmp_seq=1 ttl=63 time=2660 ms
64 bytes from 192.168.1.251: icmp_seq=2 ttl=63 time=2647 ms
64 bytes from 192.168.1.251: icmp_seq=3 ttl=63 time=2703 ms
64 bytes from 192.168.1.251: icmp_seq=4 ttl=63 time=2699 ms
64 bytes from 192.168.1.251: icmp_seq=5 ttl=63 time=1846 ms

--- 192.168.1.251 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4032ms
rtt min/avg/max/mdev = 1846.074/2511.434/2703.809/333.402 ms, pipe 3


*BandWidth test to the OpenWrt Router from ZM server
root@zm:~# bwm-ng -o plain -c 1
bwm-ng v0.6.1 (delay 0.500s); input: /proc/net/dev
iface Rx Tx Total
==============================================================================
eth0: 107.52 KB/s 7.32 KB/s 114.84 KB/s
lo: 0.00 KB/s 0.00 KB/s 0.00 KB/s
tun0: 101.61 KB/s 2.84 KB/s 104.45 KB/s
------------------------------------------------------------------------------
total: 209.12 KB/s 10.16 KB/s 219.29 KB/s


*Iperf3 test to the OpenWrt Router from ZM server
root@zm:~# iperf3 -c 192.168.1.1
Connecting to host 192.168.1.1, port 5201
[ 4] local 10.0.0.2 port 59706 connected to 192.168.1.1 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 39.7 KBytes 325 Kbits/sec 1 13.2 KBytes
[ 4] 1.00-2.00 sec 0.00 Bytes 0.00 bits/sec 0 13.2 KBytes
[ 4] 2.00-3.00 sec 27.8 KBytes 227 Kbits/sec 0 26.4 KBytes
[ 4] 3.00-4.00 sec 0.00 Bytes 0.00 bits/sec 0 26.4 KBytes
[ 4] 4.00-5.00 sec 0.00 Bytes 0.00 bits/sec 0 26.4 KBytes
[ 4] 5.00-6.00 sec 95.2 KBytes 780 Kbits/sec 0 39.7 KBytes
[ 4] 6.00-7.00 sec 0.00 Bytes 0.00 bits/sec 0 39.7 KBytes
[ 4] 7.00-8.00 sec 80.7 KBytes 661 Kbits/sec 0 58.2 KBytes
[ 4] 8.00-9.00 sec 127 KBytes 1.04 Mbits/sec 0 75.4 KBytes
[ 4] 9.00-10.00 sec 0.00 Bytes 0.00 bits/sec 0 75.4 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 370 KBytes 303 Kbits/sec 1 sender
[ 4] 0.00-10.00 sec 208 KBytes 170 Kbits/sec receiver

iperf Done.


Any suggestion to improve smoothness viewing events ad the delay in live stream?
I suspect the big problem is the slow DSL line, thinking about an upgrade to fiber line.


Regards,
francis3
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Delay issue in live stream

Post by bbunge »

Suggest setting up a server within your LAN. The "cloud server" seems a bit under powered especially if you have too high a resolution. Two GIG of RAM may not be enough especially if your camera resolution is higher than 640x480 at 5 FPS. Using a VPN to tunnel the camera traffic and recieve the video back to your LAN is not a great idea either. (Yes, you can run Zoneminder on a Raspberry Pi...one camera and maybe two) Remember half of your RAM is used for tmpfs and not available to the OS or database server.

I applaud your try! But get an old PC and use that for a server. Will work better...
francis3
Posts: 17
Joined: Wed Jan 16, 2019 8:30 am

Re: Delay issue in live stream

Post by francis3 »

Thank you for your answer!
The cloud server does not seems suffering too much, btw I can add more RAM.

--- ZM RUNNING
root@zm:~# free -m
total used free shared buff/cache available
Mem: 1972 392 149 419 1430 935
Swap: 0 0 0


--- ZM STOPPED
root@zm:~# free -m
total used free shared buff/cache available
Mem: 1972 276 616 67 1079 1402
Swap: 0 0 0


About traffic back and forth, I rarely connect to ZM from inside that LAN.
I was aware of possible problems in this setup, but indeed
I'm a little surprised by the smoothness of the setup. :-)

Anyway ... gonna think about a PC in the lan!



Many thanks,
francis3
francis3
Posts: 17
Joined: Wed Jan 16, 2019 8:30 am

Re: Delay issue in live stream

Post by francis3 »

Just for the record.

I've set up ip camera and ZM source tab for the monitors
to capture at:

640*480
5 FPS

and set
Maximum FPS at 5

Still a bit of delay in live stream, but rock solid setup.
Performance has dramatically improved, and the load an the ZM cloud server has dropped near 0.

I was skeptical about downgrading resolution but, for security purposes, as suggested, is perfectly fine!


Again thx,
francis3
Locked