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

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
mastertheknife
Posts: 667
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel
Contact:

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

Postby mastertheknife » Sat Feb 27, 2010 10:48 am

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.

estranged1977
Posts: 15
Joined: Wed Feb 17, 2010 1:57 am

Postby estranged1977 » Tue Mar 09, 2010 4:31 pm

Hi, one question , qhen you say recompile is to make configure and then make???

mastertheknife
Posts: 667
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel
Contact:

Postby mastertheknife » Sun Mar 14, 2010 8:53 pm

make should be enough.

mastertheknife

Jason_Bassett
Posts: 42
Joined: Wed Mar 05, 2008 10:33 pm
Location: Stanford-Le-Hope, Thurrock, Essex
Contact:

Did not work for me

Postby Jason_Bassett » Sat Jun 19, 2010 12:11 pm

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
Corrilan IT Consultancy Ltd
http://www.corrilan.com
01375 403508
enquiries@corrilan.com

mastertheknife
Posts: 667
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel
Contact:

Postby mastertheknife » Fri Sep 17, 2010 9:44 am

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.

Jason_Bassett
Posts: 42
Joined: Wed Mar 05, 2008 10:33 pm
Location: Stanford-Le-Hope, Thurrock, Essex
Contact:

Recompiled PHP with sockets support

Postby Jason_Bassett » Sun Sep 19, 2010 4:54 pm

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
Corrilan IT Consultancy Ltd

http://www.corrilan.com

01375 403508

enquiries@corrilan.com

mastertheknife
Posts: 667
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel
Contact:

Postby mastertheknife » Sun Sep 19, 2010 8:57 pm

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.

Jason_Bassett
Posts: 42
Joined: Wed Mar 05, 2008 10:33 pm
Location: Stanford-Le-Hope, Thurrock, Essex
Contact:

Progress bar...

Postby Jason_Bassett » Sun Sep 19, 2010 9:56 pm

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
Corrilan IT Consultancy Ltd

http://www.corrilan.com

01375 403508

enquiries@corrilan.com

mastertheknife
Posts: 667
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel
Contact:

Re: Progress bar...

Postby mastertheknife » Sun Sep 19, 2010 10:00 pm

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 :)

Jason_Bassett
Posts: 42
Joined: Wed Mar 05, 2008 10:33 pm
Location: Stanford-Le-Hope, Thurrock, Essex
Contact:

Suggestion

Postby Jason_Bassett » Sun Sep 19, 2010 10:47 pm

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
Corrilan IT Consultancy Ltd

http://www.corrilan.com

01375 403508

enquiries@corrilan.com


Return to “User Contributions”

Who is online

Users browsing this forum: No registered users and 1 guest