I know the name is a bit vague, but I'm not sure how else to describe it.
CentOS with ffmpeg + OpenCV 2.4.9. I am working on a simple motion detection system that uses stream from an IP camera (h264).
From time to time, the stream hiccups and throws a "bad frame" (see pic-bad.png link below). The problem is that these frames are significantly different from previous frames and cause the "motion" event to fire even if no actual movement has occurred.
Below are the illustrations below.
Good shot (motion capture):

Bad frame (no movement, only a broken frame):

A bad frame gets by accident. I guess I can make a bad frame detector by analyzing (looping) through the pixels going down from a certain position to see if they are all the same, but I wonder if there are other, more effective, "according to the book," approach to detecting these types of bad frames and just skip them.
Thanks!
EDIT UPDATE:
The frame is captured using the C ++ motion detection program through cvQueryFrame(camera); , so I do not directly interact with ffmpeg, OpenCV does it on the backend. I am using the latest ffmpeg compiled from a git source. All libraries are also updated (h264, etc., all downloaded and compiled yesterday). Data comes from the RTSP stream (ffserver). I tested several cameras (dahua models 1-3 MP), and frame failure is very stable for all of them, although this does not happen all the time, only once in a while (for example: once every 10 minutes).
c ++ opencv ffmpeg motion
user3630380
source share