This is my first time with MoviePy and OpenCV on Python and I’m neither a great expert with the language, but here’s my problem:
I’m trying to make an automatic video-editing program which basically adds a VHS effect overlay on an image for several minutes (3 to 10min in general). The videos must be 30 FPS, and for the VHS effect I’m using OpenCV to blend the image with the current frame of the overlay. I have no problem of doing that but the RAM usage is increasing a lot while I’m storing my result (~7GB of RAM used for only 30s video). I was wondering if any of you had an idea to fix the RAM usage? Here’s the code for the blending:
images_video_finale = []
i = 0
for frame in video.iter_frames(fps=_FPS_MAX):
i = i + 1
if i >= overlay.reader.nframes-1:
i = 1
img = overlay.get_frame(i/_FPS_MAX)
images_video_finale.append(cv2.addWeighted(frame, 0.5, img, 0.5, 0.0))
print(i)
If needed, I can put the whole code.
Thank you for your answers, and I wish you a good day 🙏
(Since I’m new with these libraries, I don’t really know what else I can try yet.)
Hell Kaiser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.