roop icon indicating copy to clipboard operation
roop copied to clipboard

Add FFMpeg hardware acceleration

Open joskfg opened this issue 1 year ago • 1 comments

It increases FPS extraction in my machine between x3 - x6. It also decrease the other processing time, but I just tried with short videos, so nothing noticeable.

joskfg avatar Jun 02 '23 17:06 joskfg

Please resolve conflicts, we merge to next always

henryruhs avatar Jun 02 '23 18:06 henryruhs

If you run ffmpeg -hwaccel cuda on a non-CUDA platform, you will get an error message indicating that CUDA acceleration is not available. This is because CUDA is a NVIDIA GPU computing platform and requires NVIDIA graphics hardware to function. The error message might vary depending on the operating system and the version of ffmpeg that you are using.

For example, if you are using Ubuntu Linux, you might see an error message similar to:

Error initializing CUDA: Invalid device ordinal
Impossible to load the plugin 'cuda'. Make sure it is installed.

That means we need --gpu=nvidia|amd|intel for sure before we can merge this PR. Should be added als choices=['nvidia', 'amd', 'intel'] to the args setup.

henryruhs avatar Jun 02 '23 19:06 henryruhs

sorry for being late

ffmpeg can automatically detect types of hardware acceleration with:

ffmpeg -hwaccel auto

also i suggest to add -hide_banner to hide more ffmpeg verbosity

phineas-pta avatar Jun 02 '23 22:06 phineas-pta

also on low VRAM + long video, ffmpeg -hwaccel cuda may cause cuda out-of-memory, you should consider adding torch.cuda.empty_cache() after start_processing()

phineas-pta avatar Jun 02 '23 22:06 phineas-pta