mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
refactor(server): modularize getFfmpegOptions (#3138)
* refactored `getFfmpegOptions` refactor transcoding, make separate service * fixed enum casing * use `Logger` instead of `console.log` * review suggestions * use enum for `getHandler` * fixed formatting * Update server/src/domain/media/media.util.ts Co-authored-by: Jason Rasmussen <jrasm91@gmail.com> * Update server/src/domain/media/media.util.ts Co-authored-by: Jason Rasmussen <jrasm91@gmail.com> * More specific imports, renamed codec classes * simplified code * removed unused import * added tests * added base implementation for bitrate and threads --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
@@ -746,6 +746,21 @@ export const AssetTypeEnum = {
|
||||
export type AssetTypeEnum = typeof AssetTypeEnum[keyof typeof AssetTypeEnum];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export const AudioCodec = {
|
||||
Mp3: 'mp3',
|
||||
Aac: 'aac',
|
||||
Opus: 'opus'
|
||||
} as const;
|
||||
|
||||
export type AudioCodec = typeof AudioCodec[keyof typeof AudioCodec];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -2411,24 +2426,30 @@ export interface SystemConfigFFmpegDto {
|
||||
* @memberof SystemConfigFFmpegDto
|
||||
*/
|
||||
'threads': number;
|
||||
/**
|
||||
*
|
||||
* @type {VideoCodec}
|
||||
* @memberof SystemConfigFFmpegDto
|
||||
*/
|
||||
'targetVideoCodec': VideoCodec;
|
||||
/**
|
||||
*
|
||||
* @type {AudioCodec}
|
||||
* @memberof SystemConfigFFmpegDto
|
||||
*/
|
||||
'targetAudioCodec': AudioCodec;
|
||||
/**
|
||||
*
|
||||
* @type {TranscodePolicy}
|
||||
* @memberof SystemConfigFFmpegDto
|
||||
*/
|
||||
'transcode': TranscodePolicy;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SystemConfigFFmpegDto
|
||||
*/
|
||||
'preset': string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SystemConfigFFmpegDto
|
||||
*/
|
||||
'targetVideoCodec': string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SystemConfigFFmpegDto
|
||||
*/
|
||||
'targetAudioCodec': string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -2447,22 +2468,8 @@ export interface SystemConfigFFmpegDto {
|
||||
* @memberof SystemConfigFFmpegDto
|
||||
*/
|
||||
'twoPass': boolean;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SystemConfigFFmpegDto
|
||||
*/
|
||||
'transcode': SystemConfigFFmpegDtoTranscodeEnum;
|
||||
}
|
||||
|
||||
export const SystemConfigFFmpegDtoTranscodeEnum = {
|
||||
All: 'all',
|
||||
Optimal: 'optimal',
|
||||
Required: 'required',
|
||||
Disabled: 'disabled'
|
||||
} as const;
|
||||
|
||||
export type SystemConfigFFmpegDtoTranscodeEnum = typeof SystemConfigFFmpegDtoTranscodeEnum[keyof typeof SystemConfigFFmpegDtoTranscodeEnum];
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -2749,6 +2756,22 @@ export const TimeGroupEnum = {
|
||||
export type TimeGroupEnum = typeof TimeGroupEnum[keyof typeof TimeGroupEnum];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export const TranscodePolicy = {
|
||||
All: 'all',
|
||||
Optimal: 'optimal',
|
||||
Required: 'required',
|
||||
Disabled: 'disabled'
|
||||
} as const;
|
||||
|
||||
export type TranscodePolicy = typeof TranscodePolicy[keyof typeof TranscodePolicy];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -3027,6 +3050,21 @@ export interface ValidateAccessTokenResponseDto {
|
||||
*/
|
||||
'authStatus': boolean;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
|
||||
export const VideoCodec = {
|
||||
H264: 'h264',
|
||||
Hevc: 'hevc',
|
||||
Vp9: 'vp9'
|
||||
} as const;
|
||||
|
||||
export type VideoCodec = typeof VideoCodec[keyof typeof VideoCodec];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* APIKeyApi - axios parameter creator
|
||||
|
||||
Reference in New Issue
Block a user