From 0a9b632e48f85653029eea915429d5277fd96941 Mon Sep 17 00:00:00 2001 From: Mert <101130780+mertalev@users.noreply.github.com> Date: Fri, 15 Sep 2023 20:52:45 -0400 Subject: [PATCH] fix(server): use libopus for transcoding (#4102) * updated audio codec enum * added migration * updated api * fixed enum * formatting * simplified migration --- cli/src/api/open-api/api.ts | 2 +- mobile/openapi/lib/model/audio_codec.dart | Bin 2625 -> 2640 bytes server/immich-openapi-specs.json | 2 +- .../infra/entities/system-config.entity.ts | 2 +- .../1694758412194-UpdateOpusCodecToLibopus.ts | 21 ++++++++++++++++++ web/src/api/open-api/api.ts | 2 +- .../settings/ffmpeg/ffmpeg-settings.svelte | 2 +- 7 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 server/src/infra/migrations/1694758412194-UpdateOpusCodecToLibopus.ts diff --git a/cli/src/api/open-api/api.ts b/cli/src/api/open-api/api.ts index 0d8d4ca543..f4c0315426 100644 --- a/cli/src/api/open-api/api.ts +++ b/cli/src/api/open-api/api.ts @@ -752,7 +752,7 @@ export type AssetTypeEnum = typeof AssetTypeEnum[keyof typeof AssetTypeEnum]; export const AudioCodec = { Mp3: 'mp3', Aac: 'aac', - Opus: 'opus' + Libopus: 'libopus' } as const; export type AudioCodec = typeof AudioCodec[keyof typeof AudioCodec]; diff --git a/mobile/openapi/lib/model/audio_codec.dart b/mobile/openapi/lib/model/audio_codec.dart index f5b50006a690eec22c2afcb9a1026c1a0759846b..25c8332b0cc3d4510adb107605f97279ec3e79a9 100644 GIT binary patch delta 70 zcmX>oazSK63zJMvW>S7ZX|aN>f@5h)X1;TNN@}uRyhf2aP-5~dreN P<>Uh#qF_NiPGLp>gr68i delta 48 zcmca0a!_PL3zJxWL20pqt%74|N@l)ueoAVxUc5$;`s4*n&70Mjf3Qwg { + await queryRunner.query(` + UPDATE system_config + SET value = '"libopus"' + WHERE key = 'ffmpeg.targetAudioCodec' AND value = '"opus"' + `); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + UPDATE system_config + SET value = '"opus"' + WHERE key = 'ffmpeg.targetAudioCodec' AND value = '"libopus"' + `); + } +} diff --git a/web/src/api/open-api/api.ts b/web/src/api/open-api/api.ts index 0d8d4ca543..f4c0315426 100644 --- a/web/src/api/open-api/api.ts +++ b/web/src/api/open-api/api.ts @@ -752,7 +752,7 @@ export type AssetTypeEnum = typeof AssetTypeEnum[keyof typeof AssetTypeEnum]; export const AudioCodec = { Mp3: 'mp3', Aac: 'aac', - Opus: 'opus' + Libopus: 'libopus' } as const; export type AudioCodec = typeof AudioCodec[keyof typeof AudioCodec]; diff --git a/web/src/lib/components/admin-page/settings/ffmpeg/ffmpeg-settings.svelte b/web/src/lib/components/admin-page/settings/ffmpeg/ffmpeg-settings.svelte index a75b1ab0bf..fa46181db5 100644 --- a/web/src/lib/components/admin-page/settings/ffmpeg/ffmpeg-settings.svelte +++ b/web/src/lib/components/admin-page/settings/ffmpeg/ffmpeg-settings.svelte @@ -145,7 +145,7 @@ options={[ { value: AudioCodec.Aac, text: 'aac' }, { value: AudioCodec.Mp3, text: 'mp3' }, - { value: AudioCodec.Opus, text: 'opus' }, + { value: AudioCodec.Libopus, text: 'opus' }, ]} name="acodec" isEdited={ffmpegConfig.targetAudioCodec !== savedConfig.targetAudioCodec}