Skip to content

Commit

Permalink
feat(server): transcode bitrate and thread settings (#2488)
Browse files Browse the repository at this point in the history
* support for two-pass transcoding

* added max bitrate and thread to transcode api

* admin page setting desc+bitrate and thread options

* Update web/src/lib/components/admin-page/settings/setting-input-field.svelte

Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com>

* Update web/src/lib/components/admin-page/settings/setting-input-field.svelte

Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com>

* two-pass slider, `crf` and `threads` as numbers

* updated and added transcode tests

* refactored `getFfmpegOptions`

* default `threads`, `maxBitrate` now 0, more tests

* vp9 constant quality mode

* fixed nullable `crf` and `threads`

* fixed two-pass slider, added apiproperty

* optional `desc` for `SettingSelect`

* disable two-pass if settings are incompatible

* fixed test

* transcode interface

---------

Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com>
  • Loading branch information
mertalev and michelheusschen committed May 22, 2023
1 parent f1384fe commit e972271
Show file tree
Hide file tree
Showing 19 changed files with 498 additions and 46 deletions.
5 changes: 4 additions & 1 deletion mobile/openapi/doc/SystemConfigFFmpegDto.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 27 additions & 3 deletions mobile/openapi/lib/model/system_config_f_fmpeg_dto.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion mobile/openapi/test/system_config_f_fmpeg_dto_test.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion server/immich-openapi-specs.json
Expand Up @@ -5349,7 +5349,10 @@
"type": "object",
"properties": {
"crf": {
"type": "string"
"type": "integer"
},
"threads": {
"type": "integer"
},
"preset": {
"type": "string"
Expand All @@ -5363,6 +5366,12 @@
"targetResolution": {
"type": "string"
},
"maxBitrate": {
"type": "string"
},
"twoPass": {
"type": "boolean"
},
"transcode": {
"type": "string",
"enum": [
Expand All @@ -5375,10 +5384,13 @@
},
"required": [
"crf",
"threads",
"preset",
"targetVideoCodec",
"targetAudioCodec",
"targetResolution",
"maxBitrate",
"twoPass",
"transcode"
]
},
Expand Down
7 changes: 6 additions & 1 deletion server/libs/domain/src/media/media.repository.ts
Expand Up @@ -38,6 +38,11 @@ export interface CropOptions {
height: number;
}

export interface TranscodeOptions {
outputOptions: string[];
twoPass: boolean;
}

export interface IMediaRepository {
// image
extractThumbnailFromExif(input: string, output: string): Promise<void>;
Expand All @@ -47,5 +52,5 @@ export interface IMediaRepository {
// video
extractVideoThumbnail(input: string, output: string, size: number): Promise<void>;
probe(input: string): Promise<VideoInfo>;
transcode(input: string, output: string, options: any): Promise<void>;
transcode(input: string, output: string, options: TranscodeOptions): Promise<void>;
}

0 comments on commit e972271

Please sign in to comment.