Page 1 of 1

[FIX] ZM 1.24.2: Broken DVR controls and progress for events

Posted: Sat Feb 27, 2010 10:48 am
by mastertheknife
EDIT: I just did a test and changed the streaming mode from mpeg to jpeg. jpeg streaming (mjpeg) works fine. So if your mpeg mode is broken, you can use this fix or switch to jpeg mode which is probably the better solution because zoom works there.

If your ZM's DVR controls and progress isn't broken when watching an event in mpeg streaming mode, don't use this fix. I made this thread to help people suffering from the same problem i had, as described in this thread.

When viewing an event, the DVR controls (play, pause, slow rev, etc) were broken for me, they did nothing. And the progress indicator was far off, 2 seconds into the event, it already showed progress at like 47 seconds, and within about 30 seconds to the event, the progress showed 10 min (end of video).
After some debugging, i realized that the streaming type ZM uses is buffered, it plays at your FPS setting, but ZM wasn't sending frames to it at your FPS rate, but rather at over 50+ frames/second, which is why the controls weren't working for me and the progress was far off.
I'm not sure if others are suffering from this aswell, but i got it to work properly by changing some of the code.
I told it to sleep always when not paused, and at a calculated rate (line borrowed from zm_monitor.cpp) based on the replay rate. 5 fps at normal replay rate means 200 milliseconds between frames, giving us 5 fps/second.

In file src/zm_event.cpp, change the following which starts at around line 1360 (May vary from installation to installation):

Code: Select all

        if ( !paused )
        {
            curr_frame_id += replay_rate>0?1:-1;
            if ( send_frame && type != STREAM_MPEG )
            {
                Debug( 3, "dUs: %d", delta_us );
                usleep( delta_us );
            }
        }
To:

Code: Select all

        if ( !paused )
        {
            curr_frame_id += replay_rate>0?1:-1;
			   usleep((unsigned long)((1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate))));
        }
Now recompile ZM and copy the compiled src/zms to your cgi-bin folder overwriting nph-zms and zms.

NOTE: When playing the video at high replay rate, the video may lag a little e.g. progress shows 5:30 min but actual video shows 4:50 min, video barely catching up with high replay rate.
I fixed that by going into Options and setting the maxfps for streaming for High,Medium and Low to my capture fps (5 in my case) and now its working perfectly.

mastertheknife.

Posted: Tue Mar 09, 2010 4:31 pm
by estranged1977
Hi, one question , qhen you say recompile is to make configure and then make???

Posted: Sun Mar 14, 2010 8:53 pm
by mastertheknife
make should be enough.

mastertheknife

Did not work for me

Posted: Sat Jun 19, 2010 12:11 pm
by Jason_Bassett
Hello

Using Zoneminder 1.24.2 with STREAM_METHOD jpeg.

This fix has not worked for me, my playback controls are not functioning at all and I see no movement in the progress bar. The recorded events do playback but I am just unable to control them (pause/play/rewind/forward).

The old method of playback in previous versions of Zoneminder worked flawlessly for me. Is there any way to revert to that method within this version?

Jason

Posted: Fri Sep 17, 2010 9:44 am
by mastertheknife
The fix above is for MPEG mode.

For the controls to work you need some php extensions enabled such as sockets, try searching the forum.

Recompiled PHP with sockets support

Posted: Sun Sep 19, 2010 4:54 pm
by Jason_Bassett
Thankyou, it worked a treat.

Added 'sockets' to the USE flags and recompiled PHP. Restarted Apache and now I am able to pause/start/rewind recorded events. The fps are also showing up now too.

Jason

Posted: Sun Sep 19, 2010 8:57 pm
by mastertheknife
Hi,

Thats good to hear!
Is the progress bar showing up? if not, please look into this bugfix:
http://www.zoneminder.com/forums/viewtopic.php?t=15387

mastertheknife.

Progress bar...

Posted: Sun Sep 19, 2010 9:56 pm
by Jason_Bassett
Yes its appearing fine.

It is also allowing me to zoom into the image when I click on it. But I am unsure how to zoom out again!

Jason

Re: Progress bar...

Posted: Sun Sep 19, 2010 10:00 pm
by mastertheknife
Jason_Bassett wrote:Yes its appearing fine.

It is also allowing me to zoom into the image when I click on it. But I am unsure how to zoom out again!

Jason
You can un-zoom by using the minus button which is located in the controls :)

Suggestion

Posted: Sun Sep 19, 2010 10:47 pm
by Jason_Bassett
Ah I see, thanks.

It would be nice in future releases to be able to scroll around the zoomed in image instead of having to zoom out and then back in again. Or use a scroll mouse.

Jason