feat: optimize ffmpeg (#906)

This commit is contained in:
TheVisual 2024-04-27 06:23:03 -05:00 committed by GitHub
parent 7acfe42fc6
commit 638dba00cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -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"

View File

@ -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"