How to record video from a camera using OpenCV on Mac

Photo by Waldemar Brandt on Unsplash

OpenCV has several nuances and silent fails that makes recording videos from cameras difficult and frustrating. Here’s how to record from a camera:

Adapted from: https://stackoverflow.com/questions/29317262/opencv-video-saving-in-python/45868817

If your videos are being saved as ~6kb files, there is likely a size mismatch between the resolution of the camera and the VideoWriter.

Hope this helps.