Framerate limit for asf streaming (urgent)

Support and queries relating to all previous versions of ZoneMinder
Locked
loop
Posts: 69
Joined: Thu Nov 06, 2003 3:10 pm

Framerate limit for asf streaming (urgent)

Post by loop »

How can be mpeg or mjpeg video streaming from ZM limited to, for example 1 fps, where this camera is being recorded at 20 fps?

Thank you,
Darko
User avatar
fernando
Posts: 240
Joined: Thu Jul 10, 2003 6:00 pm

Post by fernando »

if is on modect yes. have to ZM_NO_MAX_FPS_ON_ALARM on.
Fernando
loop
Posts: 69
Joined: Thu Nov 06, 2003 3:10 pm

Post by loop »

Thank you Fernando, but we don't have this option checked. The problem is that we want to capture at fixed 5fps (he have Maximum fps set to 5), but we want to stream only at 1 fps.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Have you tried modifying the ZM_WEB_x_VIDEO_MAXFPS settings on Options->High B/W (plus Medium, Low etc).

It's not a per monitor settings but should limit the rate at which you see all streams.

Phil
loop
Posts: 69
Joined: Thu Nov 06, 2003 3:10 pm

Post by loop »

Have tried, but no change. If camera's MAX_FPS is set to 10 then it's also streamed at 10fps, even when we set ZM_WEB_x_VIDEO_MAXFPS to 1 fps.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I will look into this and see if I can find where there might be a problem.

Phil
loop
Posts: 69
Joined: Thu Nov 06, 2003 3:10 pm

Post by loop »

Thank you Phil. I'm working on some special low bandwidth streaming where the fps streaming limitation would be great.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I've found the problem with this. I have fixed it for the next version but I can post the changes you would need to make here if you would prefer. It's only a couple of lines really.

Phil
User avatar
victor_diago
Posts: 245
Joined: Wed Jan 21, 2004 2:44 pm
Location: Brazil, sao paulo
Contact:

Post by victor_diago »

Hi phil.

is there a way to limit the java streaming aswell ?
i would like also to capture at 7 fps but record at 2 fps, i know that there is a way with record mode, but not modect, and is another way setting two cameras for the same video source, but as i use multiplexed bt878 cards this makes capture even slower.

is there a way ?

thanks you

victor diago
loop
Posts: 69
Joined: Thu Nov 06, 2003 3:10 pm

Post by loop »

Yes Phil, I'd appreciate if you would post the changes here already.
Thank you.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Assuming you have the latest version, edit zm_monitor.cp and go to line 1411. Change the line

Code: Select all

VideoStream vid_stream( "pipe:", format, bitrate, fps, camera->Colours(), (width*scale)/ZM_SCALE_SCALE, (height*scale)/ZM_SCALE_SCALE );
to

Code: Select all

VideoStream vid_stream( "pipe:", format, bitrate, effective_fps, camera->Colours(), (width*scale)/ZM_SCALE_SCALE, (height*scale)/ZM_SCALE_SCALE );
ie. change fps to effective_fps. Then go down a few lines until you see

Code: Select all

            if ( (frame_mod == 1) || ((frame_count%frame_mod) == 0) )
            {
                last_read_index = shared_data->last_write_index;
and move the last_read index line above the 'if' leaving you with

Code: Select all

            last_read_index = shared_data->last_write_index;
            if ( (frame_mod == 1) || ((frame_count%frame_mod) == 0) )
            {
I think that should do it. I'm still researching this as I can't exactly work out why the second chage should make a positive difference but it seems to. So the real fix may be slightly different however this should get you going.

Phil
User avatar
victor_diago
Posts: 245
Joined: Wed Jan 21, 2004 2:44 pm
Location: Brazil, sao paulo
Contact:

Post by victor_diago »

Hi phil,

This is a urgent problem for me, could you please take a look ? i will learn about encoding mpeg and try too look at code too, this is casing me headaches !!!!

sometimes, when using mplayer (or ffplay directly) i cant connect to the mpeg stream, it gives me this error :

Code: Select all

Playing http://localhost/cgi-bin/zms?mode=mpeg&monitor=1&scale=100&bitrate=150000&maxfps=15&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) 
If i try sometimes, i can connect and watch stream, but it gives me another errors as output. Then, the delay from captured image to showed one, tha was usually 2 seconds, gradually grow and in four hours i have about 8 seconds delay.

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 

Locked