roop
roop copied to clipboard
Add FFMpeg hardware acceleration
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.
Please resolve conflicts, we merge to next always
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.
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
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()