Shell Script: creating one video file per day

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
beerygaz
Posts: 28
Joined: Wed Jul 08, 2009 9:43 am
Location: Johannesburg, South Africa

Post by beerygaz » Mon Mar 01, 2010 7:43 am

My events structure doesn't look like yours suggests.

I have ./events/<monitorID>/<5> like this:

/var/lib/zoneminder/events/19/89799

ls -la in Monitor ID 19 folder reveals:

Code: Select all

drwxr-xr-x    2 apache apache 12288 2010-02-28 10:23 89786
drwxr-xr-x    2 apache apache 20480 2010-02-28 11:02 89789
drwxr-xr-x    2 apache apache 12288 2010-02-28 11:55 89790
drwxr-xr-x    2 apache apache 12288 2010-02-28 12:59 89793
drwxr-xr-x    2 apache apache 12288 2010-02-28 13:02 89795
drwxr-xr-x    2 apache apache  4096 2010-02-28 17:54 89797
drwxr-xr-x    2 apache apache 20480 2010-03-01 06:11 89799
Any idea why my events folders are these numbers and not named by date?

Version: ZM 1.24.1

Flav
Posts: 38
Joined: Tue Jan 12, 2010 2:26 pm
Contact:

Post by Flav » Mon Mar 01, 2010 12:17 pm

beerygaz wrote:My events structure doesn't look like yours suggests.

I have ./events/<monitorID>/<5> like this:

/var/lib/zoneminder/events/19/89799

ls -la in Monitor ID 19 folder reveals:

Code: Select all

drwxr-xr-x    2 apache apache 12288 2010-02-28 10:23 89786
drwxr-xr-x    2 apache apache 20480 2010-02-28 11:02 89789
drwxr-xr-x    2 apache apache 12288 2010-02-28 11:55 89790
drwxr-xr-x    2 apache apache 12288 2010-02-28 12:59 89793
drwxr-xr-x    2 apache apache 12288 2010-02-28 13:02 89795
drwxr-xr-x    2 apache apache  4096 2010-02-28 17:54 89797
drwxr-xr-x    2 apache apache 20480 2010-03-01 06:11 89799
Any idea why my events folders are these numbers and not named by date?

Version: ZM 1.24.1
This is the good structure the script find the events Creat at this Date

whatboy
Posts: 304
Joined: Mon Aug 31, 2009 10:31 pm

Post by whatboy » Mon Mar 01, 2010 5:44 pm

You're not using Options -> Paths -> USE_DEEP_STORAGE on to store events...

beerygaz
Posts: 28
Joined: Wed Jul 08, 2009 9:43 am
Location: Johannesburg, South Africa

Post by beerygaz » Tue Mar 02, 2010 10:17 am

Flav / whatboy - seem to be conflicting answers. Do I keep the existing structure and look for some other problem? Or do I need to enable USE_DEEP_STORAGE?

Flav
Posts: 38
Joined: Tue Jan 12, 2010 2:26 pm
Contact:

Post by Flav » Tue Mar 02, 2010 12:18 pm

i'm not use : USE_DEEP_STORAGE and it's work.

coke
Posts: 518
Joined: Wed Jan 30, 2008 5:53 pm
Location: St. Louis, MO, USA

Post by coke » Tue Mar 02, 2010 8:47 pm

Deep storage also increases the speed of deletes, eliminates possible file limit problems down the road, and probably a few other things that are handy.

whatboy
Posts: 304
Joined: Mon Aug 31, 2009 10:31 pm

Post by whatboy » Tue Mar 02, 2010 10:06 pm

I only have a problem, I created a script with my solution, to added to the crontab... script (zmmkmov) looks like...

Code: Select all

#!/bin/sh
rm /home/user/bin/list.txt
ls -Ca --format=single-column /events/1/$(TZ=EST24EDT date +%y/%m/%d)/.*/*capture.jpg > /home/user/bin/list.txt
/usr/bin/mencoder "mf://@list.txt" -mf fps=5 -o /home/user/bin/mon1-$(TZ=EST26EDT date +%F).avi -ovc lavc -lavcopts vcodec=mpeg4
sudo mv /home/user/bin/mon1-$(TZ=EST26EDT date +%F).avi /stuffs/video
and on crontab I set to ran at 00:10 each day, but emncoder exit with error, I don't have the e-mail that shows the error, but I'll post it here later, and I can't use SUDO on a crontab??? gives me an error too

Code: Select all

SHELL=/bin/sh
HOME=/home/user
PATH=/usr/bin:/bin:/home/user/bin
LOGNAME=user
USER=user
10 00 * * * umask 002; /home/user/bin/zmmkmov

Maybe is the "mf://@list.txt" I'll try with "mf://@/home/user/bin/list.txt" and see if mencoder doesnt fail, but sudo??? why can I use sudo on a crontab??? it says I can only use sudo on a tty console...


But if I ran it manual from console, nor mencoder, nor sudo (ofcourse) gives me errors!!!

User avatar
kongobongo
Posts: 15
Joined: Fri Apr 09, 2010 5:09 pm

Post by kongobongo » Mon Apr 19, 2010 6:49 pm

Hi,

I've created the script from the first post and customised it with the correct options, when I run it I get the following output....

Found ZM Events Directory: /var/www/zm/events/ -> OK!
Found Video Output Directory: /var/www -> OK!
Found Monitor: 10 -> OK!
Found requested day: 2010-04-19 -> OK!
Found FFmpeg binary: /usr/local/bin/ffmpeg -> OK!
Processing wanted events......23431 events found
Building video: /var/www/2010-04-19--Monitor-10.avi -> FINISHED!
Removing temporary files, bye!

The amount of events is incorrect, I only have a total of 1375 events combined for both cameras. The output video file is only 1mb in size.

Any suggestions as to where I am going wrong?

brunitho
Posts: 5
Joined: Mon Apr 05, 2010 7:35 pm

Post by brunitho » Wed Apr 28, 2010 8:09 pm

I'm having problems with the line 73 states:

argument list too long

has some way to improve this line or reduce the amount of arguments?

User avatar
kongobongo
Posts: 15
Joined: Fri Apr 09, 2010 5:09 pm

Post by kongobongo » Wed Apr 28, 2010 8:20 pm

Yep, i'm getting that argument error as well now.....

The script looks like a good starting point, just needs looking at. I've tried to get in touch with Trendkill via email and msn but with no joy :(

johnnytolengo
Posts: 184
Joined: Tue Oct 14, 2008 5:59 pm

crontab

Post by johnnytolengo » Wed Apr 28, 2010 8:30 pm

whatboy be careful with the crontab expressions, try with this:

as a root

10 0 * * * root /home/user/bin/zmmkmov

OR

as apache
10 0 * * * www-data /home/user/bin/zmmkmov

good luck.

Tolengo.

brunitho
Posts: 5
Joined: Mon Apr 05, 2010 7:35 pm

Post by brunitho » Wed Apr 28, 2010 8:31 pm

what a pity

my zoneminder is not willing to export the videos is still saying, exporting and not displayed the files to download.

look
http://www.zoneminder.com/forums/viewto ... highlight=

and my HD is getting full.

User avatar
kongobongo
Posts: 15
Joined: Fri Apr 09, 2010 5:09 pm

Post by kongobongo » Sat May 01, 2010 7:34 am

I am speaking to TrendKill, the original author about the problems so I will post an update as soon as I have one

lifeisboost
Posts: 1
Joined: Mon May 24, 2010 8:28 am

Post by lifeisboost » Mon May 24, 2010 8:31 am

Hello everyone.

I am trying to use this script but it never finds my events. i manually tried running the command



Code: Select all

[root@localhost zm]# ls -Al /var/www/html/zm/events/1/ --time-style=long-iso |grep -l 2010-05-01

to try and find the events but this is the response it returns. im not sure where to go as i have not found any answers in looking through the net on the response.

Code: Select all

(standard input)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest