sightmachine/SimpleCV — pull request #568 by maraujop (2013-08-18 12:34:56+00:00)
Title: Updating VideoStream to cv2, refactoring and added realtime kwarg

* Removing code lines commented out
* Updated VideoStream to use newer cv2 `VideoWriter`, `cv.createVideoStream` is considered legacy.
* Adding a `realtime` kwarg, to be used in conjuction with `framefill`. If writing to video goes really fast, frames are buffered in a list and written whenever time is in track.
* Calculating `frametime` once in the constructor, this value doesn't change. This way extra calculations are avoided.
* Added a `codec` parameter, so that `codec` can be set from the outside and setting default to a newer codec like `xvid`. `iyuv` doesn't work in many operating systems and it uses a lot of space for a video file.

To be honest, I know these are many changes to go in a single commit in a single PR, sorry about that.

I was processing a video of 11 seconds and after saving all processed images, it was 3 seconds long (with `framefill=True`), that was because my laptop was processing it too fast. That's why I've crafted a `realtime` parameter, that buffers images for writing them at due time. That is working great with my previous use case. I wasn't sure if set it to default `True`, instead of `False`.

Anyway, I have another use case where my laptop goes to slow and I save a frame per 0.5 seconds. `framefill` is not doing much there and I'm not sure if there is a solution for this problem, besides getting a faster computer.

`iyuv` creates huge video files, that's why I changed it to a newer codec and I've made possible to change it.

If there is anything you want to discuss, let me know.

Cheers,
Miguel