0

I want to read frame by frame from existing video, and create new video from these frames.

In my real project I want to change each frame before making the new video but for simplicity's sake of this question I just want to create new video from the same frames without any change.

1 Answer 1

1

This code is working for me:

import cv2 vidcap = cv2.VideoCapture('input_video.mp4') vidwrite = cv2.VideoWriter('output_video.mp4', cv2.VideoWriter_fourcc(*'MP4V'), 30, (1920,1080)) success,image = vidcap.read() while success: vidwrite.write(image) # write frame into video success,image = vidcap.read() # read frame from video vidwrite.release() cv2.destroyAllWindows() 

The strange thing is that the output video is twice bigger than the input video

Sign up to request clarification or add additional context in comments.

1 Comment

"The strange thing" -- not really. It just means that the default configuration used by this particular codec in OpenCV is different to what the author of the source video used to encode it. This is nothing unusual when dealing with data compression.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.