1 | initial version |
The size of the final output of the video is directly related to the codec used to store that video file in. Codecs can be categorized as compressed and uncompressed, and can be further broken down into lossy and lossless. You can read more about compression formats here. Some popular compressed codecs are H.264 or MPEG-4. Of course, the more compressed the video is, the more likely you'll lose quality with the final video (a lossy codec), so you'll have to experiment with different codecs to see which one is suitable for your needs.
That said, you can affect the type of codec you use in the construction of the VideoWriter object, namely the fourcc parameter. Here is the page for the codecs supported by fourcc. I would recommend starting with some of the popular codecs like MPG4, H264, or MJPG since your project seems to require higher compression rates.