save events to mpeg instead of jpg

Support and queries relating to all previous versions of ZoneMinder
Locked
tiberiu
Posts: 7
Joined: Sun Dec 16, 2007 10:45 pm

save events to mpeg instead of jpg

Post by tiberiu »

how can i make zoneminder to store the events in mpeg format ?

i make a script to convert form jpg to h264 , but it takes forever to delete all the jpg files

i use a 500gb ext3 formated sata hdd .

i have activate purge when full , and zoneminder deleted all the evens , because it record faster then deleting files and my space was never under 95%
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

zm cannot record in mpeg and PLEASE search for ALL the threads on this. There are many reasons why it doesnt quality of recording being the main one.
If you fill your drive that fast then your system is recording to fast and im suprised it hasnt fell over. You need to think about deleting of events when setting your system up. Might be an idea to disable fast deletes
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
tiberiu
Posts: 7
Joined: Sun Dec 16, 2007 10:45 pm

Post by tiberiu »

it took 3 hours to delete 30 events.....?!!?!!
my ideea was to record 1 event /hour , run a script to convert to h264 and than to delete the files...but..it takes more to delete then to record..
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

something is wrong then as it shouldnt, but your script maybe causing uissues if you dont run the script does zm function ok?
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
tiberiu
Posts: 7
Joined: Sun Dec 16, 2007 10:45 pm

Post by tiberiu »

i stoped zm
i used mc to remove files and it took verrrryy long time
same , zoneminder clenear use rm to delete files and that is very slow

i google and find a faster way to delete files
# perl -e 'unlink(glob("*"))'

it's nothing wrong , i ceck my sata in bios and is ok , it use ahci ...
but the speed of rm is slower than the speed of recording events..
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

i will have to see other input from the rest of the community but i cant see how deleting events can be slower than creating them unless your box is pretty maxed out creating event. Or your scipt is causing an issue, have you tried not running the script to see if zm keep sup then.

WHat framerate you running on how many cams at what res?
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
tiberiu
Posts: 7
Joined: Sun Dec 16, 2007 10:45 pm

Post by tiberiu »

i have 5 cameras
resolution is 640x480
i recorded to 6 fps
jpg quality 85%

and running zmaudit could't keep up .. i was watchin the free space and was around 96% for 5 hours..

i wasn't running anithing else except recording and deleting old events...

if i run ffmpeg to compress a event , zoneminder is stoped , and delete old events the speed of rm is around 110 files/sec.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

when recording what is the load on the machine and what the specs of the machine
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
tiberiu
Posts: 7
Joined: Sun Dec 16, 2007 10:45 pm

Post by tiberiu »

i have a p5k-pro , a q6600 quad dual core 64 bit , 2x1024 ddr2 800 , 500gb sata ahci 16mb buffer samsung hdd , ubuntu 7.10 server x64

now i stop at night zoneminder , because it does'n happen anyting , and i run a script to convert events to x264 , and after deltele the jpegs

why is such a lack of information on how to make zoneminder work whit h264 ??? i serch for days ... every chines dvr card has a windows soft that know how to record h264 ... all zoneminder's users have such big hdds that don't need to compress the events?

i think that i can use filters to set up i script to run after each event ?

here is the schipt
it should be run like this
nohup /bin/bash ./ialamana &

#!/bin/bash

export LD_LIBRARY_PATH=/usr/local/lib/

X="%08d-capture.jpg"
options="-vcodec libx264 -b 160k -bt 160k -bf 3 -subq 6 -cmp 256 -refs 5 -qmin 10 \
-qmax 51 -qdiff 4 -coder 1 -loop 1 -me hex -me_range 16 -trellis 2 \
-flags +mv4 -flags2 +bpyramid+wpred+mixed_refs+brdo+8x8dct \
-partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -g 250 \
-keyint_min 25 -sc_threshold 40 -i_qfactor 0.71"

cd /var/cache/zoneminder/events/
for j in `seq 1 8`;
do

cd $j
evita=0
for i in $( ls -t); do
echo $evita $i
pwd
if [ $evita -gt 6 ]; then

zi=`ls -Ald $i|cut -d' ' -f6`
ora=`ls -Ald $i|cut -d' ' -f7`
tmpfile2=$j-$zi-$ora-$i.mp4
tmpfile=/var/cache/filme/$tmpfile2
input_file=/var/cache/zoneminder/events/$j/$i/$X
echo $tmpfile-$input_file
cd $i

iafisiere=""
COUNTER=1
while [ "$iafisiere" = "" ]; do
iafisiere=`ls |wc |cut -d' ' -f$COUNTER`
let COUNTER=COUNTER+1
done

catartrebui=$((3320*iafisiere))

#echo catartrebui- $catartrebui
#echo iafisiere-$iafisiere

# iau dimensiunea fisierului randat
if [ ! -e $tmpfile ]; then
fisierrandat=0
else
fisierrandat=`ls -Al $tmpfile|cut -d' ' -f5`
fi

#daca am dimeniunea fisierului randat mai mica decat cat cred eu ca ar trebui sa fie il fac din nou
if [ $catartrebui -gt $fisierrandat ]
then
ffmpeg -y -r 6 -i "$input_file" -deinterlace -an -threads 4 $options $tmpfile </dev/null
fi

#acum mai iau o data dimenisunea si daca e mai mare ma apuc sa ster fisierele din director

if [ ! -e $tmpfile ]; then
fisierrandat=0
else
fisierrandat=`ls -Al $tmpfile|cut -d' ' -f5`
fi

if [ $fisierrandat -gt $catartrebui ]
then
perl -e 'unlink(glob("*"))'
echo "sterg continut"
fi
cd ..

else
echo a $evita $i
fi
let evita=evita+1
done;
cd ..

done
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

tiberiu wrote:why is such a lack of information on how to make zoneminder work whit h264 ??? i serch for days ... every chines dvr card has a windows soft that know how to record h264 ... all zoneminder's users have such big hdds that don't need to compress the events?
Because h264, mpeg, etc... are all patent infringed and require royaltises to be payed for each peice of software in use (Just like the borg software you mention) which is difficult to do with open source software since it is usualy free of charge, someone still needs to pay as the patent holders still want there money for each copy of software and the developers (us) don't want to pay the penalty of each peice of software distributed should we get caught. We could make a binary version of the software and charge for the royalties on each license but thats not the model that open souce is based on.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

also you may like h264, i dont and much prefer jpegs. When something happens and your images are either useless or not allowed then you might agree. Untill then good luck with your mod
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
tiberiu
Posts: 7
Joined: Sun Dec 16, 2007 10:45 pm

Post by tiberiu »

jpegs are good , but what can i do when i fill a 500gb hdd in 3 days ?
now i record at 680*510 , 6 fps , jpg quality 85% :)

@cordel -- u must pay something if u include inzoneminder a script that use patented software? i allready seen that zoneminder support ffmpeg for streaming ... why u can make a script to use ffmpeg for archiving ?
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

tiberiu wrote:jpegs are good , but what can i do when i fill a 500gb hdd in 3 days ?
now i record at 680*510 , 6 fps , jpg quality 85% :)
I see your point mate but it takes a lot of space, I would either use motion detection to drop framerate when nothing is happening or use more hard disks.

Its a personal preference and while you can write a script to make whatever from your jpegs, zm doesnt do this by default. By all means mod it as you see fit but honestly mpeg based recording is bad in the long term. I have ye to see a professional machine be any good that is mpeg based only. Digi sprites do use mpeg but they transcode so keey important stuff as jpegs and then move the less important stuff to mpeg as the drive fills. It also uses mpeg for streaming, and it is ideal for this, it is not a high quality storage codec. Id prefer to see jpeg 2000 or any non conditional refresh based high quality codec, but jpeg is what we use for now. Still will be what youy need in court as well as video. Even been asked to produce a still from frame 387 (for example) on mpeg with no interframes?
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
sergiut2002
Posts: 30
Joined: Wed Sep 19, 2007 11:54 am
Location: Constanta Romania

aala

Post by sergiut2002 »

do you need to record at night also? if not just schedule zm to start and record only when it`s day and stop recording when it`s night ;)
________
MEDICAL MARIJUANA GROW
Locked