Page 1 of 1

Stream to local machine

Posted: Sat Jun 18, 2005 4:51 am
by tfleming
I want to display a montage to my local machine so I can view it through the tv-out feature on the motherboard. I've seen the posts where some have used mplayer to do this. While this works for me it is very cpu intensive. The encoding to mpeg by zms followed by decoding in mplayer is too much for my 1ghz epia.

Does anyone know of a more efficient way to locally stream a montage?

Thanks

Posted: Sun Jun 19, 2005 9:26 am
by tfleming
I discovered that cambozola also works stand-alone as a java application. Further it will take multiple urls on the command line and cycle through the camera streams. It was a fairly simple matter to modify cambozola to display a montage. I have a bit more work to do but I'll make a patch available to anyone who would like to do the same thing.

Posted: Sun Jun 19, 2005 12:18 pm
by Blazer
Sounds cool! Please post it when you are done. :-)

Posted: Wed Jun 29, 2005 4:27 am
by tfleming
Ok, here's where I am.

I modified Cambozola to display a 4 monitor montage. Unfortunately when I ran it on the Zoneminder box it drove CPU utilization to 100%. It really couldn't keep up with the video feeds even at 5 fps.

So I did some profiling on the code and found hotspots in the SplitStream class. I streamlined the code so that each image is loaded all at once in a byte array and displayed. It reduced CPU utilization from 90% down to 40%.

Unfortunately this still won't work for me. When it displays a montage it starts four instances of zms. Each of these take about 10% of the cpu. So my local montage display, refactored Cambozola + 4 zms, took about 80%. With X and other processes my machine only had about 10% idle. When I displayed a montage via the web browser it starts 4 more instances of zms. There are not enough cycles left and the local montage suffers horribly.

So I scrapped the refactored Cambozola route. Now I'm using multiple instances of xawtv. At first I couldn't get more than one instance of xawtv going at the same time. By starting each instance with a different -xvport, things are working good. The xawtv instances are full frame rate and yet don't take any appreciable amount of cpu. I have the 4 xawtv instances running along with a browser montage and still have 60% idle.

Next I only need to get the 4 xawtv instances to start automatically and positioned in the four quadrants without window frames.

Note: My refactoring of Cambozola also removed features not needed for a local montage. Thus its not something I would submit as a patch. Since my refactoring didn't work for me I probably won't go any farther with it.

Posted: Wed Jun 29, 2005 7:07 am
by jameswilson
Good luck sounds like your onto something there

James

Posted: Wed Jun 29, 2005 9:29 am
by zoneminder
I think the best approach for this in the short term is a mod to zms to amalgamate the images before streaming. There are a few tricky issues such as what to do with different image size and more fiddly still, when to send an update if all the cameras are capturing at different, and overlapping, frame rates but none of this is insurmountable.

Obviously this is still going to take more or less the same amount of bandwidth and blending the images in memory is not exactly trivial in terms of processor time but it may be quicker than four separate zms's.

I'll take a look at this if I get time.

Phil

Posted: Wed Jun 29, 2005 7:24 pm
by Baylink
I can't lay claim to having looked at ZMS's source yet (or, it being C++, even being able to *understand* zms's source :-), but it doesn't seem to *me* like it ought to be all that horrible to get ZMS to combine the things it reads out of the shm's before streaming them... as long as there aren't synchronization problems...

Posted: Wed Jun 29, 2005 7:46 pm
by tfleming
Looking at the code I think its zm_monitor that would be modified. It has a method called StreamImages that reads the image buffer, converts it to jpeg (or whatever is called for), and streams it to stdout.

However, since a single monitor instance (from an object oriented perspective) should represent a single, physical monitor, stuffing a montage into it wouldn't be good encapsulation. Perhaps a new montage class would be best but that's Phil's call.

The xawtv approach is coming along well for the specific purpose of showing cameras on a local display. Since it doesn't do any encoding (e.g. jpeg) it has almost no load on the cpu. On the other hand xawtv won't get me to the next step of displaying events on a local display. Ultimately I'd like to see a GUI for zoneminder. Something simple that works with single key presses and arrow keys; something like mythtv.

I will help as time permits.

Posted: Mon Jul 04, 2005 10:40 pm
by victor_diago
Hi Friend.


This could be a GREAT solution for many of us.... tell me please, the card you are using uses only one capture chipset ???? i mean, it has the default 30 FPS per 4 channels standard ?


If you have made xawtv run into one of these babies, then its the solution for me.

Thanks for now

Victor Diago