I was getting movies mailed to myself for months and all of the sudden they stopped.
When I execute: /usr/bin/zmvideo.pl -e 7220 -r 1 -s 1 -f mov
Any ideas? I'm using v1.23.3
Illegal division by zero at /usr/bin/zmvideo.pl line 292.
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
I was getting the same error in zmvideo.pl for a camera that I am recording 0.1 frames a second which is basically one frame every 10 seconds. The Frames entry in the database looks like:
This will get 0 for FullLength for the above event frame. I added code to zmvideo.pl so that if FullLength is zero to set it to 1.
This allows me to get mpeg files via ffmpeg now.
So delta is 599.98. It looks like the code to extract the event in zmvideo.pl:203461 60 Normal 2009-03-10 16:40:06 599.98 0
Code: Select all
my $sql = "select max(F.Delta)-min(F.Delta) as FullLength, E.*, unix_timestamp(E.StartTime) as Time, M.Name as MonitorName, M.Width as MonitorWidth, M.Height as MonitorHeight, M.Palette from Frames as F inner join Events as E on F.EventId = E.Id inner join Monitors as M on E.MonitorId = M.Id where EventId = '$event_id' group by F.EventId";
Code: Select all
*** /usr/bin/zmvideo.pl- 2008-09-24 02:45:58.000000000 -0600
--- /usr/bin/zmvideo.pl 2009-03-10 19:27:20.000000000 -0600
***************
*** 289,294 ****
--- 289,297 ----
}
elsif ( ZM_OPT_MPEG eq "ffmpeg" )
{
+ if ($event->{FullLength} == 0) {
+ $event->{FullLength} = 1;
+ }
my $frame_rate = sprintf( "%.2f", $event->{Frames}/$event->{FullLength} );
if ( $rate )
{
-
- Posts: 11
- Joined: Mon Jan 26, 2009 10:02 am
I am having the same problem. The thing is that for some events, there's only one frame inserted into the Frames table, so the max(F.Delta)-min(F.Delta) always gives 0 for them.
I solved the problem by replacing max(F.Delta)-min(F.Delta) by max(F.Delta):
This works fine for me, but I don't know if it will affect video generation in case the framerate isn't 25.
So does anyone know how come there's only one frame inserted for some videos, and why is FullLength calculated by substracting the deltas?
Thanks.
I solved the problem by replacing max(F.Delta)-min(F.Delta) by max(F.Delta):
Code: Select all
select max(F.Delta) as FullLength, E.*, unix_timestamp(E.StartTime) as Time, M.Name as MonitorName, M.Width as MonitorWidth, M.Height as MonitorHeight, M.Palette from Frames as F inner join Events as E on F.EventId = E.Id inner join Monitors as M on E.MonitorId = M.Id where EventId = '$event_id' group by F.EventId
So does anyone know how come there's only one frame inserted for some videos, and why is FullLength calculated by substracting the deltas?
Thanks.