Ch00k / ffmpy

Pythonic interface for FFmpeg/FFprobe command line
MIT License
502 stars 53 forks source link

[Feature] Replace subprocess.Popen with psutil.Popen #81

Open HunterAP23 opened 2 weeks ago

HunterAP23 commented 2 weeks ago

This is more so to gauge interest in this feature. The psutil library is used for finding process information (such as CPU / memory usage) and overall system information. It also provides a wrapper to subprocess.Popen in their own psutil.Popen that makes tracking this information much easier.

I created my own Python class that inherits from ffmpy.FFmpeg where I replaced the process opening method so I can track resource usage, but I was curious if this is something others would want added to this library.

Ch00k commented 2 weeks ago

I think this is a good idea. I would, however, instead of replacing subprocess.Popen with psutil.Popen, make psutil an optional dependency, and, if it is installed, use psutil.Popen instead of subprocess.Popen. This way we'd keep backwards compatibility, and keep the package dependency-free by default.