Search code examples
c#pythonvideo-streamingdelayvideo-capture

Show webcam stream with delay


I've been trying to find a way to show the stream of my webcam with a 30 second delay. I found out that VLC is able to do this, but the problem is that the framerate is much too low and it's not smooth or viewable at all. I have to run this on a fairly old laptop with a better webcam that I own now, so I guess it's not an option.

I am able somewhat familiar with c#/c++ and python so I thought that I might make a solution of my own as the task seems fairly easy. Though, the problem is, I don't know where to start and any nudges in the right direction would be much appreciated.

My initial idea was to record first 30 seconds of the stream to the disk, then use VLC to view partial file (AFAIK it's able to do that). Is it an idea worth working on or should I scratch it and use some sort of a buffer for the video frames in the last 30 seconds?

Again, any nudges in the right direction will be much appreciated, thanks!


Solution

  • Take a look at OpenCV. It can retrieve and show images from a webcam.

    A lot a of tutorials are also available; e.g. http://opencv.willowgarage.com/wiki/CameraCapture

    So simply create an array (or whatever) to hold the amount of pictures to be expected in 30 sec (FPS*30).

    Start to retrieve images and as soon as the array is filled start to play from position 0. Newly retrieved images can than be stored at the position from the "just" shown image.