Best Practice for linked channels from Android IP-webcam app?

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
wjr
Posts: 6
Joined: Sun Jan 05, 2020 9:13 am

Best Practice for linked channels from Android IP-webcam app?

Post by wjr »

Can we share experience about optimizing the setup of android devices as cams?

My goal is sth like e.g.
960 x 720 x 5 fps H.264 video stream for detection and permanent record
2560 x 1920 snapshots every 10s in alarm case from http://192.168.1.28:8080/photo.jpg

I plan to install a large number (10..20) of cams on my farm premises, so I have to keep resource use per cam to a minimum.
But large area => long distance => need good resolution to get details - in tradeoff for speed

I'm testing with IP Webcam by Pavel Khlebovich from Google playstore,
running on Samsung Galaxy Xcover 2 GT-S7710

After a night of fiddling, this is basically working:
zm-monitors.png
zm-monitors.png (38.99 KiB) Viewed 2713 times
"Cam foo bar" ans "szinocam" are dedicated IP-cams just to provide some test envirnonment and background system load

The last two monitors are from the android:
"ip-cam test" is source type ffmpeg from rtsp://192.168.1.28:8080/h264_ulaw.sdp
frame rate is set at 3 fps in the android app.
Storage JPEG disabled, Video writer: X264 Encode

"ip-cam image" is source type Remote from http://192.168.1.28:8080/photo.jpg
It is linked to "ip-cam test".
All FPS fields (Analysis, Maximum, Alarm Maximum) are set to 0.10 .
Storage is JPEG frames only, Video writer disabled.
Warmup frame, Pre Event Images, Post Event Images are all 0,
Alarm frame count is 1

(btw: is there a conscise way to list monitor configs - preferrably as plain text?)

It basically works, but with quite some quirks.
Details will come in seperate posts.

System details:
debian buster (10.2)
2:1.32.3-dmo4+deb10u2
Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz
8 GB RAM
tmpfs 4019312 1555272 2464040 39% /dev/shm
wjr
Posts: 6
Joined: Sun Jan 05, 2020 9:13 am

Re: Best Practice for linked channels from Android IP-webcam app?

Post by wjr »

What works:
  • watch both monitors from the android in the monitor view
  • detection, capturing, review, etc, as expected for the first 5 monitors listed - all H264 streams
  • link trigger for the ip-cam image monitor
  • capturing of jpegs in files like
    /var/cache/zoneminder/events/9/2020-01-05/1537/00005-capture.jpg
    I can see them there with e.g. sxiv via ssh X-forward
  • browsing of stills, thumbnail generation in the zm web gui
  • some frozen, broken video streams from the events (usual first frame of event, no black or empty screen)
Quirks so far:
  • at 0.1 fps , I have to generate events that are at least 10 s long before the link is triggered and an image is recorded
    shorter events at the master are ignored at the linked monitor
    severity: high
  • the jpg is read at the 0.1 fps all the time, even without alarm condition
    this way, in my test setup, this only monitor is using half of the network capacity, albeit only 1,2 % CPU for the zmc
    severity: critical - well, maybe Gbit networking may help
  • the generation of web stream from the jpegs is broken,
    monitor view window keeps reloading als the time
    I get errors in the log regarding sockets going away
    zms pid counting up all the time I keep the monitor open and autoreloading
    may be it is this issue viewtopic.php?t=20902
    I'll check and report
    severity: nasty, but I think solvable or at least workaround possible
    so I'll postpone that for the moment
  • when I try add pre/post event images, the link trigger seems to be broken
    severity: medium - would be low if link trigger did occur immediately
  • I tried to switch frame rate in alarm condition
    e.g "Alarm Maximum FPS = 0.2" and "Maximum FPS = 0.05",
    but did not see a consistent reproducible effect
  • when I set Monitor function to anything else than Nodect, the link trigger seems to be broken
    severity: low - it's more a matter of (missing) documentation
    so I stop complaining, since I don't want to get the job assigned :wink:
wjr
Posts: 6
Joined: Sun Jan 05, 2020 9:13 am

Re: Best Practice for linked channels from Android IP-webcam app?

Post by wjr »

I thought one way to solve all the issues might be to have a second stream with the hi-res-low-fps from the cam.
Maybe there is another android app out there?
Or I try to build something using a debian chroot for andoid and ffmpeg or so?

However, I tried to store X264 converted video in parallel to the jpegs, but those videos had double the size than the combined jpegs.

I also tried X264 storage alone (without the jpegs), but had lots of black / grey / blocked frames then.

I tried ffmpeg source type, but got no usable result.

I consider to trigger a script on the zm server to download the jpeg to server storage and use file source.

Or might a seperate ffmpeg do the job?
How could I integrate and configure this into zm?
Can I set individual ffmpeg options on a per monitor base?
wjr
Posts: 6
Joined: Sun Jan 05, 2020 9:13 am

Re: Best Practice for linked channels from Android IP-webcam app?

Post by wjr »

I tried to set up a file monitor, but does not work.

basically, what I get is

Code: Select all

2020-01-05 16:02:07	zmc_m10		28944	INF	Return from Capture (-1), signal loss	zm_monitor.cpp	2391
2020-01-05 16:02:07	zmc_m10		28944	ERR	Empty input file	zm_jpeg.cpp	40
2020-01-05 16:02:06	zmc_m10		28944	WAR	Premature end of JPEG file	zm_jpeg.cpp	64
2020-01-05 16:02:04	zmc_m10		28944	INF	Starting Capture version 1.32.3	zmc.cpp	223
Anytime I update the input file by wget from the android IP-Webcam, I get a new "ERR Empty input file" in the log.
I can read the file as "normal" terminal user and as www-data and successfully display it using sxiv.
So it is existing, readable, proper jpeg and found by zmc.
I tried reconverting with imagemagick - no difference.

Looking for possible causes, I found in
/usr/share/doc/zoneminder/README.Debian
Changing the location for images and events
-------------------------------------------
Zoneminder, in its upstream form, stores data in /usr/share/zoneminder/. This
package modifies that by changing /usr/share/zoneminder/images and
/usr/share/zoneminder/events to symlinks to directories under
/var/cache/zoneminder.
I tried this, but it neither solved my file monitor problem nor my jpeg event player.
Forgot to mention that I installed zm in jessie and did quite a long upgrade sequence.
I think I'll restart from scratch.
Just have to figure out whether I use debian sources or build myself.
wjr
Posts: 6
Joined: Sun Jan 05, 2020 9:13 am

Re: Best Practice for linked channels from Android IP-webcam app?

Post by wjr »

still one idea before - may it be due to the large file size?
when I reduce the file from 5 Mpixel to tiny 640 x 480, the error changes:
2020-01-05 16:30:58 zmc_m10 31173 INF Return from Capture (-1), signal loss zm_monitor.cpp 2391
2020-01-05 16:30:58 zmc_m10 31173 INF Failed to capture image from monitor 10 file-test (1/1) zmc.cpp 311
2020-01-05 16:30:58 zmc_m10 31173 ERR Held buffer is undersized for requested buffer zm_image.cpp 480
2020-01-05 16:30:57 zmc_m10 31173 ERR Failed requesting writeable buffer for reading JPEG image. zm_image.cpp 905
so it looks like a access problem?

well, here
viewtopic.php?t=22332#p85169
it was a question of jpeg format,
but I don't see anything wrong there.
wjr
Posts: 6
Joined: Sun Jan 05, 2020 9:13 am

Re: Best Practice for linked channels from Android IP-webcam app?

Post by wjr »

I checked the image size.
although the cam is set at 50....60 %, the image size is close to the uncompressed 100 % value.

Managed to pipe it through imagemagick converter:

Code: Select all

wget -O - http://192.168.1.28:8080/photo.jpg | convert '-[0]' -quality 70  photo.jpg
A quality level of 70 reduces size by 90 %, but is optically nearly invisible.

Get different error now, but still not working

Code: Select all

2020-01-05 17:57:15	zmdc		5349	INF	'zmc -m 11' started at 20/01/05 17:57:15	zmdc.pl	
2020-01-05 17:57:15	zma_m11		5348	ERR	Got empty memory map file size 0, is the zmc process for this monitor running?	zm_monitor.cpp	538
2020-01-05 17:57:15	zmdc		28729	ERR	'zma -m 11' exited abnormally, exit status 255	zmdc.pl	
2020-01-05 17:57:15	zmc_m11		5349	INF	Starting Capture version 1.32.3	zmc.cpp	223
2020-01-05 17:57:14	zma_m6		28769	INF	szsinocam hires: 35000 - Analysing at 5.00 fps	zm_monitor.cpp	1247
2020-01-05 17:57:14	zmwatch		28808	INF	Restarting capture daemon for filetest2, no image since startup. Startup time was 1578243424 - now 1578243434 > 5	zmwatch.pl	
:x :x :x
Post Reply