Anime4000 / IFME

Powerful x265 GUI Encoder
https://x265.github.io/
GNU General Public License v2.0
249 stars 54 forks source link

Allow multiple instances of IFME #167

Closed MycroftHolmes1989 closed 4 years ago

MycroftHolmes1989 commented 6 years ago

Since I'm using a Ryzen system for IFME, each instance only takes up about 50% of CPU usage. I can easily run two instances of IFME simultaneously. Problem is, there usually is a clash in TEMP folder. The second instance tries Clearing temp folder which it fails to do, because it's locked up by the first instance. I would suggest you to create a new folder inside TEMP folder and name it as the file that's being encoded. After the completion of encoding each file, the corresponding temporary folders should be deleted. That way, there would be less chances of collision and will allow multiple instances of IFME to run.

For example, if I am trying to encode a file named xyz.mp4 in the first instance, I want the temporary files in a folder called TEMP/xyz. If the second instance tries to encode another file with the same name, then another folder should be created inside TEMP as xyz(1) and put the corresponding temporary files inside that. When the encoding of xyz.mp4 completes successfully, the folder TEMP/xyz should be deleted. It will also help people to see any failed encoding in case of power failure, BSOD or other crashes.

Anime4000 commented 6 years ago

I think I can add "sessions" inside temp folder, like %TEMP%/session-001

however, when you run multiple instance, you cannot pause or even stop... this problem because of pipe |, .NET cannot see process id for pipe program. what I do is, search running process and kill/halt...

nature of .NET for manage process very weak

MycroftHolmes1989 commented 6 years ago

I see. Then I think it's better if you allow multiple simultaneous file encoding instead of multiple instances. Asynchronous programming will allow you to do that. Doing 2-3 file encoding at once will be more than sufficient.

MycroftHolmes1989 commented 6 years ago

And instead of sessions folder, please use the name of the file being encoded as the name of the folder. That would actually help us to check if a file was successfully encoded.

Anime4000 commented 6 years ago

yes, instead of run multiple ifme, run multiple encoding at single instance. probably will break Linux compatibility.

I try find workaround to make sure .NET can manage pipe | process.