commit 638dba00ccc4ef7b3013b01aafadbc36d33bd935
parent 7acfe42fc6dbe5724046dc0904fa5a9c29d14f28
Author: TheVisual <132447890+TheVisual@users.noreply.github.com>
Date: Sat, 27 Apr 2024 06:23:03 -0500
feat: optimize ffmpeg (#906)
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
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,7 +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 += "-hwaccel mediacodec" //Use hwaccel If Available
this += "-y"
this += "-threads" to ffmpegOptions.threads.get().toString()
}
@@ -128,7 +128,7 @@ class FFMpegProcessor(
val outputArguments = ArgumentList().apply {
this += "-preset" to (ffmpegOptions.preset.getNullable() ?: "ultrafast")
- this += "-c:v" to (ffmpegOptions.customVideoCodec.get().takeIf { it.isNotEmpty() } ?: "libx264")
+ this += "-c:v" to (ffmpegOptions.customVideoCodec.get().takeIf { it.isNotEmpty() } ?: "h264_mediacodec")
this += "-c:a" to (ffmpegOptions.customAudioCodec.get().takeIf { it.isNotEmpty() } ?: "copy")
this += "-crf" to ffmpegOptions.constantRateFactor.get().let { "\"$it\"" }
this += "-b:v" to ffmpegOptions.videoBitrate.get().toString() + "K"
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
@@ -18,7 +18,7 @@ recyclerview = "1.3.2"
compose-bom = "2024.02.01"
bcprov-jdk18on = "1.77"
dexlib2 = "3.0.5"
-ffmpeg-kit = "5.1.LTS" # DO NOT UPDATE FFMPEG-KIT TO "5.1" it breaks stuff :3
+ffmpeg-kit = "6.0-2.LTS"
gson = "2.10.1"
junit = "5.10.2"
material3 = "1.2.0"
@@ -61,4 +61,4 @@ androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
-[bundles]
+[bundles]+
\ No newline at end of file