Videos working, but not when filter generated

Support and queries relating to all previous versions of ZoneMinder
hvisser
Posts: 14
Joined: Thu Jan 17, 2008 8:32 pm

Post by hvisser »

I agree with you. After my last post, first thing I tried was to remove the > /tmp/ffmpeg.log from line 383 of zmvideo.pl

Now I don't get a zero byte file at /tmp/ffmpeg.log any more.

I then started looking at zmfilter.pl to see if there is some error in the way it calls zmvideo.pl, but I didn't try the extra debug option to see what

Code: Select all

 my $command = ZM_PATH_BIN."/zmvideo.pl -e ".$event->{Id}." -r ".$rate." -s ".$scale." -f ".$format;
realy looks like, but I think I'll try anyway.

It's kind of odd though that it only seems to happen when called from zmfilter.pl. Do you happen to know where it is called from when you generate the video from the monitor window?

I've now tried all formats (mpg,mpeg,wmv,avi) all with the same result. Now I could be lame and say it opens in Quicktime and Nero ShowTime, but I won't be happy unitil this is working the way it is supposed to. I know it was working in the 6.06.1 Bluecherry Livecd install, so I must get it to work in 7.04.

I also removed ffmpg and re-installed it with apt-get

Next, I'll be comparing the zm*.pl from the 6.06.1 install to see if there are any differences.

We might be covering the same ground, but I've found that two heads are always better than 1!
hvisser
Posts: 14
Joined: Thu Jan 17, 2008 8:32 pm

Post by hvisser »

zoneminder wrote:If you edit zm_funcs.php, find the createVideo function and add in a line

Code: Select all

error_log( $command );
before the exec line it will output the command to your web error log. You could then try running that command directly from a shell to see if you get the same size file.

Likewise, you can edit zmfilter.pl and search for zmvideo.pl in that file. Add a line afterwards thus

Code: Select all

Info( $command );
and save and restart. This will output the command into zmfilter.log.

It will be interesting to see if they are the same.
I followed the suggestions in the post above. I alos added

Code: Select all

Info( "ffmpeg command '$command'\n" ) 
to zmvideo.pl to see if ffmpeg gets called differently.

Here are the results.

WHEN VIDEO GENERATED BY FILTER

ZMFILTER.LOG

Code: Select all

01/19/08 10:23:19.779201 zmfilter[4661].INF [zmvideo.pl command '/usr/bin/zmvideo.pl -e 484 -r 1 -s 1 -f mpeg']
ZMVIDEO.LOG

Code: Select all

01/19/08 10:23:20.028185 zmvideo[4871].INF [Creating video file Event-484-r1-s1.mpeg for event 484]
01/19/08 10:23:20.028961 zmvideo[4871].INF [ffmpeg command '/usr/bin/ffmpeg -y -r 24.40  -i %03d-capture.jpg -s  352x288 -r 25 'Event-484-r1-s1.mpeg' > /tmp/ffmpeg.log']

WHEN VIDEO GENERATED FROM THE MONITOR PAGE:


APACHE ERROR.LOG

Code: Select all

[Sat Jan 19 16:17:37 2008] [error] [client 192.168.4.22] /usr/bin/zmvideo.pl -e 484 -f mpeg -r 1.00 -s 1.00, referer: http://192.168.4.1/zm/index.php?view=video&eid=484
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:  --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr 
  libavutil version: 0d.49.0.0
  libavcodec version: 0d.51.11.0
  libavformat version: 0d.50.5.0
  built on Jan 28 2007 22:48:38, gcc: 4.1.2 20070106 (prerelease) (Ubuntu 4.1.1-21ubuntu7)
Input #0, image2, from '%03d-capture.jpg':
  Duration: 00:00:05.0, start: 0.000000, bitrate: N/A
  Stream #0.0: Video: mjpeg, yuvj420p, 352x288, 24.40 fps(r)
Output #0, mpeg, to 'Event-484-r1-s1.mpeg':
  Stream #0.0: Video: mpeg1video, yuv420p, 352x288, q=2-31, 200 kb/s, 25.00 fps(c)
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=   59 q=29.0 size=     198kB time=2.3 bitrate= 699.1kbits/s    
frame=  121 q=20.9 size=     272kB time=4.8 bitrate= 464.2kbits/s    
frame=  124 q=29.6 Lsize=     276kB time=4.9 bitrate= 459.6kbits/s    
video:271kB audio:0kB global headers:0kB muxing overhead 1.887241%
ZMVIDEO.LOG

Code: Select all

01/19/08 16:17:37.510977 zmvideo[5711].INF [Creating video file Event-484-r1-s1.mpeg for event 484]
01/19/08 16:17:37.511732 zmvideo[5711].INF [ffmpeg command '/usr/bin/ffmpeg -y -r 24.40  -i %03d-capture.jpg -s  352x288 -r 25 'Event-484-r1-s1.mpeg' > /tmp/ffmpeg.log']
I noticed they call zmvideo slightly differently:
From filter:

Code: Select all

/usr/bin/zmvideo.pl -e 484 -r 1 -s 1 -f mpeg
From Monitor Window:

Code: Select all

/usr/bin/zmvideo.pl -e 484 -f mpeg -r 1.00 -s 1.00
but then when zmvideo.pl calls ffmpeg, it is called the same for both:

Code: Select all

/usr/bin/ffmpeg -y -r 24.40  -i %03d-capture.jpg -s  352x288 -r 25 'Event-484-r1-s1.mpeg' > /tmp/ffmpeg.log
The filter generated mpeg has the text

Code: Select all

Output #0, mpeg, to 'Event-484-r1-s1.mpeg':
  Stream #0.0: Video: mpeg1video, yuv420p, 352x288, q=2-31, 200 kb/s, 25.00 fps(c)
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
prepended at the start of the file, and that is what's causing it not to play in WMP and GOMplayer.
This text you will notice appear in the Apache error.log when generated from the monitor window.

Any suggestions, anyone?

PPS:

I've now also ran from the command line:
FILTER GENERATED command

Code: Select all

sudo -u www-data /usr/bin/zmvideo.pl -e 484 -r 1 -s 1 -f mpeg
and MONITOR MANUAL GENERATED command

Code: Select all

sudo -u www-data /usr/bin/zmvideo.pl -e 484 -f mpeg -r 1.00 -s 1.00
Both produced a valid working 'mpeg' file.
hvisser
Posts: 14
Joined: Thu Jan 17, 2008 8:32 pm

Post by hvisser »

I'm sorry to report that I have to admit defeat on this one.

Done a fresh install of Mandriva 2008 (with ZM 1.23.0 as well!) using the article from the Wiki and other articles I Googled and I've got a fully working install now.

Really bummed, because I had good motivation for using Ubuntu (new Ubuntu 7.04 Intranet Web Server at work!)
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Post by haus »

Nice! I'm waiting for Peter Howard's 1-23-2, I guess...I have to admit defeat as well because I don't have any more time to devote to troubleshooting it.

Thanks for all your ideas and postings, glad to know I wasn't alone in this. I may look at another distro too; I like Ubuntu because it's pretty easy, I've been using it now for a few months, and it has the easy server setup (no gui).

What I really want is the ability to FTP upload videos instead of zipped folders with stills, but that may be a way off. :)
hvisser
Posts: 14
Joined: Thu Jan 17, 2008 8:32 pm

Post by hvisser »

Well, if you really want Ubuntu and you're not too worried about being on that up to date, OS version wise, you could always have a look at the Bluecherry LiveCD (I found it with a Google search think it might have been on SourceForge).

It's based on Xubuntu 6.06.1 LTS (Ubuntu with XFCE) desktop, but you can change that to GNOME or KDE if you prefer by running the appropriate "aptitude install ..." command) and it's installable to hard drive. I know it works, because I've installed it on 3 different PC's (including this one), but I'm a bit OCD when it comes to having the latest version of OS and software (apart from Windows Vista, don't get me started on that one)

If you choose to go that route, it should be relatively easy to upload MPG to FTP by making a few amendments to zmfilter.pl (after backing up the original of course, just in case)

Although, that said, I have found Mandriva to be slightly faster than Ubuntu 6.06.1 and 7.04 so far.
Locked