Long delay before MPEG4 video begins displaying

Symptom

When viewing video from OnGuard applications (Alarm Monitoring, VideoViewer, and so on) MPEG4 video takes several seconds to display, while MJPEG displays immediately.

Resolution

Reduce the Group of Video (GOV) setting on the camera (if supported). This speeds up the initial display of video and decreases degradation of video quality. However, this also increases the storage needs for the camera.

Applies To

OnGuard (All versions)
LNVR (All versions)

Additional Information

This behavior is the result of the difference in MPEG4 and MJPEG encoding.

Whereas an MJPEG stream sends full frame images all the time, an MPEG4 stream does not. An MPEG4 stream contains I frames and P frames (some streams also contain B frames, not discussed here for brevity).

An I-frame contains a full frame image, whereas a P-frame only stores the data that has changed from the preceding I-frame. An MPEG4 stream sequence looks like the following:
I P P P P P P P I P P P P P P P I P P . . .

When an MPEG4 stream is requested, the client starts receiving the video from anywhere inside the block of I and P frames, called the GOV. However, the MPEG4 decoder is unable to display any video until it encounters the first I frame.

There is always one I frame, but multiple P frames in a single GOV. This number is variable on a camera-by-camera basis. In the example stream above, the GOV setting is 8 (one I and seven P frames).

Thus, depending on the GOV setting for a specific camera as well as the frame rate that the camera is configured with, the time that it takes to encounter the first I frame may range from 0 to several seconds.

Example:

An Axis 214 MPEG4 camera, configured to display video at 4 frames per second, has a GOV setting of 30 (configurable through the camera's web page).

Thus, the client must wait between 0 and 7.5 seconds (30/4 fps) before encountering the first I frame in the stream and starting to display video.

Reducing the GOV setting on the camera to 8 reduces this range to between 0 and 2 seconds. While this speeds up the initial display of video and decreases the degradation, this also increases the storage needs for this camera.