opencvvideoffmpegvideo-streamingxuggler

Video stream analysis on the fly - advise?


I'm planning to develop a simple solution that would able me to perform a very basic video stream analysis on the fly. I've never done anything like that before, hence the very general and open question. The main focus is on checking if the stream is going without problems like - freeze frames, black screens and if the audio is there. Sync is out of scope. I read about open libraries like OpenCV and Xuggler, but they seem more complex than for my needs. FFmpeg is able to detect black screens, but not on the fly.

Is there any other open lib I could look into? Could you advise me anything? I'm thinking about using Java or Python. Or maybe both. Efficiency of the solution is out of scope, I'm focusing now only on freeze frames and black screens detection.

Any advise is welcome!

Best regards, Peter


Solution

  • You can analyze a live stream on-the-fly with ffmpeg. For example:

    ffmpeg -i <input> -filter:v blackdetect=d=9 -filter:a silencedetect=d=9 -t 10 -f null /dev/null

    checks if 9s out 10s of video are black or silent. Repeat.

    In recent versions of FFmpeg you can use the freezedetect filter to detect frames that don't change.

    If you need different metrics you can take two screen-shots at different times and compare them with imagemagick:

    compare -metric <metric> <in1> <in2> <diff>