[SOLVED] How to edit video frames without extracting each frame first ? OpenCV

Issue

This Content is from Stack Overflow. Question asked by fribeiro98

I am currently extracting frames from a video so I can add some bounding boxes in each frame. Then, I want to put all the frames together and make a new video, using openCV. The problem is that every time I want to do that, I have to extract thousand of frames first. Is there a way to do it without having to extract the frames?
Thanks



Solution

That assumption isn’t correct. You can use OpenCV’s VideoCapture to load a video, get a frame, do some processing on it and save it using a VideoWriter object – one frame at a time. There is no need to load all frames into memory and then store them all at once.


This Question was asked in StackOverflow by fribeiro98 and Answered by code-lukas It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?