Hi all,
ive wrote a long text explaining how to make a montage with mpeg. it has some issues and i ask Phil's help and others one to solve that, ok ?
Im pleased to help everyone in what i can !
Victor Diago
NEW MPEG MONTAGE !!! WITHOUT BROWSER !
- victor_diago
- Posts: 245
- Joined: Wed Jan 21, 2004 2:44 pm
- Location: Brazil, sao paulo
- Contact:
- victor_diago
- Posts: 245
- Joined: Wed Jan 21, 2004 2:44 pm
- Location: Brazil, sao paulo
- Contact:
Hi all, ive finally got mpeg montage up and running.
i will start with a little story ok ?
So, im building a surveillance "stand alone box" with linux slackware and zoneminder.
it working is very simple, it is a simple computer, with some video capture cards attached (by878 chipset) each card has 4 inputs and it has 30 fps (30 / 4 = 7.5 fps each camera).
it has also a Geforce 4 64 MB With tvout, and a zoneminder version (latest aways) installed.
i had a lot of problems (and many of you too) with firefox/mozilla for watching montage, because at beginning it only opened two cameras. After we solved that and things got a lot better. but today, if we have a camera at high fps (like 15 fps) or even 16 cameras at 7 fps (or even little less),firefox take a lot of memory to show the montage, it is not capable to show a true 30 fps camera (image flicks a little because its jpeg, not truly video) and other things.
My system has two modes, viewer and operator..
in viewer mode my system have the TV out right configured to show everything on TV using 1024x768. When my system starts, it starts a lot of processes (like myisamchk) to ensure zoneminder could work right. After boot process it starts X11 automatically and then shows the montage on the screen. so, after power it on, in a few seconds you will see the montage automatically. it doesnt use at this time any window manager, only Idesk with the icon "operator mode". If you click operator mode then the X11 restarts in operator mode with icewm window manager and a few other icons to start firefox in zm console and again, to go back to viewer mode.
This is very good because if you just want to see the images you set it into the view mode, then you only need to connect a tv on the system and voilla ! But if you need to search for events, you only need to click operator mode, and X11 will restart in operator mode to ensure that you could run anything as fast as possible.
Then my problem starts. As i said you, we have experienced many problems with firefox, so imagine a system that runs for 30 days in nonstop mode. at the end of 30 days, the X11 is SO SLOW that you cant even click anything without a huge delay, i dont know why the hell this occurs, but this is not a problem anymore.
so I needed a way to display the cameras on the screen without using the browser (which would save me precious mb of ram) and a way to display even the fastest cameras (30 fps for example) without turn the system slow (that happened with firefox).
ive found that using MPEG would be VERY NICE ! and i searched for it and ive found a way to do that, with mplayer.
first i start a X11 session WITHOUT window managers. then i tried to start a lot of mplayer instances. curiously, sometimes it worked and sometimes not, so ive made a script called montagempg.sh that ensures (by brute force) that everything will run (it actually tryevery second to start mplayer if it has not been started yet for some camera).
Worked very well so that is the code :
The above code is for a system with 8 monitors, and it places every monitors right because i used the -geometry option.
BUT NOW COMES THE DAMN PART !!!!
all works great, but have some delay (at start of 2 seconds). but as the time passes, the delay growth , and ive seen some delays of 10 seconds in 48 hours !!!!!. this is really bad. One workaround is to restart X11 every 2 or 4 hours (im doing that actually). But in order to use it right we need to solve that...
ive found some errors watching the console output.
when i try to run mplayer and it doesnt connect, this is the message it shows :
So i need to try a lot of times (i use a while loop) to make everything work.
as we can see there is a size_confirm mismatch!: 30130 43520 and Error while parsing chunk header errors. after trying a lot of times we are able to start mplayer and it shows everything right, except for some other errors messages :
The video doesnt stop playing, but due to this errors the delay increases slowly, so you stat at 2 seconds delay and finishes at 15 or more in two days or three !!!!
ive tryed many players including VLC and the two early versions of ffmpeg -> SAME THING, so ive issued that the problem is the way that zoneminder encodes the video with ffmpeg, because if whe use ffmpeg to stream a file over network there IS NO ERRORS...
So, the Montage in MPEG is very next to be true, we only need to solve this problems...
Philip, Please, take a look at this, i think zm's way to use ffmpeg have some errors, as a friend of us issued that the maxfps option also doesnt work... could you take a look at this ?
for everybody that wants some tips on how to make a "stand alone" zm box, im pleased to help.
Thanks for all, specially to phil !!!
Victor Diago
i will start with a little story ok ?
So, im building a surveillance "stand alone box" with linux slackware and zoneminder.
it working is very simple, it is a simple computer, with some video capture cards attached (by878 chipset) each card has 4 inputs and it has 30 fps (30 / 4 = 7.5 fps each camera).
it has also a Geforce 4 64 MB With tvout, and a zoneminder version (latest aways) installed.
i had a lot of problems (and many of you too) with firefox/mozilla for watching montage, because at beginning it only opened two cameras. After we solved that and things got a lot better. but today, if we have a camera at high fps (like 15 fps) or even 16 cameras at 7 fps (or even little less),firefox take a lot of memory to show the montage, it is not capable to show a true 30 fps camera (image flicks a little because its jpeg, not truly video) and other things.
My system has two modes, viewer and operator..
in viewer mode my system have the TV out right configured to show everything on TV using 1024x768. When my system starts, it starts a lot of processes (like myisamchk) to ensure zoneminder could work right. After boot process it starts X11 automatically and then shows the montage on the screen. so, after power it on, in a few seconds you will see the montage automatically. it doesnt use at this time any window manager, only Idesk with the icon "operator mode". If you click operator mode then the X11 restarts in operator mode with icewm window manager and a few other icons to start firefox in zm console and again, to go back to viewer mode.
This is very good because if you just want to see the images you set it into the view mode, then you only need to connect a tv on the system and voilla ! But if you need to search for events, you only need to click operator mode, and X11 will restart in operator mode to ensure that you could run anything as fast as possible.
Then my problem starts. As i said you, we have experienced many problems with firefox, so imagine a system that runs for 30 days in nonstop mode. at the end of 30 days, the X11 is SO SLOW that you cant even click anything without a huge delay, i dont know why the hell this occurs, but this is not a problem anymore.
so I needed a way to display the cameras on the screen without using the browser (which would save me precious mb of ram) and a way to display even the fastest cameras (30 fps for example) without turn the system slow (that happened with firefox).
ive found that using MPEG would be VERY NICE ! and i searched for it and ive found a way to do that, with mplayer.
first i start a X11 session WITHOUT window managers. then i tried to start a lot of mplayer instances. curiously, sometimes it worked and sometimes not, so ive made a script called montagempg.sh that ensures (by brute force) that everything will run (it actually tryevery second to start mplayer if it has not been started yet for some camera).
Worked very well so that is the code :
Code: Select all
#!/bin/bash
while true
do
m1=`ps ax|grep "monitor=1"|grep -v grep`
m2=`ps ax|grep "monitor=2"|grep -v grep`
m3=`ps ax|grep "monitor=3"|grep -v grep`
m4=`ps ax|grep "monitor=4"|grep -v grep`
m5=`ps ax|grep "monitor=5"|grep -v grep`
m6=`ps ax|grep "monitor=6"|grep -v grep`
m7=`ps ax|grep "monitor=7"|grep -v grep`
m8=`ps ax|grep "monitor=8"|grep -v grep`
sleep 1
if [ "$m1" == "" ]
then
mplayer -ni -nobps -slave -geometry 0:0 -quiet -vo xv -nocache "http://localhost/cgi-bin/zms?mode=mpeg&monitor=1&scale=105bitrate=150000&maxfps=5&format=asf" </dev/null &
fi
if [ "$m2" == "" ]
then
mplayer -ni -nobps -slave -geometry 337:0 -quiet -vo xv -nocache "http://localhost/cgi-bin/zms?mode=mpeg&monitor=2&scale=105&bitrate=150000&maxfps=5&format=asf" </dev/null &
fi
if [ "$m3" == "" ]
then
mplayer -ni -nobps -slave -geometry 675:0 -quiet -vo xv -nocache "http://localhost/cgi-bin/zms?mode=mpeg&monitor=3&scale=105&bitrate=150000&maxfps=5&format=asf" </dev/null &
fi
if [ "$m4" == "" ]
then
mplayer -ni -nobps -slave -geometry 0:252 -quiet -vo xv -nocache "http://localhost/cgi-bin/zms?mode=mpeg&monitor=4&scale=105&bitrate=150000&maxfps=5&format=asf" </dev/null &
fi
if [ "$m5" == "" ]
then
mplayer -ni -nobps -slave -geometry 337:252 -quiet -vo xv -nocache "http://localhost/cgi-bin/zms?mode=mpeg&monitor=5&scale=105&bitrate=150000&maxfps=5&format=asf" </dev/null &
fi
if [ "$m6" == "" ]
then
mplayer -ni -nobps -slave -geometry 675:252 -quiet -vo xv -nocache "http://localhost/cgi-bin/zms?mode=mpeg&monitor=6&scale=105&bitrate=150000&maxfps=5&format=asf" </dev/null &
fi
if [ "$m7" == "" ]
then
mplayer -ni -nobps -slave -geometry 0:504 -quiet -vo xv -nocache "http://localhost/cgi-bin/zms?mode=mpeg&monitor=7&scale=105&bitrate=150000&maxfps=5&format=asf" </dev/null &
fi
if [ "$m8" == "" ]
then
mplayer -ni -nobps -slave -geometry 337:504 -quiet -vo xv -nocache "http://localhost/cgi-bin/zms?mode=mpeg&monitor=8&scale=105&bitrate=150000&maxfps=5&format=asf" </dev/null &
fi
done
BUT NOW COMES THE DAMN PART !!!!
all works great, but have some delay (at start of 2 seconds). but as the time passes, the delay growth , and ive seen some delays of 10 seconds in 48 hours !!!!!. this is really bad. One workaround is to restart X11 every 2 or 4 hours (im doing that actually). But in order to use it right we need to solve that...
ive found some errors watching the console output.
when i try to run mplayer and it doesnt connect, this is the message it shows :
Code: Select all
Playing http://localhost/cgi-bin/zms?mode=mpeg&monitor=1&scale=100&bitrate=300000&maxfps=5&format=asf.
Resolving localhost for AF_INET...
Connecting to server localhost[127.0.0.1]:80 ...
Resolving localhost for AF_INET...
Connecting to server localhost[127.0.0.1]:80 ...
size_confirm mismatch!: 30130 43520
Error while parsing chunk header
Trying default streaming for http protocol
Resolving localhost for AF_INET...
Connecting to server localhost[127.0.0.1]:80 ...
Cache size set to 0 KBytes
Connected to server: localhost
Stream not seekable!
Exiting... (End of file)
as we can see there is a size_confirm mismatch!: 30130 43520 and Error while parsing chunk header errors. after trying a lot of times we are able to start mplayer and it shows everything right, except for some other errors messages :
Code: Select all
error while decoding block: 19 x 14 (5)
[msmpeg4 @ 0x85bc7a0]Error at MB: 313
[msmpeg4 @ 0x85bc7a0]concealing 2147483647 errors
[msmpeg4 @ 0x85bc7a0]overreading 4 bits
[msmpeg4 @ 0x85bc7a0]concealing 900 errors
[msmpeg4 @ 0x85bc7a0]ac-tex damaged at 19 14
[msmpeg4 @ 0x85bc7a0]
error while decoding block: 19 x 14 (5)
[msmpeg4 @ 0x85bc7a0]Error at MB: 313
[msmpeg4 @ 0x85bc7a0]concealing 2147483647 errors
[msmpeg4 @ 0x85bc7a0]ac-tex damaged at 19 14
[msmpeg4 @ 0x85bc7a0]
error while decoding block: 19 x 14 (5)
[msmpeg4 @ 0x85bc7a0]Error at MB: 313
[msmpeg4 @ 0x85bc7a0]concealing 2147483647 errors
[msmpeg4 @ 0x85bc7a0]ac-tex damaged at 19 14
[msmpeg4 @ 0x85bc7a0]
error while decoding block: 19 x 14 (5)
[msmpeg4 @ 0x85bc7a0]Error at MB: 313
[msmpeg4 @ 0x85bc7a0]concealing 2147483647 errors
ive tryed many players including VLC and the two early versions of ffmpeg -> SAME THING, so ive issued that the problem is the way that zoneminder encodes the video with ffmpeg, because if whe use ffmpeg to stream a file over network there IS NO ERRORS...
So, the Montage in MPEG is very next to be true, we only need to solve this problems...
Philip, Please, take a look at this, i think zm's way to use ffmpeg have some errors, as a friend of us issued that the maxfps option also doesnt work... could you take a look at this ?
for everybody that wants some tips on how to make a "stand alone" zm box, im pleased to help.
Thanks for all, specially to phil !!!
Victor Diago
- victor_diago
- Posts: 245
- Joined: Wed Jan 21, 2004 2:44 pm
- Location: Brazil, sao paulo
- Contact:
-
- Posts: 4
- Joined: Fri Jun 10, 2005 9:14 pm
zm box
Victor:
I need something like that. I want a zm box for a sourvillance system wth 4 or 8 cameras. I need to watch the camera in real time, and make a mepg4 file every 3 hours. And, if i could, the possibilitie of view. And last but not least, i want to capture s streamming http from other external system, like mpeg4 from VLC.
Any idea?
By now, i have a AMD Sempron 3GHZ, 512Mb, and a BT878A capture card.
Thanks in advance
I need something like that. I want a zm box for a sourvillance system wth 4 or 8 cameras. I need to watch the camera in real time, and make a mepg4 file every 3 hours. And, if i could, the possibilitie of view. And last but not least, i want to capture s streamming http from other external system, like mpeg4 from VLC.
Any idea?
By now, i have a AMD Sempron 3GHZ, 512Mb, and a BT878A capture card.
Thanks in advance
- krzys31337
- Posts: 65
- Joined: Wed Jul 06, 2005 7:43 pm
- Location: Poland,Warsaw N 52°09'10" E 20°55'09"