See my attached demo. The first half extracts frames from a movie and saves them to disk as individual images. The second half reconstructs the video by reading in those images and using VideoWriter it makes a video file. You can just do that, though you won't have to call imread() since your frames are already in memory.
Best Answer