Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Zoneminder Plugin - event videos corrupted or not properly created

keithg

Member
Joined
May 15, 2013
Messages
73
I have successfully loaded the ZM plugin, put my events directory on a separate volume and everything seems to work. Events are created and all owned by www. I can monitor 2 cameras and they appear to capture events and all, I get a jpg and an mp4 for each event.

If I go through the UI and select an event, the video will not play and the video has text stating that "The video could not be loaded, either because the server or network failed or because the format is not supported."

Further digging reveals that if I mount the volume and look at the event folder, and an mp4 is created in the event folder. I can view snapshot jpg fine, but when I try the video file it has 1) a very small size and 2) the tag ays that the video is 0 length. The file size is ~600 bytes. vlc will not play anything either. This is from an IP camera which is connected via rtsp or another one which is http. It is as if the install is missing some packages allowing a creation of a mpg4 file? Can anyone confirm that this plugin works for them or point me to what I am doing wrong?

I catted this to another post on adding cameras, but this is a different problem so I started a new thread.
 

keithg

Member
Joined
May 15, 2013
Messages
73
Just a reply to this...

Tried again by starting over. Installed the plugin. fixed the confiuration, created the folders, set the permissions according to this post:
fix CSS

added my cameras, and set to modect and waited for events.
Same as before. Snapshot.jpg is recorded correctly, but the video is a corrupt file of ~602 bytes.

As a side note, I created a regular jail and tried to install the pkg zoneminder and was unsuccessful. Also it is an older version and seemed a lot slower. I did not install the port, but could try that. I'd prefer that the plugin work. Am I doing something wrong? Is there a setting that needs to be changed?
 
D

dlavigne

Guest
If you do get a chance to experiment with installing the port to see if reproducible, that would help to diagnose if the issue is with the FreeBSD port itself or the plugin.
 

keithg

Member
Joined
May 15, 2013
Messages
73
I am currently in configuration hell. I have ZM installed and the current mysql57-client and server, nginx and php-fpm etc. I have copied over over some of the configuration files from the plugin jail and still am not there. PHP, nginx are running, but when I type in the IP address of my jail in Chrome or Firefox, it wants to download the file. I get a dialog which says:
You have chosen to open:
which is: application/octet-stream (8.6kb)
from:http://192.168.2.xx
Would you like to save the file?

How do I get any further? I did a pit of grepping and it seems that the /usr/local/etc/nginx/conf.d/zoneminder.conf file is not correct, but it is the same as what is in the plugin jail. as is the nginx.conf file.

Keith
 

keithg

Member
Joined
May 15, 2013
Messages
73
I was able to get further. If I log into the ip address/zm, I get the main page. I can add cameras, but they are all red and I get no picture. In the logs, I see this:
Code:
Memory map file '/tmp/zm.mmap.1' does not exist. zmc might not be running.


If I try running zmc ( references to this on the internet...) I get this:
Code:
# zmc
Shared object "libmysqlclient.so.18" not found, required by "zmc"


In the folder, I am at 20, so there is a revision conflict, it appears...
Code:
# ls -al /usr/local/lib/mysql/
total 21253
drwxr-xr-x   3 root  wheel        10 Jan  4 17:18 .
drwxr-xr-x  29 root  wheel       764 Jan  4 17:05 ..
lrwxr-xr-x   1 root  wheel        16 Jan  4 16:50 libmysqlclient_r.a -> libmysqlclient.a
lrwxr-xr-x   1 root  wheel        17 Jan  4 16:50 libmysqlclient_r.so -> libmysqlclient.so
lrwxr-xr-x   1 root  wheel        20 Jan  4 16:50 libmysqlclient_r.so.20 -> libmysqlclient.so.20
-rw-r--r--   1 root  wheel   4530264 Jan  4 16:50 libmysqlclient.a
lrwxr-xr-x   1 root  wheel        20 Jan  4 16:50 libmysqlclient.so -> libmysqlclient.so.20
-rwxr-xr-x   1 root  wheel   3876088 Jan  4 16:50 libmysqlclient.so.20
-rw-r--r--   1 root  wheel  45724130 Jan  4 17:17 libmysqld.a
drwxr-xr-x   2 root  wheel        50 Jan  4 17:18 plugin


To install this, I installed the zoneminder port. When I installed zoneminder, it said I needed mysql57 or greater, so I removed the mysql56-client and install mysql57-client and server. I am thinking I should blow this away and start over and stay with mysql56 regardless of the install instructions which pop up.

Thoughts?
 

keithg

Member
Joined
May 15, 2013
Messages
73
Well, I blew that jail away and started over.
Installed the port of Zoneminder. The instructions after the install finally ends is incorrect in one instruction. It says to install mysql57-server or later. The requirement should be for mysql56-serer. I tried installing 57 and it broke the install. With 56 it installs. I copied the /usr/local/nginx/conf.d directory as well as the nginx.conf file from the plugin jail , start zoneminder and get the same result: I can connect to the cameras. I can see the live images. I can detect motion and it saves a snapshot. I cannot, though, look at the mp4 file that is saved. All mp4s appear to be merely the container and have nothing inside. If I copy the files and look at them on my laptop, I see a perfect snapshot, but the mp4 file will not play.

DIgging a bit deeper, I am wondering if all the correct configurations of the packages are correct for mp4 creation. The port install asked for a lot of configurations and I added 'ffmpeg' for the configuration of the zoneminder port. It did install ffmpeg as well as libx264, but loking at the configuration of it, it looks like mp4 creation is not compiled in nor is it available as a configuration for this library.
Code:
===>  Configuring for libx264-0.155.2917
Unknown option --enable-asm, ignored
Unknown option --disable-debug, ignored
Unknown option --enable-opencl, ignored
platform:      X86_64
byte order:    little-endian
system:        FREEBSD
cli:           no
libx264:       internal
shared:        yes
static:        yes
asm:           yes
interlaced:    yes
avs:           no
lavf:          no
ffms:          no
mp4:           no
gpl:           yes
thread:        posix
opencl:        yes
filters:       crop select_every
lto:           no
debug:         no
gprof:         no
strip:         yes
PIC:           yes
bit depth:     all
chroma format: all


The configuration flags are:
Code:
                 ┌──────────────────────────── libx264-0.155.2917 ──────────────────────────────┐
                 │ ┌──────────────────────────────────────────────────────────────────────────┐ │ 
                 │ │ [x] ASM     Use optimized assembly code                                  │ │ 
                 │ │ [ ] DEBUG   Build with debugging support                                 │ │ 
                 │ │ [ ] GCC     Build with modern GCC (from ports)                           │ │ 
                 │ │ [x] OPENCL  Heterogeneous computing via OpenCL                           │ │ 
                 │ │ [ ] PGO     Use Profile-Guided Optimization                              │ │ 
                 │ └──────────────────────────────────────────────────────────────────────────┘ │ 
                 ├──────────────────────────────────────────────────────────────────────────────┤ 
                 │                       <  OK  >            <Cancel>                           │ 
                 └──────────────────────────────────────────────────────────────────────────────┘ 
 

keithg

Member
Joined
May 15, 2013
Messages
73
I noticed that when I tried to install libav that is complained about some security risks and would not install it. I forced the compile by 'make DISABLE_VULNERABILITIES=yes'

The note on install is:
Code:
===>  Installing for libav-12.3
===>  Checking if libav already installed
===>   Registering installation for libav-12.3
[zoneminder_jail] Installing libav-12.3...
===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/lib/libav/libavformat.so.57.7.2
/usr/local/lib/libav/libavformat.a(rtpproto.o)
/usr/local/lib/libav/libavformat.a(network.o)

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
http://www.libav.org


even after this and a restart of the jail, I still get corrupted mp4 files.
 

keithg

Member
Joined
May 15, 2013
Messages
73
Ran across a mention of fcgiwrap and proecsses. Currently set at -c 4 according to the instructions which follow installing the zoneminder port. Tried increasing it to 10 based on a thread on the zoneminder forums. Still no joy.

I did verify that I can use ffmpeg from the cli to create videos from the 2 cameras, so it appears that all dependencies and libraries for this are installed.
 

keithg

Member
Joined
May 15, 2013
Messages
73
The port maintainer claims this is a ZM code issue. Until this gets fixed with ZM, this plugin/port is useless for me .
 

28061

Member
Joined
Oct 13, 2014
Messages
120
Just a +1 to say I’m experiencing the same issues. Posts on ZM forums have not yet had any response - although only posted yesterday evening.

ZM Forum Link
 

keithg

Member
Joined
May 15, 2013
Messages
73
From the maintainer of the port, this is a known problem. It requires the ZM devs to get involved. They have not done anything, yet:
I posted here:
https://forums.zoneminder.com/viewtopic.php?f=38&t=27916&e=1&view=unread#unread
The port maintainer suggested this:
If your cameras are H.264 capable, it's better to set H.264 Camera Passthrough instead of X264 Encode in monitor settings (Storage tab).
In this way, original camera stream will be saved. Analysis works as well, so this mode is better as it doesn't require CPU resources to compress stream.
The UI is snappy (better than 1.30), I wish it worked. It records the snapshot, but no video. I was unable to get this to work, so I installed Shinobi.video in a jail. After a lot of work, I was able to get Shinobi to work. Will keep an eye on itm but not holding my breath.
 

rahul0291

Newbie
Joined
Mar 21, 2019
Messages
1
Has anyone figured out a solution to this problem yet?
 

28061

Member
Joined
Oct 13, 2014
Messages
120
Has anyone figured out a solution to this problem yet?
I gave up, and just ran it natively in Ubuntu. In fact, I've ditched all my FreeNas plugins and either ran them natively in ubuntu or in docker. I'm much happier with the new setup.
 

cygnus

Member
Joined
Mar 20, 2012
Messages
73
Hi All, sorry late to party but I had similar issue until I changed the Camera source - Storage Tab - Video Writer to H264 Camera Passthru and now events recording and play back fine..
 
Joined
Apr 8, 2012
Messages
124
Yeah I did, it doesnt seem to like if you put the storage for your cameras anywhere but /var/db/zoneminder/events so my solution was just to create a mountpoint on the jail pointing there playback etc works fine now for recorded events. Then set ownership to www:www and perms to 770. I am still trying to figure out why zmninja cant play the lives stream on the phone or windows app myself so if anyone has any clue let me know.

1569338742352.png
 
Top