Ask Your Question
0

What is the smallest output video size possible for 620/480 resolution?

asked 2013-03-23 22:03:27 -0600

I am working on a simple video writer program. However, when I use the I420 codec (which so far has been the only one that works with my computer), the output video file is quite large. It's about 80MB for 30 sec. I wanted to work on a program which records at least 10 minutes of video and at this rate it will end up being 1.6GB. How is it that some movies which are 1:30 are less than a GB and is there any way to further 'compress' the video file output?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-03-23 22:39:03 -0600

HD_Mouse gravatar image

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.

edit flag offensive delete link more

Comments

Thanks for your answer! I hope you can answer another question I have that continues of my previous one. A lot of the codec types I use just don't seem to create any files or just wont work (cv2.videwriter.isOpened() returns FALSE or video file is 0 bytes). Is there a specific...rule or pairing of file extension name and codec I should be using? For example, if I use MPG4 with my file.avi it doesn't work. Am I doing this wrong?

user1601395230 gravatar imageuser1601395230 ( 2013-03-24 01:06:35 -0600 )edit

Check out this link for some more info on the pairings. I think the codec that will work on your machine depends on what has been installed on there (more specifically, a library such as gstreamer or ffmpeg). The link above contains some codecs that should work on your machine.

HD_Mouse gravatar imageHD_Mouse ( 2013-03-25 11:17:01 -0600 )edit

Question Tools

Stats

Asked: 2013-03-23 22:03:27 -0600

Seen: 4,851 times

Last updated: Mar 23 '13