mirror of
https://github.com/Art051/immich.git
synced 2025-08-11 19:29:00 +00:00
* 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>
69 lines
1.5 KiB
TypeScript
69 lines
1.5 KiB
TypeScript
export const IMediaRepository = 'IMediaRepository';
|
|
|
|
export interface ResizeOptions {
|
|
size: number;
|
|
format: 'webp' | 'jpeg';
|
|
}
|
|
|
|
export interface VideoStreamInfo {
|
|
height: number;
|
|
width: number;
|
|
rotation: number;
|
|
codecName?: string;
|
|
codecType?: string;
|
|
frameCount: number;
|
|
}
|
|
|
|
export interface AudioStreamInfo {
|
|
codecName?: string;
|
|
codecType?: string;
|
|
}
|
|
|
|
export interface VideoFormat {
|
|
formatName?: string;
|
|
formatLongName?: string;
|
|
duration: number;
|
|
}
|
|
|
|
export interface VideoInfo {
|
|
format: VideoFormat;
|
|
videoStreams: VideoStreamInfo[];
|
|
audioStreams: AudioStreamInfo[];
|
|
}
|
|
|
|
export interface CropOptions {
|
|
top: number;
|
|
left: number;
|
|
width: number;
|
|
height: number;
|
|
}
|
|
|
|
export interface TranscodeOptions {
|
|
inputOptions: string[];
|
|
outputOptions: string[];
|
|
twoPass: boolean;
|
|
}
|
|
|
|
export interface BitrateDistribution {
|
|
max: number;
|
|
target: number;
|
|
min: number;
|
|
unit: string;
|
|
}
|
|
|
|
export interface VideoCodecSWConfig {
|
|
getOptions(stream: VideoStreamInfo): TranscodeOptions;
|
|
}
|
|
|
|
export interface IMediaRepository {
|
|
// image
|
|
resize(input: string | Buffer, output: string, options: ResizeOptions): Promise<void>;
|
|
crop(input: string, options: CropOptions): Promise<Buffer>;
|
|
generateThumbhash(imagePath: string): Promise<Buffer>;
|
|
|
|
// video
|
|
extractVideoThumbnail(input: string, output: string, size: number): Promise<void>;
|
|
probe(input: string): Promise<VideoInfo>;
|
|
transcode(input: string, output: string, options: TranscodeOptions): Promise<void>;
|
|
}
|