diff --git a/src/main/kotlin/pw/binom/mirror/worker/config/AppProperties.kt b/src/main/kotlin/pw/binom/mirror/worker/config/AppProperties.kt index 5e72997..54d6af9 100644 --- a/src/main/kotlin/pw/binom/mirror/worker/config/AppProperties.kt +++ b/src/main/kotlin/pw/binom/mirror/worker/config/AppProperties.kt @@ -14,6 +14,7 @@ data class AppProperties( val ffprobePath: String = "ffprobe", val localFileStorage: Path = Path.of("/tmp/media-mirror-worker"), val ffmpegThreadCount: Int? = null, + val videoCodec: String = "h264_nvenc", ) { data class Jellyfin( val url: String = "", diff --git a/src/main/kotlin/pw/binom/mirror/worker/convert/JobExecutor.kt b/src/main/kotlin/pw/binom/mirror/worker/convert/JobExecutor.kt index 19684fd..f716050 100644 --- a/src/main/kotlin/pw/binom/mirror/worker/convert/JobExecutor.kt +++ b/src/main/kotlin/pw/binom/mirror/worker/convert/JobExecutor.kt @@ -100,7 +100,7 @@ class JobExecutor( output = videoFile, width = newWidth, height = newHeight, - videoCodec = VIDEO_CODEC, + videoCodec = props.videoCodec, removeAudio = true, removeSubtitles = true, removeMetadata = true, @@ -154,7 +154,6 @@ class JobExecutor( } companion object { - private const val VIDEO_CODEC = "libvpx-vp9" private const val MAX_HEIGHT = 480 private const val VIDEO_CONTAINER = "mkv" private const val AUDIO_CODEC = "libvorbis" diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index f99ecff..f106462 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -24,6 +24,7 @@ app: ffmpegPath: ffmpeg ffprobePath: ffprobe localFileStorage: /tmp/media-mirror-worker + videoCodec: h264_nvenc server: port: 8081 diff --git a/src/test/kotlin/pw/binom/mirror/worker/JobPollerTest.kt b/src/test/kotlin/pw/binom/mirror/worker/JobPollerTest.kt index d0dd645..9a0f0a3 100644 --- a/src/test/kotlin/pw/binom/mirror/worker/JobPollerTest.kt +++ b/src/test/kotlin/pw/binom/mirror/worker/JobPollerTest.kt @@ -54,6 +54,7 @@ class JobPollerTest : AbstractMinioTest() { registry.add("app.s3.prefix") { "mirror" } registry.add("app.ffmpegPath") { "/usr/bin/ffmpeg" } registry.add("app.ffprobePath") { "/usr/bin/ffprobe" } + registry.add("app.videoCodec") { "libx264" } registry.add("app.localFileStorage") { Files.createTempDirectory("mmw-worker-test").toString() } diff --git a/src/test/kotlin/pw/binom/mirror/worker/convert/JobExecutorTest.kt b/src/test/kotlin/pw/binom/mirror/worker/convert/JobExecutorTest.kt index 423febd..5ac2f57 100644 --- a/src/test/kotlin/pw/binom/mirror/worker/convert/JobExecutorTest.kt +++ b/src/test/kotlin/pw/binom/mirror/worker/convert/JobExecutorTest.kt @@ -23,6 +23,7 @@ class JobExecutorTest : AbstractMinioTest() { ffmpegPath = "/usr/bin/ffmpeg", ffprobePath = "/usr/bin/ffprobe", localFileStorage = tempDir, + videoCodec = "libx264", ) private fun executor(): JobExecutor {