Unable to export video

Forum for questions and support relating to the 1.24.x releases only.
Locked
limitlessent
Posts: 46
Joined: Wed Mar 18, 2009 8:38 am

Unable to export video

Post by limitlessent »

We have an incident I'm trying to export to .avi or mpeg or SOMETHING... and when I select the events and go to video to export it, I get "Video Generation Failed!" in red.

/var/log/httpd/error_log shows:
sh: ffmpeg.log: Permission denied
[Tue May 03 15:03:33 2011] [error] [client 192.168.0.110] Video Generation Failed, referer: http://192.168.0.204/index.php?view=vid ... enerated=0
[Tue May 03 15:03:33 2011] [error] [client 192.168.0.110] array (\n 0 => \n array (\n 'file' => '/usr/share/zoneminder/www/ajax/event.php',\n 'line' => 35,\n 'function' => 'ajaxError',\n 'args' => \n array (\n 0 => 'Video Generation Failed',\n ),\n ),\n 1 => \n array (\n 'file' => '/usr/share/zoneminder/www/index.php',\n 'line' => 127,\n 'args' => \n array (\n 0 => '/usr/share/zoneminder/www/ajax/event.php',\n ),\n 'function' => 'require_once',\n ),\n), referer: http://192.168.0.204/index.php?view=vid ... enerated=0
/var/log/zm.log shows nothing.

Any ideas?

I'm running 1.24.2 if that matters...
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Re: Unable to export video

Post by kevin_robson »

Try zmvideo.log in /tmp.
Unless this has been moved/changed for 1.24 (I'm running 1.23)
limitlessent
Posts: 46
Joined: Wed Mar 18, 2009 8:38 am

Re: Unable to export video

Post by limitlessent »

[root@zoneminder ~]# ls /tmp
ffmpeg.log zmdc.sock zms-300055w.sock zms-607188s.sock
test.sock zms-122858s.sock zms-356685w.sock zms-737974w.sock
ffmpeg.log is empty.
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Re: Unable to export video

Post by kevin_robson »

Maybe try running the zmvideo.pl (I think) script manually as root. Should be in /usr/local/bin, and you'll have to pass a couple of arguments.
Sorry, looks like a few things have changed from the version I'm using.
The other simple thing it could be is have you checked your config settings in zm for where ffmpeg is - then confirmed ffmpeg is there. Could be a wrong location i.e. /usr/bin/ffmpeg insteads of /usr/local/bin/ffmpeg - seen that before.
limitlessent
Posts: 46
Joined: Wed Mar 18, 2009 8:38 am

Re: Unable to export video

Post by limitlessent »

Ok... Running the following:
/usr/bin/zmvideo.pl -e 4569239 -r 1 -f avi
It drops down a line like it ran successfully...
But if I look at ffmpeg.log I see this:
FFmpeg version git-5f9cf8b, Copyright (c) 2000-2010 the FFmpeg developers
built on Aug 13 2010 07:26:33 with gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
configuration: --prefix=/usr --libdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --enable-libmp3lame --enable-nonfree --enable-libfaac --enable-libgsm --enable-postproc --enable-shared --enable-pthreads --enable-gpl --enable-swscale --enable-avfilter --enable-libxvid --enable-libx264 --enable-libvorbis
libavutil 50.23. 0 / 50.23. 0
libavcore 0. 3. 0 / 0. 3. 0
libavcodec 52.84. 3 / 52.84. 3
libavformat 52.78. 1 / 52.78. 1
libavdevice 52. 2. 1 / 52. 2. 1
libavfilter 1.31. 0 / 1.31. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
%08d-capture.jpg: No such file or directory
Any ideas?
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Re: Unable to export video

Post by kevin_robson »

Not really. Looking at the script its this bit that is generating the error. Looks like it isn't passing the correct filenames.
my $command = ZM_PATH_FFMPEG." -y -r $frame_rate ".ZM_FFMPEG_INPUT_OPTIONS." -i %0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg -s $video_size ".ZM_FFMPEG_OUTPUT_OPTIONS." '$video_file' >& ffmpeg.log";

You could try echoing that line to the log filetemporerily and see what it shows, and run it manually.

add:
Error( $command);

after that line


I got this in my zmvideo.log

05/04/11 22:18:16.512583 zmvideo[32247].ERR [/opt/ffmpeg/bin/ffmpeg -y -r 18.79 -i %03d-capture.jpg -s 384x288 -r 20 -b 5000k 'Event-232541-r1-s1.mpg' >& ffmpeg.log]

dont forget I'm on an earlier version, but it may show something obvious.
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Re: Unable to export video

Post by kevin_robson »

I wonder if it needs to be run from inside your event folder.
Try cd'ing to the event folder and running the zmvideo/ffmpef command from inside there. Is it possible yur events folder could be wrong within your zm database config?
limitlessent
Posts: 46
Joined: Wed Mar 18, 2009 8:38 am

Re: Unable to export video

Post by limitlessent »

Strange.. if I cd into the actual events dir of the one I want to export it works...
[root@zoneminder 4569239]# /usr/bin/zmvideo.pl -e 4569239 -r 1 -f avi
Event-4569239-r1-s1.avi
[root@zoneminder 4569239]# pwd
/cams/events/IS_Shipping_Dock/4569239
What would that mean?
limitlessent
Posts: 46
Joined: Wed Mar 18, 2009 8:38 am

Re: Unable to export video

Post by limitlessent »

Also.. where do I check the db to see if my paths are correct for my events folder?
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Re: Unable to export video

Post by kevin_robson »

I dunno.
Looks like perl grabs it from this line, but I dont know perl.

my $event_path = getEventPath( $event );
chdir( $event_path );

It is stored in /usr/local/etc/zm.conf - could be from there?
I can't see it in DB, but may be wrong.

If that still doesn't work, you could comment this:
my $event_path = getEventPath( $event );

and replace with:
my $event_path = 'your path';

Edit:
Looks like the perl module gets the path from ZoneMinder.pm
in /usr/lib/perl5/site_perl/5.10.0/
which then calls /usr/lib/perl5/site_perl/5.10.0/ZoneMinder/General.pm
and this function.

sub getEventPath( $ )
{
my $event = shift;

my $event_path = "";
if ( ZM_USE_DEEP_STORAGE )
{
$event_path = ZM_PATH_WEB.'/'.ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d/%H/%M/%S", localtime($event->{Time}) );
}
else
{
$event_path = ZM_PATH_WEB.'/'.ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.$event->{Id};
}
return( $event_path );
}

Does a few iterations before selecting from a Config table, but that contains none of the above.

I think it must be the text file /usr/local/etc/zm.conf

Otherwise you are on your own unpicking that lot.
Good luck
Locked