From 677ba5e22891915aa9d83b22cd406769f35079f1 Mon Sep 17 00:00:00 2001 From: Kevin Cox Date: Sat, 12 Oct 2024 08:38:32 -0400 Subject: [PATCH] Use STV-AV1 encoder for AV1. STV-AV1 is much, much faster than the reference libaom encoder. In most real-world cases libaom is too slow to be practical, often struggling to achieve 0.1fps for 1080p content. I suspect this is what was intended in f1ca1794a182d71e45340a262a450e694f4f1600 when AV1 support was originally added as it sets the `-svtav1-params` flag which is ignored unless using the STV-AV1 encoder. Furthermore there is lots of discussion about STV-AV1 in the PR thread. --- server/src/services/media.service.spec.ts | 2 +- server/src/utils/media.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/services/media.service.spec.ts b/server/src/services/media.service.spec.ts index 08e49f088a0bd..0ef065c5f452c 100644 --- a/server/src/services/media.service.spec.ts +++ b/server/src/services/media.service.spec.ts @@ -1322,7 +1322,7 @@ describe(MediaService.name, () => { expect.objectContaining({ inputOptions: expect.any(Array), outputOptions: expect.arrayContaining([ - '-c:v av1', + '-c:v libsvtav1', '-movflags faststart', '-fps_mode passthrough', '-map 0:0', diff --git a/server/src/utils/media.ts b/server/src/utils/media.ts index 6f0ab4ef81d90..8ba9006ac18d6 100644 --- a/server/src/utils/media.ts +++ b/server/src/utils/media.ts @@ -492,6 +492,10 @@ export class VP9Config extends BaseConfig { } export class AV1Config extends BaseConfig { + getVideoCodec(): string { + return "libsvtav1"; + } + getPresetOptions() { const speed = this.getPresetIndex() + 4; // Use 4 as slowest, giving us an effective range of 4-12 which is far more useful than 0-8 if (speed >= 0) {