Open Netherdrake opened 9 years ago
You can either start different python scripts (your os will do the job of dispatching them to the different CPUs) or use the python module called "multiprocessing" (it's in the standard library) which enables you to spawns processes in different threads, one in each core.
For that I already have a solution.
I am interested in multi-threading support within 1 rendering job.
It would be great to have several instances of make_frame
working simultaneously in VideoClip
creation.
Multithreading for a single composition would be awesome.
@Zulko we are facing an issue that our backend goes down once in a while which is using moviepy in a multithreading setting. Our suspicion is that it may have to be with concurrent use. Could you please advice whether the moviepy is thread-safe or needs to be started in a separate process.
Also, i am wondering if, when the conversion is underway, the GIL is released. We are serving quite a few users on a multi-core machine and would like to utilize the CPU to the max. Thanks
^ I added a proof of concept multithreading support, albeit a bit gimmicky it appears to be working.
@MythicManiac I'm following your guide from https://github.com/Zulko/moviepy/pull/698#issuecomment-359198640
from moviepy.multithreading import multithread_write_videofile
But I got "Exception has occurred: ModuleNotFoundError No module named 'moviepy.multithreading' What happening?
Quoting what I already mentioned in that PR:
I'm not able to provide support on this given that it's already over 2 years old and was never merged, not to mention it was more of a proof of concept anyway.
https://github.com/MythicManiac/moviepy/blob/18e1bd817b6e554319567b82f921fa6f09ab0530/tests/test_multithreading.py the test here is a working example, refer to that and the code itself.
Do realize that the example code was from a fork, which was never merged
Suppose I have 8-core server or 32-core mac pro.
Is there any way to make moviepy/ffmpeg utilize all CPU cores for each rendering job?