Illegal division by zero at /usr/bin/zmvideo.pl line 292.

Support and queries relating to all previous versions of ZoneMinder
Locked
madmax
Posts: 55
Joined: Fri Nov 07, 2003 8:49 pm

Illegal division by zero at /usr/bin/zmvideo.pl line 292.

Post by madmax »

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
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

There is a zmvideo.log file plus there will be an ffmpeg.log file in each event directory that has had video generated. There may be something in there that helps.
Phil
madmax
Posts: 55
Joined: Fri Nov 07, 2003 8:49 pm

Post by madmax »

Thanks.

I checked the ffmpeg.log file and it shows "Incorrect frame rate"

02/20/09 12:30:15.595455 zmfilter[6182].ERR [Video generation '/usr/bin/zmvideo.pl -e 7218 -r 1 -s 1 -f mov' failed with status: 255]


Any ideas why it would be picking up the wrong framerate?
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Try setting the rate to 20 or 25 and see what happens.
-r 25

Have you made any changes before this started?
madmax
Posts: 55
Joined: Fri Nov 07, 2003 8:49 pm

Post by madmax »

I have -r 25 in the config.

I do not recall making any changes. This is really strange. I'll keep digging.
madmax
Posts: 55
Joined: Fri Nov 07, 2003 8:49 pm

Post by madmax »

It looks like it was getting hung up trying to encode some old events. Not sure what I change at that time but I just flagged all the events (update events set videoed = 1;) and now new events are working. I'll cross my fingers for now. Thanks!
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Might run a test on the database just to make sure it is good.
satz
Posts: 3
Joined: Thu May 10, 2007 7:25 pm

Post by satz »

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:
203461 60 Normal 2009-03-10 16:40:06 599.98 0
So delta is 599.98. It looks like the code to extract the event in zmvideo.pl:

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";
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.

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 )
                {
This allows me to get mpeg files via ffmpeg now.
chika_nidza
Posts: 11
Joined: Mon Jan 26, 2009 10:02 am

Post by chika_nidza »

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):

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
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.
Locked