Frames to video using cv2.VideoWriter() in Python 3

The original video size is say 1MB. I split the video into frames. . After that, if I write these frames to a video using cv2.VideoWriter() in python 3 then the size of this new video will be 2MB. Why the size of the video got increased?

most video files use compression. compression types and strengths vary.

this is not specific to OpenCV. it applies to video file formats in general.

1 Like

Thank you for the reply. Is there a way in opencv python or ffmpeg python to assemble frames to a video in such a way that the size remains same as the original?

what codec does the original file use?

using ffmeg.probe() I get this output-> codec_name’: ‘h264’, ‘codec_long_name’: 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10

why do you require the output video to be the same size as the input video? why does this matter to you?

you should perhaps use ffmpeg libraries directly.

Thank you for the reply. I think i can try with opencv-3