Live Streaming with Flash swf: working; Quicktime question

Support and queries relating to all previous versions of ZoneMinder
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

Phil, we love ya mate
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
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I've done a trial implementation here and apart from one monitor, which refuses to stream flash (the image comes up but only ever the initial frame, even though zms is quite happily pumping out swf) I have good quality flash video, excellent in fact.

However I am experienced extreme latency build-up, the video gets behind at a rate of 5-10 seconds per minute. I get this locally, no matter what the bitrate and maxfps, and on Mickey's server. I can't imagine it is lack of backwidth, as I have a gb link between the boxes here so I'm wondering if it might be down to something else.

I wonder if anyone else can do a check and see what they get, latency-wise. It would be great to get this going realtime.

Phil

ps. I have been doing a bit of digging on mobile streaming again. Vodafone here in the UK have just launched TV on phones and I tried it for a bit of the cricket last week. I was impressed by the quality. I've done a bit of research and figured out what they use to do it and am going to try and get something up on my ZM box here. It uses rtsp and/or rtp and sdp etc so it does require a server process to connect to rather than just using http but in theory it shouldn't be too hard to set up and should work with reqular RealPlayer type apps as well as phones.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

By the way, the other thing about swf streaming is that it uses virtually no cpu on the server box. Another thing I'm impressed with. So more kudos to Mickey for taking the time to have a play.

Phil
mrreynolds
Posts: 8
Joined: Wed Nov 09, 2005 3:28 pm

Post by mrreynolds »

Phil,

Thanks for the rapid response on my post, I had no idea you would integrate changes into the next release so quickly.

Regarding the latency build-up you noted, I have seen delay problems with Flash only if hitting the internet upload bandwidth limit. Unfortunately this can happen wth my server with only 2 simultaneous streams outside my LAN, which could explain your experience with my stream at least (can't explain your gb lan delay though). For my project I plan to add code that will limit simultaneous access from the internet unless I can get multicast streaming working (see below).

I'm running a test now on 2 different servers wth Flash for about an hour, one on my LAN and one remote at my client's site. So far (45 min.) they're both tracking "real" time. BTW, my ffmpeg output options are: -r 15 -hq -an. The -an (no audio) seemed to help with asf streaming so I left it in for swf also.

Regarding multicast, you mentioned rtsp and sdp... you should look at the mpeg4ip project supported by Cisco. I've compiled and run mp4live on my linux server and streamed multicast sdp hinted mpeg4 over my LAN. Quality is better than Flash and it uses ffmpeg, so cpu demand is low. You can also use mp4live to stream unicast diectly to a known IP address. I've had no success over the internet yet, though, need to study port requirements for multicast further, both server and client side. The project also recommends using mp4live with the open-source Apple Darwin Streaming Server. I have it running also, but don't have the link from mp4live configured properly yet.

Looking forward to progress in this area for all of us...
Rgds,
Mickey
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Hey Phil,
I light of this, I have been meaning to get around to pulling some of the config out of various areas (DB, configs within php, etc..) and utilizing the /etc/zm.conf to place the more static configuration stuff. Things like webuser, webgroup, all the paths, etc. Since all this are populated and available through zmconfig.pl to be set and the txt file produced has everything in it maybe there is a way to utilize it? I was originaly thinking to have zmconfig.pl produce the zm.conf and will most likely go that route unless there is a better way to go about it.

What are your thoughts?
Would this be usefull to you?

Regards,
Cordel
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I am also in favour of putting more of the fundamental config in zm.conf. the main obstacle at the moment is that the perl scripts in particular all have the config loading routines built into each script. This means that any changes are labourious to reproduce. I would like to take that out into a perl module so it is shared but that means figuring out all the correct protocols for where it needs to go etc.

Phil
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

mrreynolds wrote: I'm running a test now on 2 different servers wth Flash for about an hour, one on my LAN and one remote at my client's site. So far (45 min.) they're both tracking "real" time. BTW, my ffmpeg output options are: -r 15 -hq -an. The -an (no audio) seemed to help with asf streaming so I left it in for swf also.
This is interesting. I will have to experiment a little more and see what might affect the latency. I thought I would check whether it was a global issue or not before I spent time on it.
mrreynolds wrote: Regarding multicast, you mentioned rtsp and sdp... you should look at the mpeg4ip project supported by Cisco. I've compiled and run mp4live on my linux server and streamed multicast sdp hinted mpeg4 over my LAN. Quality is better than Flash and it uses ffmpeg, so cpu demand is low. You can also use mp4live to stream unicast diectly to a known IP address. I've had no success over the internet yet, though, need to study port requirements for multicast further, both server and client side. The project also recommends using mp4live with the open-source Apple Darwin Streaming Server. I have it running also, but don't have the link from mp4live configured properly yet.
y
I have looked at the DSS before and it looks fine for what I want. Except that I cannot for the life of me figure out how I feed the stream images into it. Everything in the docs seems to refer to pointing it to a directory that contains the files but gives no other details. As the images are already in memory I'd prefer not to have top write them to a file just to stream them but at least that would be a start. Getting streams out of DSS seems easy enough, I just can't divine how to get images in!

Phil
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi.

Thanks for the montage tip - now it works great. Are there any other spots in ZM, where this change should be done?

Regarding the memory usage, the FLV format, played via a SWF movie, may be more memory conservative. A simple SWF movie player, which accepts as a parameter a URL of the FLV, will be loaded by the browser. The ZM will be set to publish FLV, and this FLV stream will be fed in the SWF movie. Here are several links which talk about creating such movie: http://www.martijndevisser.com/2005/10/ ... dated.html and http://www.devarticles.com/c/a/Flash/Ma ... avaScript/
The FLV format/method was especially targeted for video, thus it may ease on the memory requirements, and allow more cameras in montage.

About the "ffmpeg output options", shouldn't these affect only the video generation, and not the live video streamed by ZM?

The idea of using mpeg4ip or Apple Darwin server is very interesting. Perhaps it can ease the load on the CPU, as the ZMS process take quite a lot when encoding the video?
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

What was the montage tip? I can't remember. As I'm revamping the streaming area slightly to allow for this change, if it's something useful I'll put it in.

You are right that adding ffmpeg parameters will only affect offline video and not live streaming, I missed that last night so there are very limited options t change. It seems strange the different experiences people are having. I cannot shake off this latency problem but I don't get any kind of excessive memory use on server or client and the cpu load of the zms process if about 0.1% which is neglibible. According to the About tab on the flash player I'm using version 7,0,19,0.

Thanks for the flv tips. I'll take a look.

Phil
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi.

Posted by mrreynolds:
"For Montage to work, you need to make the same changes to zm_html_view_montagefeed.php - otherwise it tries to load the swf stream into WMP. "

About the memory - for 5 cameras I have the iexplore/firefox processes climbing up to 100 MB and counting. Also, only 4 cameras work, which mean that perhaps the 5 has hit the memory limit?
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

i know this thread is progressing but wouldnt we be better overcoming the mpeg lag issue instead or does this flash thing give us much bigger benifits once its sorted??

James
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
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi.

AFAIK, mpeg lag could be only corrected by changing the streaming codec, or the player plugin. Thus I'm trying to see other alternatives, like Theora, but flash, if it works fine, can be a good solution as well.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

SyRenity wrote:Hi.

Posted by mrreynolds:
"For Montage to work, you need to make the same changes to zm_html_view_montagefeed.php - otherwise it tries to load the swf stream into WMP. "

About the memory - for 5 cameras I have the iexplore/firefox processes climbing up to 100 MB and counting. Also, only 4 cameras work, which mean that perhaps the 5 has hit the memory limit?
Ah, ok. I was already doing the changes everywhere anyway, well abstracting the streaming code out into functions to make it easier to mod.

I haven't noticed that the memory usage was going up in FF. Possibly because it routinely sits there with 200Mb memory usage anyway. I'll run some tests and see if it leaks.

Phil
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

SyRenity wrote:Hi.

AFAIK, mpeg lag could be only corrected by changing the streaming codec, or the player plugin. Thus I'm trying to see other alternatives, like Theora, but flash, if it works fine, can be a good solution as well.
I think the more solutions there are the better it is. However ultimately, for reliable real-time streaming I think udp based rtp/rtsp streaming is the answer and this is where I am concentrating at the moment. If I could figure out how to get the live video into the streaming server in the first place then the rest of it should be relatively easy.

Phil
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi.

Do you mean that you are looking for ways to basically feed video from ZM to a RTP/RTSP streaming server like Helix DNA Server or Darwin Streaming Server? This can be really good, although the CPU requirements should be considered as well.

BTW, MPEG4IP that was mentioned here, supports RTP/RTSP as well (http://mpeg4ip.sourceforge.net/features/index.php).
Locked