Provide MP4 video in event?

Forum for questions and support relating to the 1.31.x releases only.
Locked
pyrodex
Posts: 7
Joined: Thu Apr 17, 2014 3:02 pm

Provide MP4 video in event?

Post by pyrodex »

Hello!

I recently rebuilt my ZM box into a VM and decided to go with the master PPA with 95% success. The only issue I am having at this time is getting event videos into email alerts.

I use the following EMAIL_BODY setting:

Code: Select all

Hello,

An alarm has been detected on your installation of the ZoneMinder.

The details are as follows :-

  Monitor  : %MN%
  Event Id : %EI%
  Length   : %EL%
  Frames  : 
    Number of frames in the event : %EF%
    Number of alarm frames in the event : %EFA% 
    Total score of the event : %EST%
    Average score of the event : %ESA%
    Maximum score of the event : %ESM%


This alarm was matched by the %FN% filter and can be viewed at %EPS%

ZoneMinder

%EIM%
%EV%
As you can see I have %EV% to attach the event video and the following filter is defined and working partially..
Screenshot 2018-08-03 08.06.34.png
Screenshot 2018-08-03 08.06.34.png (82.43 KiB) Viewed 5082 times
The email comes in but the video is messed up and no where near the size of the native MP4 ZM is recording. With the new h264 storage how can I just merely attach the perfectly fine MP4 ZM has recorded instead of trying to transcode or do anything funky to it?

Here is an event ZM recorded natively in MP4 - https://www.dropbox.com/s/hb1r1jurp4mz8 ... o.mp4?dl=0
Here is the event email video ZM provided in MP4 (Notice the cut off nature?) - https://www.dropbox.com/s/tu7u0yla42e5k ... 1.mp4?dl=0

Also here are my ZM FFMPEG settings:
Screenshot 2018-08-03 08.10.53.png
Screenshot 2018-08-03 08.10.53.png (163.95 KiB) Viewed 5081 times
Any thoughts?
jdiferio
Posts: 4
Joined: Sun Sep 02, 2018 2:30 am

Re: Provide MP4 video in event?

Post by jdiferio »

I'm pretty new to the forums but I've been using zoneminder since 1.24.3. Also I don't know perl very well, but I do have experience in other languages. I was having this same issue with 1.31.x and started digging a little. This is not a fix, but I've found a work around. It doesn't look like the zmfilter.pl generatevideo sub is fully converted to use only the mp4 storage, instead is relying on the .jpg files to be present to compile the video, so it's erroring out. I'm sure the developers have this on their very long list of things they are still working on, but until they get to that here is a WORK AROUND.
Edit zmfilter.pl (/usr/bin/zmfilter.pl in my case) and find the lines

Code: Select all

    if ( $text =~ s/%EV%//g ) {
      my ( $format, $path ) = generateVideo($filter, $Event);
      if ( !$format ) {
        return undef;
      }
      push( @$attachments_ref, { type=>"video/$format", path=>$path } );
    }
  
Should start on line 717 or around there depending on version. Change it to:

Code: Select all

    if ( $text =~ s/%EV%//g ) {
#      my ( $format, $path ) = generateVideo($filter, $Event);
#      if ( !$format ) {
#        return undef;
#      }
#      push( @$attachments_ref, { type=>"video/$format", path=>$path } );
      my $mp4_video_path =  sprintf('%s/%d-video.mp4', $Event->Path(), $Event->{Id});
      push( @$attachments_ref, { type=>"video/mp4", path=>$mp4_video_path } );
    }
You'll also want to uncheck "Create Video for All events" to prevent the error message.

I'm running zoneminder 1.31.45 on Ubuntu 18.04.01 installed via iconnor master arp repository (deb http://ppa.launchpad.net/iconnor/zonemi ... ter/ubuntu bionic main).

zmvideo.log

Code: Select all

09/06/2018 21:21:57.145098 zmvideo[9696].INF [ZoneMinder::Event:295] [Creating video file Camera01-_100541-r1-s1.mp4 for event 100541]
09/06/2018 21:21:58.061727 zmvideo[9696].ERR [ZoneMinder::Event:333] [Unable to generate video, check /usr/share/zoneminder/www/events/1/2018-09-06/100541/ffmpeg.log for details]
09/06/2018 21:21:58.064790 zmvideo[9696].WAR [main:226] [No video file generated for event 100541]
ffmpeg.log

Devs please let me know if you require any additional logs or configuration settings.
User avatar
iconnor
Posts: 2879
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Provide MP4 video in event?

Post by iconnor »

I have pushed this code to master.
pyrodex
Posts: 7
Joined: Thu Apr 17, 2014 3:02 pm

Re: Provide MP4 video in event?

Post by pyrodex »

iconnor wrote: Tue Sep 11, 2018 12:50 pm I have pushed this code to master.
THANKS!
Locked