1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-01 16:41:59 +00:00

fix(server): use libopus for transcoding (#4102)

* updated audio codec enum

* added migration

* updated api

* fixed enum

* formatting

* simplified migration
This commit is contained in:
Mert 2023-09-15 20:52:45 -04:00 committed by GitHub
parent 7fcc5a5417
commit 0a9b632e48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 5 deletions

View file

@ -752,7 +752,7 @@ export type AssetTypeEnum = typeof AssetTypeEnum[keyof typeof AssetTypeEnum];
export const AudioCodec = { export const AudioCodec = {
Mp3: 'mp3', Mp3: 'mp3',
Aac: 'aac', Aac: 'aac',
Opus: 'opus' Libopus: 'libopus'
} as const; } as const;
export type AudioCodec = typeof AudioCodec[keyof typeof AudioCodec]; export type AudioCodec = typeof AudioCodec[keyof typeof AudioCodec];

Binary file not shown.

View file

@ -5318,7 +5318,7 @@
"enum": [ "enum": [
"mp3", "mp3",
"aac", "aac",
"opus" "libopus"
], ],
"type": "string" "type": "string"
}, },

View file

@ -99,7 +99,7 @@ export enum VideoCodec {
export enum AudioCodec { export enum AudioCodec {
MP3 = 'mp3', MP3 = 'mp3',
AAC = 'aac', AAC = 'aac',
OPUS = 'opus', LIBOPUS = 'libopus',
} }
export enum TranscodeHWAccel { export enum TranscodeHWAccel {

View file

@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateOpusCodecToLibopus1694758412194 implements MigrationInterface {
name = 'UpdateOpusCodecToLibopus1694758412194'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
UPDATE system_config
SET value = '"libopus"'
WHERE key = 'ffmpeg.targetAudioCodec' AND value = '"opus"'
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
UPDATE system_config
SET value = '"opus"'
WHERE key = 'ffmpeg.targetAudioCodec' AND value = '"libopus"'
`);
}
}

View file

@ -752,7 +752,7 @@ export type AssetTypeEnum = typeof AssetTypeEnum[keyof typeof AssetTypeEnum];
export const AudioCodec = { export const AudioCodec = {
Mp3: 'mp3', Mp3: 'mp3',
Aac: 'aac', Aac: 'aac',
Opus: 'opus' Libopus: 'libopus'
} as const; } as const;
export type AudioCodec = typeof AudioCodec[keyof typeof AudioCodec]; export type AudioCodec = typeof AudioCodec[keyof typeof AudioCodec];

View file

@ -145,7 +145,7 @@
options={[ options={[
{ value: AudioCodec.Aac, text: 'aac' }, { value: AudioCodec.Aac, text: 'aac' },
{ value: AudioCodec.Mp3, text: 'mp3' }, { value: AudioCodec.Mp3, text: 'mp3' },
{ value: AudioCodec.Opus, text: 'opus' }, { value: AudioCodec.Libopus, text: 'opus' },
]} ]}
name="acodec" name="acodec"
isEdited={ffmpegConfig.targetAudioCodec !== savedConfig.targetAudioCodec} isEdited={ffmpegConfig.targetAudioCodec !== savedConfig.targetAudioCodec}