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

libplacebo for nvenc

update dockerfile
This commit is contained in:
mertalev 2024-05-11 12:04:58 -04:00
parent 9e33c8fe66
commit 1589845122
No known key found for this signature in database
GPG key ID: 13C97EF14A338984
2 changed files with 20 additions and 6 deletions

View file

@ -1,5 +1,5 @@
# dev build
FROM ghcr.io/immich-app/base-server-dev:20240507@sha256:ca3b8f7ca4ef72cb191b97d2715bfa0e3decdf39e666c5020536e41cf14cee1e as dev
FROM ghcr.io/immich-app/base-server-dev:main as dev
RUN apt-get install --no-install-recommends -yqq tini
WORKDIR /usr/src/app
@ -41,7 +41,7 @@ RUN npm run build
# prod build
FROM ghcr.io/immich-app/base-server-prod:20240507@sha256:1394878615cc665fd6b04f07b78d6586bb5d888423cdf8987cea072d1d72fd1f
FROM ghcr.io/immich-app/base-server-prod:main
WORKDIR /usr/src/app
ENV NODE_ENV=production \

View file

@ -440,7 +440,7 @@ export class NVENCConfig extends BaseHWConfig {
}
getBaseInputOptions() {
return ['-init_hw_device cuda=cuda:0', '-filter_hw_device cuda'];
return ['-hwaccel cuda', '-hwaccel_output_format cuda'];
}
getBaseOutputOptions(target: TranscodeTarget, videoStream: VideoStreamInfo, audioStream?: AudioStreamInfo) {
@ -461,13 +461,27 @@ export class NVENCConfig extends BaseHWConfig {
return options;
}
getToneMapping() {
const colors = this.getColors();
// https://stackoverflow.com/a/65542002
return [
'hwupload=derive_device=vulkan',
`libplacebo=tonemapping=${this.config.tonemap}:colorspace=${colors.matrix}:color_primaries=${colors.primaries}:color_trc=${colors.transfer}:format=yuv420p:preset=high_quality:downscaler=lanczos`,
'hwupload=derive_device=cuda',
];
}
getFilterOptions(videoStream: VideoStreamInfo) {
const options = this.shouldToneMap(videoStream) ? this.getToneMapping() : [];
options.push('format=nv12', 'hwupload_cuda');
const options = [];
if (this.shouldScale(videoStream)) {
options.push(`scale_cuda=${this.getScaling(videoStream)}`);
}
if (this.shouldToneMap(videoStream)) {
options.push(...this.getToneMapping());
}
return options;
}
@ -501,7 +515,7 @@ export class NVENCConfig extends BaseHWConfig {
}
getThreadOptions() {
return [];
return [`-threads ${this.config.threads <= 0 ? 1 : this.config.threads}`];
}
getRefs() {