commit 7af0e1e55804739f357f5730c98d1de3f01400f9
parent 55d76d23a6ebb2be3b04be036bb725ec434c6ce2
Author: TheVisual <132447890+TheVisual@users.noreply.github.com>
Date:   Sun, 14 Apr 2024 08:54:58 -0500

feat: ffmpeg hardware acceleration (#899)

* Bump threads to 4 (20-30% CPU Increase)
+ Add -hwaccel auto flag
Diffstat:
Mapp/src/main/kotlin/me/rhunk/snapenhance/download/FFMpegProcessor.kt | 1+
Mcommon/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/DownloaderConfig.kt | 2+-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/download/FFMpegProcessor.kt b/app/src/main/kotlin/me/rhunk/snapenhance/download/FFMpegProcessor.kt @@ -115,6 +115,7 @@ class FFMpegProcessor( // load ffmpeg native sync to avoid native crash synchronized(this) { FFmpegKit.listSessions() } val globalArguments = ArgumentList().apply { + this += "-hwaccel auto" //Use hwaccel If Available this += "-y" this += "-threads" to ffmpegOptions.threads.get().toString() } diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/DownloaderConfig.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/DownloaderConfig.kt @@ -6,7 +6,7 @@ import me.rhunk.snapenhance.common.config.FeatureNotice class DownloaderConfig : ConfigContainer() { inner class FFMpegOptions : ConfigContainer() { - val threads = integer("threads", 1) + val threads = integer("threads", 4) // Bump Default Value to 4 Tested on Pixel 5 (Qualcomm Snapdragon 765G) Had no lag val preset = unique("preset", "ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow") { addFlags(ConfigFlag.NO_TRANSLATE) }