Open tengerdata opened 1 year ago
I'm facing the same issue, even when creating relatively simple and short videos. For instance, 1GB of memory is not enough to write a video of about 30 seconds with a single ImageClip as background and 5 TextClip.
+1
concatenating videos takes a lot of CPU, I ended up using ffmpeg to concate videos into one
I want to deploy my Flask app onto the server. I am trying to do it on DigitalOcean.
My Flask app edits and processes videos for the user; therefore, I use the library MoviePy to create it.
A minimal reproducible example would be something along the lines of:
app.py:
It works completely fine on my own PC, but once I deploy it onto DigitalOcean, I face the following error:
I can see that the error is raised after around 15% of the video is written. I understand that the error is cause by the following line:
This line uses a lot of memory; thus, causing the application to be restarted automatically after the error is raised. I know that it takes up a lot of memory to write this video, but there must be a away to reduce memory usage. I tried using
gc.collect()
before this line, but it doesn't help. It doesn't matter if the duration of rendering this video increases, I am just trying to reduce memory usage so that the no errors are raised and the video is outputted as expected.Is there a way to limit RAM usage for this line of code to under 1GB? On 1 vCPU? Or, what is the closest I could get to it. If it's not possible with MoviePy, what other libraries should I try?
My virtual environment versions:
Any help appreciated.