View unanswered posts | View active topics It is currently Wed Jun 19, 2013 7:58 pm



Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Archive Events to MPEG Video 
Author Message

Joined: Sat Jan 08, 2005 10:23 pm
Posts: 2
Post Archive Events to MPEG Video
I've been trying to write a script to automatically archive events to mpeg video files to a specific directory (based on the day of the event) and then remove the event from zoneminder.

The main reason I've been wanting to do this is to get better hard drive usage so I can store 30 days or more and to organize the video for easy burning to cd if it is necessary.

I haven't had much luck and any help would be appreciated.


Sat Jan 08, 2005 10:40 pm
Profile
Site Admin
User avatar

Joined: Wed Jul 09, 2003 3:07 pm
Posts: 5221
Location: Bristol, UK
Post 
I would suggest doing it in perl, and either getting your script to use zmvideo.pl to generate the video or even just extending it. You want to generate the video file and then remove the event from the DB or fielsystem, once gone from one or the other zmaudit should clean up everything else.

Phil


Sun Jan 09, 2005 12:31 am
Profile ICQ YIM WWW

Joined: Mon Jan 24, 2005 3:43 pm
Posts: 301
Post 
Hello.

I recently had to free disc space really fast from the video server, so I quick hacked a php script, which will convert all of the events, and will erase the JPGs. Currently, it dumps all of the videos in the monitor dir (where all of the events are stored, in the directories named on their IDs). It required slight modification of video.pl, and several more modifications of zm_html_view, and zm_funcs. The script behaved poorly when launched from browser, so I had to allow running it from the shell (another modification of zm_config which removed the authorization), in a form of php index.php view=compressall.

In short, it's really not ready for distribution, but if I already on it, perhaps you will suggest some must have features, which will make it more usable. One of them is to allow using the generated videos from the ZM, meaning script will only erase the JPGs, but will leave the dirs and DB entries intact, and the ZM will recognize the mpeg and will simply play it back, without any fancy per-frame analysis features.

BTW - it really makes a huge difference in the disk space usage - from 92% to 22% (80 GB in total), so it compensates the loss of all the per-frame features.


Wed Mar 09, 2005 11:26 pm
Profile

Joined: Sat Jan 08, 2005 10:23 pm
Posts: 2
Post 
That sounds great. As long as it is self-contained and can be run from a cron job, it sounds like it will do exactly what I need.


Sat Mar 12, 2005 2:32 pm
Profile

Joined: Mon Jan 24, 2005 3:43 pm
Posts: 301
Post 
Hello Phil.

I'm looking for an easy way to integrate this script in the existing ZM, so I would like to define it via the filter "execute command on event". Could you please elaborate, how exactly ZM executes the command, e.g.
"compress.sh /var/lib/zm/events/12345" ?

Thanks you.


Tue Mar 22, 2005 6:27 pm
Profile
Site Admin
User avatar

Joined: Wed Jul 09, 2003 3:07 pm
Posts: 5221
Location: Bristol, UK
Post 
That is correct, though I would advise given the full path to your script. I would also advise disabling it initially and just writing some debug to a file to ensure that it is doing what you expect before you set it free on real events!

Phil


Tue Mar 22, 2005 8:41 pm
Profile ICQ YIM WWW

Joined: Sun Jun 19, 2005 4:19 am
Posts: 91
Post I really need this bad...
any current movement on it? Is it compatible with current versions (1.21.1+)?

Could you post the script? ;-)


Thu Jun 23, 2005 3:40 pm
Profile

Joined: Sun Jun 19, 2005 4:19 am
Posts: 91
Post No, never mind...
As noted in another thread, I'm about 90% done with this -- it turned out to be much less complicated than I'd feared, since Phil gives good schema. :-)

I got hung up getting a good ffmpeg-and-dependencies setup in, since that machine was off-line (it's going on-line Monday morning), but as soon as I get that finished, I should have a "convert yesterday's events to MPEG and burn them on a CD with useful names" script ready to post.

When I do, I'll start a new thread here, so it doesn't get lost.


Sat Jun 25, 2005 5:43 pm
Profile

Joined: Sun Jun 19, 2005 4:19 am
Posts: 91
Post 
Posting that script now...


Wed Jul 06, 2005 8:31 pm
Profile
User avatar

Joined: Wed Jul 06, 2005 8:43 pm
Posts: 65
Location: Poland,Warsaw N 52°09'10" E 20°55'09"
Post 
Hi!

After some poking around with mencoder i've figured that creating avi/divx files saves much space in zm boxes.

This script removes jpg older than 24 hours (still I would like to save the one with "Thunibal" jpg for easy navigating through events).

Another script just like that one with "mencoder" invocation crates avi file.

Maybe some of this functionallity shoud be included in ZM?

Code:
#!/bin/sh

touch /tmp/szukaj.$$

for i in $( echo 'select MonitorId,Id from Events WHERE DATE_SUB(CURDATE(),INTERVAL 24 HOUR) >= StartTime AND EndTime is not NULL;' | /usr/bin/mysql -u zm --password=zmpassword zm --silent --batch | tr \\t - ) ; do
    if [ -d "/var/lib/zm/events/$( echo $i | tr - '/')/" ]; then
    nice find /var/lib/zm/events/$( echo $i | tr - '/' )/ -name \*.jpg | xargs rm
    fi
done

_________________
--
Best Regards and sorry for my poor english...


Sun Sep 18, 2005 12:44 pm
Profile

Joined: Tue Jun 22, 2004 10:26 pm
Posts: 101
Location: Kaarina-Finland
Post Where is it?
Baylink wrote:
Posting that script now...


Hello,

I feel a bit stupid but where is it posted? I cannot see the video creation script.

I need a way to create a mpeg video of all events.


Thu Sep 29, 2005 7:41 pm
Profile
User avatar

Joined: Thu Jul 10, 2003 7:00 pm
Posts: 240
Post 
yes i have made same but is on PHP. and run by cron jobs.

the main script write all the videos "based on specific search" to a usb disk, so need to detect it "yes a plug&play on php". look if is format, how much space, do not copy prossesed events and many other things. like the use of ffmpeg directly.
have some bugs,, and i dont have much time. and the main problem i dont have program structure.. so is imposible even by me to see how its works.. :) and needs database modifications.

iam going to add a web setup. and the posibility to write cd or dvd and copy to networks drives.

i give you ideas.. wasnt so dificult .. even by me that i dont know much programing and linux. i have read a lot ..

_________________
Fernando


Mon Oct 03, 2005 6:30 am
Profile

Joined: Tue Jun 22, 2004 10:26 pm
Posts: 101
Location: Kaarina-Finland
Post I would be glad to get some help
fernando wrote:
the main script write all the videos "based on specific search" to a usb disk, so need to detect it "yes a plug&play on php". look if is format, how much space, do not copy prossesed events and many other things. like the use of ffmpeg directly.


This would be very nice to have.

I have a problem already with ffmpeg. I am not able to generate MPEG2 videos with ffmpeg so that the video would be proper, standard obeying MPEG2 stream.

In many threads the "video generation error" has got to do with the fact that without extra parametres ffmpeg refuses to generate a video if the frame rate is less than 25 FPS. This is because of the specification.

There is a workaround in thread
http://www.zoneminder.com/forums/viewto ... mpeg+video
that uses the -strict -option. That however creates a video that _does not conform to MPEG2 -specification_ and therefore is not playable with commercial video player software (windows machines).

I have tried to find out what the -strict option really does but it is not documented on ffmpeg man pages.

Any hints how to generate a proper MPEG2 video?


Mon Oct 03, 2005 8:06 am
Profile

Joined: Mon Jan 24, 2005 3:43 pm
Posts: 301
Post 
Hi.

This is very interesting - perhaps it's the reason I was never able to stream a video? This is what the FFMPEG manual says:

"
`-strict strictness'
how strictly to follow the standards
"

So I guess, the strict of 1 is the most loosest one, which is not playable by Windows Media Player?


Sun Oct 09, 2005 7:12 pm
Profile

Joined: Wed Jun 16, 2004 8:15 pm
Posts: 44
Post 
I am using 1.21.3 anb I love the new export ability. I would like to easily create the video files for archived events so that I can export them via the export function. I am trying to run this ffmpeg command:

/usr/sbin/ffmpeg -hq -intra -strict -1

on each archived event via the saved filter interface but am not having any luck.

I do not wish to delete anything (events, jpeg, etc.) I need to preserve all original events in their original formats for forensic investigative purposes.

Does anyone have any suggestions on how to perform video creation on a filter list of events so that they may be exported via the eport feature?

Skydiver


Last edited by skydiver on Sun Nov 06, 2005 1:15 am, edited 2 times in total.



Mon Oct 24, 2005 7:02 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 29 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group