zmc crashing and ffmpeg compile problems

Support and queries relating to all previous versions of ZoneMinder
Locked
JimNoble
Posts: 58
Joined: Thu Jul 29, 2004 12:12 am

zmc crashing and ffmpeg compile problems

Post by JimNoble »

I managed to fubar my FC4 machine slightly the other day, and to cut a long story short ended up upgrading over the top of FC4 with the Fedora 7 install disc I burnt the other day, in order to get it working again.

It's now more or less happy again, and up to date with all of the released f7 packages.

Unfortunately, this seems to have upset zm slightly - none of my monitors are currently working (source column all red, and broken image icons where the images should be).

I had to build xawtv from scratch as no rpm for f7 exists yet, but having done that I can see video from the analogue cameras just fine, so that's not the problem (and the 2 network cams don't work either).

Here's a snippet from /var/log/messages:

Jun 5 20:44:45 blackeye zmpkg[3440]: INF [Command: start]
Jun 5 20:44:47 blackeye zmdc[3459]: INF [Server starting at 07/06/05 20:44:47]
Jun 5 20:44:50 blackeye zmdc[3483]: INF ['zmc -m 6' started at 07/06/05 20:44:50]
Jun 5 20:44:50 blackeye zmdc[3459]: INF ['zmc -m 6' starting at 07/06/05 20:44:50, pid = 3483]
Jun 5 20:44:50 blackeye zmc_m6[3483]: INF [Debug Level = 0, Debug Log = <none>]
Jun 5 20:44:50 blackeye zmdc[3459]: INF ['zmc -m 6' died, signal 10]
Jun 5 20:44:50 blackeye zmdc[3459]: INF [Starting pending process, zmc -m 6]
Jun 5 20:44:50 blackeye zmdc[3487]: INF ['zmc -m 6' started at 07/06/05 20:44:50]
Jun 5 20:44:50 blackeye zmdc[3459]: INF ['zmc -m 6' starting at 07/06/05 20:44:50, pid = 3487]
Jun 5 20:44:50 blackeye zmc_m6[3487]: INF [Debug Level = 0, Debug Log = <none>]
Jun 5 20:44:50 blackeye zmdc[3459]: INF ['zmc -m 6' died, signal 10]
Jun 5 20:44:50 blackeye zmdc[3490]: INF ['zma -m 6' started at 07/06/05 20:44:50]
Jun 5 20:44:50 blackeye zmdc[3459]: INF ['zma -m 6' starting at 07/06/05 20:44:50, pid = 3490]
Jun 5 20:44:50 blackeye zma_m6[3490]: INF [Debug Level = 0, Debug Log = <none>]
Jun 5 20:44:50 blackeye zmdc[3459]: INF ['zma -m 6' died, signal 10]
Jun 5 20:44:50 blackeye zmdc[3459]: INF [Starting pending process, zma -m 6]
Jun 5 20:44:50 blackeye zmdc[3495]: INF ['zma -m 6' started at 07/06/05 20:44:50]
Jun 5 20:44:50 blackeye zmdc[3459]: INF ['zma -m 6' starting at 07/06/05 20:44:50, pid = 3495]
Jun 5 20:44:51 blackeye zma_m6[3495]: INF [Debug Level = 0, Debug Log = <none>]
Jun 5 20:44:51 blackeye zmdc[3459]: INF ['zma -m 6' died, signal 10]
Jun 5 20:44:51 blackeye zmdc[3497]: INF ['zmfilter.pl' started at 07/06/05 20:44:51]
Jun 5 20:44:51 blackeye zmdc[3459]: INF ['zmfilter.pl' starting at 07/06/05 20:44:51, pid = 3497]
Jun 5 20:44:51 blackeye zmdc[3502]: INF ['zmaudit.pl -c' started at 07/06/05 20:44:51]
Jun 5 20:44:51 blackeye zmdc[3459]: INF ['zmaudit.pl -c' starting at 07/06/05 20:44:51, pid = 3502]
Jun 5 20:44:51 blackeye zmfilter[3497]: INF [Scanning for events]
Jun 5 20:44:51 blackeye zmdc[3509]: INF ['zmwatch.pl' started at 07/06/05 20:44:51]
Jun 5 20:44:51 blackeye zmdc[3459]: INF ['zmwatch.pl' starting at 07/06/05 20:44:51, pid = 3509]
Jun 5 20:44:52 blackeye zmwatch[3509]: INF [Watchdog starting]
Jun 5 20:44:52 blackeye zmwatch[3509]: INF [Watchdog pausing for 30 seconds]
Jun 5 20:44:52 blackeye zmdc[3514]: INF ['zmupdate.pl -c' started at 07/06/05 20:44:52]
Jun 5 20:44:52 blackeye zmdc[3459]: INF ['zmupdate.pl -c' starting at 07/06/05 20:44:52, pid = 3514]
Jun 5 20:44:55 blackeye zmdc[3459]: INF [Starting pending process, zmc -m 6]
Jun 5 20:44:55 blackeye zmdc[3608]: INF ['zmc -m 6' started at 07/06/05 20:44:55]
Jun 5 20:44:55 blackeye zmdc[3459]: INF ['zmc -m 6' starting at 07/06/05 20:44:55, pid = 3608]
Jun 5 20:44:55 blackeye zmc_m6[3608]: INF [Debug Level = 0, Debug Log = <none>]
Jun 5 20:44:55 blackeye zmdc[3459]: INF ['zmc -m 6' died, signal 10]
Jun 5 20:44:56 blackeye zmdc[3459]: INF [Starting pending process, zma -m 6]
Jun 5 20:44:56 blackeye zmdc[3459]: INF ['zma -m 6' starting at 07/06/05 20:44:56, pid = 3610]
Jun 5 20:44:56 blackeye zmdc[3610]: INF ['zma -m 6' started at 07/06/05 20:44:56]
Jun 5 20:44:56 blackeye zma_m6[3610]: INF [Debug Level = 0, Debug Log = <none>]
Jun 5 20:44:56 blackeye zmdc[3459]: INF ['zma -m 6' died, signal 10]
Jun 5 20:45:09 blackeye zmpkg[3638]: INF [Command: status]
Jun 5 20:45:10 blackeye zmdc[3459]: INF [Starting pending process, zmc -m 6]
Jun 5 20:45:10 blackeye zmdc[3647]: INF ['zmc -m 6' started at 07/06/05 20:45:05]
Jun 5 20:45:10 blackeye zmdc[3459]: INF ['zmc -m 6' starting at 07/06/05 20:45:05, pid = 3647]
Jun 5 20:45:10 blackeye zmc_m6[3647]: INF [Debug Level = 0, Debug Log = <none>]
Jun 5 20:45:10 blackeye zmdc[3459]: INF ['zmc -m 6' died, signal 10]
Jun 5 20:45:11 blackeye zmdc[3459]: INF [Starting pending process, zma -m 6]
Jun 5 20:45:11 blackeye zmdc[3654]: INF ['zma -m 6' started at 07/06/05 20:45:06]
Jun 5 20:45:11 blackeye zmdc[3459]: INF ['zma -m 6' starting at 07/06/05 20:45:06, pid = 3654]
Jun 5 20:45:11 blackeye zma_m6[3654]: INF [Debug Level = 0, Debug Log = <none>]
Jun 5 20:45:11 blackeye zmdc[3459]: INF ['zma -m 6' died, signal 10]
Jun 5 20:45:22 blackeye zmwatch[3509]: ERR [Can't get shared memory id '7a6d2006', 6: No such file or directory]
Jun 5 20:45:22 blackeye zmwatch[3509]: INF [Restarting capture daemon for Garage_2, shared memory not valid]


The shared memory is not valid because there isn't any! (confirmed with 'ipcs -m' - no shared memory segments with the id '7a6d2006' exist). This is presumably because zmc isn't getting as far as creating them.

If I try and run 'zmc -d /dev/video0' (as user 'apache'), it segfaults.

Having failed to find the cause of that, I figured it would be a good opportunity to make the jump from 1.22.0 to 1.22.3, but I've hit that problem with the released ffmpeg rpms having been built with --enable-swscaler.

I've downloaded the ffmpeg (0.4.9-22.99_r8743) source, and compiled it without that option, but I'm still getting the img_convert related error when I try and build zm!

zm_mpeg.o: In function `VideoStream::EncodeFrame(unsigned char*, int, bool, unsigned int)':
ZoneMinder-1.22.3/src/zm_mpeg.cpp:310: undefined reference to `img_convert'
collect2: ld returned 1 exit status

'strings libavcodec.a' suggests the img_convert function is present, so I've no idea why it's still complaining about not finding it.

Any help and/or suggestions of what to check to fix either problem would be very much appreciated.

Jim
JimNoble
Posts: 58
Joined: Thu Jul 29, 2004 12:12 am

Post by JimNoble »

Ok, an update on the above problems. I've managed to get v 1.22.3 compiled and installed - seems I did not use "--enable-shared" when building ffmpeg 0.4.9 from the source rpm, so libavcodec.so wasn't being built (only libavcodec.a).

This is why Zoneminder was still complaining about img_convert not being present (as the .so was from the binary ffmpeg rpm which is built with --enable-swscaler thus removing the img_convert function).

So now zoneminder 1.22.3 is installed, but it still doesn't work :-(

I'll check the logs again and will post another update if anything has changed from before...

Jim
JimNoble
Posts: 58
Joined: Thu Jul 29, 2004 12:12 am

Post by JimNoble »

Wahey!

Got it working :D

1.22.3 initially failed to run because the zmupdate.pl didn't work. Thus I got errors due to missing columns in the mysql db (LinkedMonitors).

I think this is because I've not given mysql user 'zm' the alter privelege.

Having applied the updates from 1.22.0 manually one by one using a user that has alter access (I think I did it that way thinking it was more secure - hmm... :roll: ), zoneminder is running ok, and I'm now getting images from the cameras again :)

Mental note - never fiddle with a working system just before you go on holiday for 2 weeks :(

Jim
ryan
Posts: 3
Joined: Thu May 17, 2007 5:52 pm

Post by ryan »

Hey Jim,

I was wondering if you can shed some light on a similar problem that I am having. I was having some issue generating event videos using ffmpeg, so I decided to build ffmpeg from source and build zoneminder again. (system is Fedora Core 6.)

I built ffmpeg (SVN-r9414) from source with the --enable-shared option, and both the static and shared libraries are installed. I also had the issue with libs from the previously installed rpms still hanging around.

I am getting stuck building zoneminder at the linking stage. The output of make is below. Hopefully you can see something that I am missing here.

Code: Select all

[rbortolu@dvr ZoneMinder-1.22.3]$ make
make  all-recursive
make[1]: Entering directory `/home/rbortolu/zoneminder/ZoneMinder-1.22.3'
Making all in src
make[2]: Entering directory `/home/rbortolu/zoneminder/ZoneMinder-1.22.3/src'
g++  -g -O2  -L/usr/lib -L/usr/lib/mysql   -o zmc  zmc.o zm.o zm_db.o zm_config.o zm_coord.o zm_box.o zm_poly.o zm_image.o zm_event.o zm_zone.o zm_camera.o zm_local_camera.o zm_remote_camera.o zm_file_camera.o zm_monitor.o zm_user.o zm_mpeg.o zm_jpeg.o zm_regexp.o zm_signal.o zm_buffer.o zm_debug.o  -lavformat -lavcodec -lavutil -lpcre -lcrypto -lmysqlclient -ldl -lz -ljpeg
zm_mpeg.o: In function `VideoStream::EncodeFrame(unsigned char*, int, bool, unsigned int)':
/home/rbortolu/zoneminder/ZoneMinder-1.22.3/src/zm_mpeg.cpp:310: undefined reference to `img_convert(AVPicture*, int, AVPicture const*, int, int, int)'
/home/rbortolu/zoneminder/ZoneMinder-1.22.3/src/zm_mpeg.cpp:339: undefined reference to `avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)'
The symbols look like they are present in the shared library /usr/lib/libavcodec:

Code: Select all

objdump -T /usr/lib/libavcodec.so | grep img_convert
001506e0 g    DF .text  00000b8a  Base        img_convert
I suspect I am missing something in the linking stage or skipped something during the install of ffmpeg, but I can't seem to put my finger on it yet.

Thanks,
Ryan
JimNoble
Posts: 58
Joined: Thu Jul 29, 2004 12:12 am

Post by JimNoble »

I had a lot of trouble getting that error message to disappear. In the end I did a "yum remove" on ffmpeg (which took a lot of other dependent packages with it (including ffmpeg-devel...) - make a note of which ones so you can reinstall later!), installed the custom built ffmpeg, including the shared lib, then did I "make clean" in the zoneminder build area and started from scratch.

Then it worked.

Jim
ryan
Posts: 3
Joined: Thu May 17, 2007 5:52 pm

Post by ryan »

Well... I managed to fix my issue. Alter a bit of fiddling around trying to build some sample ffmpeg programs with the same errors, I started to suspect the ffmpeg version that I checked out of the SVN didn't like my machine setup.

I removed the SVN version of ffmpeg and then tried to build an older version (ffmpeg-0.4.9-0.35.20070204.lvn6.src.rpm) from the trusty Livna repository. (note: I actually built the source files rather than building the rpm and installing it.) Once the libraries and headers were installed again, I did a make clean; ./configure; make and ZoneMinder built like a charm. The ffmpeg samples I was working with earlier also compiled successfully.

This definitely isn't the correct way to fix the problem, but it works for me! Now to play with generating mpg's from events....
Locked