Page 3 of 4

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Mon Dec 28, 2020 10:57 am
by trumee
@iconnor That is great news. Is 1.35 stable going to be released any time soon?

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Tue Dec 29, 2020 11:02 pm
by ernball
iconnor wrote:
Thu Dec 10, 2020 9:35 pm
Just a heads up, in 1.35.16 (just pushed to master) we now have a DecodingEnabled setting on each monitor that turns off the decoding. So this script may or may not be necessary anymore.
@iconnor
In record mode with analysis and decoding disabled, I get buffer errors "Buffer too small" etc. I can't increase the buffers to the requested size because they're too large (9GB for 4K cams@ 20fps). If fast, resource friendly recording is the goal of these two new options, disabling buffering altogether and writing the stream straight to disk is preferable, no? If not, the script is still the better option, here.

*** If you've upgraded to 1.35:
The script will fail to create proper filenames due to database column renaming. Replace instances of "StartTime" with "StartDateTime" and "EndTime" with "EndDateTime".

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Wed Dec 30, 2020 4:52 pm
by iconnor
reduced ram requirements is coming soon.

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Sun Mar 21, 2021 7:45 am
by bbarnett
Been playing with this script for a few days, and made some additions. It's a bit rough, but thought I'd post a diff regardless.

Changes:

- record audio on /off toggle
- 'linked monitor' id
- update Events row with 1 alarm frame, if an alarm happens on 'linked monitor'
- insert of 1 frame on start, so you can watch the event via the GUI
- bulk/etc frames inserted upon stream completion
- mysql auth/password in script
- upon start, name='New Event', which then changes to the desired event prefix upon completion

Why the alarm frames, and New Event change? The alarm frames help me with filters + deleting, as I want to keep alarm events longer. New Events text is something else I can filter against, to ensure I do not delete streaming events.

The 1 frame on start allows me to go into Events and start streaming a new event. For whatever reason, I needed this for it to work.

Not sure if further changes are forthcoming, although there is still some tidy up work to do.

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Sat Mar 27, 2021 6:48 am
by Cramac1
Hello. Something does not want to be added to my service. Or I misunderstood. How to enable for all cameras?

Code: Select all

# systemctl start zmrecord @ <MonitorID ..>. service
bash: MonitorID ..: No such file or directory
Or do you need each one separately?

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Tue Mar 30, 2021 9:35 pm
by bbarnett
A second diff. A minor fix.

Frames update/info wasn't done, if a linked camera wasn't provided. Now it is.

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Tue Mar 30, 2021 9:37 pm
by bbarnett
Cramac1 wrote:
Sat Mar 27, 2021 6:48 am
Hello. Something does not want to be added to my service. Or I misunderstood. How to enable for all cameras?

Code: Select all

# systemctl start zmrecord @ <MonitorID ..>. service
bash: MonitorID ..: No such file or directory
Or do you need each one separately?
The readme.txt shows how to do this. There are examples right at the end of the file.

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Sat Apr 03, 2021 6:11 am
by bbarnett
bbarnett wrote:
Tue Mar 30, 2021 9:35 pm
A second diff. A minor fix.

Frames update/info wasn't done, if a linked camera wasn't provided. Now it is.
Another small fix. Sometimes, I'd end up with a 0 prefacing the frame count remainder. This would get interpreted as octal.

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Wed Apr 07, 2021 8:18 am
by Cramac1
but did not think how to show an online picture?
tried ffmpeg

Code: Select all

ffmpeg -i "'.$cam.'" -b:v 2048k -crf 50  -f mpjpeg pipe:
but it loads the cpu

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Wed Apr 07, 2021 9:26 am
by bbarnett
You're not really reading, or at least understanding the documentation here. You might also be thinking this is for something other than it is for.

This might not be right for you.

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Wed Apr 07, 2021 2:43 pm
by Cramac1
bbarnett wrote:
Wed Apr 07, 2021 9:26 am
You're not really reading, or at least understanding the documentation here. You might also be thinking this is for something other than it is for.

This might not be right for you.
this is not a question for this script. If you run it, instead of zmс, access to online viewing of the picture from the camera is lost.
Or is it just me?

works view through https://video.site/zm/cgi-bin/nph-zms ?

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Thu Apr 08, 2021 9:19 pm
by xefil
Hello!
I'm trying to use this script on a zoneminder 1.35.21 setup. I've applied the patched from @bbarnett as well the correction mentioned by @ernball.
BTW I'm getting:

Code: Select all

TS: FPS: BW: FRAME:
ERROR 1366 (22007) at line 1: Incorrect decimal value: '' for column `zm`.`Monitor_Status`.`CaptureFPS` at row 1
Ideas?

Thanks!

Simon

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Fri Apr 09, 2021 11:06 am
by bbarnett
Sorry, I'm back on 1.23.

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Sat Apr 10, 2021 11:16 am
by xefil
Uh, far away from me. BTW Meanwhile I've noticed that my test cam has not audio, but looking to the vlc stream it seems to have it, so I've added it and now it works, at least in recording. BTW the events are correctly shown in the event view, but they are not shown in the console view.
The console view is not reporting even numbers and not the size as well. I'll look in the script if there are some failed queries.
So the linked monitor is not used correctly as well.
Meanwhile thanks for any suggestion.

Simon

Re: Record High-res H264 streams 24/7 with low CPU Load

Posted: Sat Apr 10, 2021 1:05 pm
by bbarnett
xefil wrote:
Sat Apr 10, 2021 11:16 am
Uh, far away from me. BTW Meanwhile I've noticed that my test cam has not audio, but looking to the vlc stream it seems to have it, so I've added it and now it works, at least in recording. BTW the events are correctly shown in the event view, but they are not shown in the console view.
The console view is not reporting even numbers and not the size as well. I'll look in the script if there are some failed queries.
So the linked monitor is not used correctly as well.
Meanwhile thanks for any suggestion.

Simon
Just to be clear.. there are three patches to apply, on top of the initial post.

There was another post about changes with mysql/a new version of ZM, so not sure on that. Also, you are running on the command line? It will help, and show potentially more info. Lastly, there is a debug switch, which I might have used or not (sorry)... and there may be some commented out echos for debugging...