feat(server): wide gamut thumbnails (#3658)

This commit is contained in:
Mert
2023-09-03 02:21:51 -04:00
committed by GitHub
parent 4bd77d5899
commit 2069293cc1
27 changed files with 405 additions and 61 deletions

View File

@@ -263,8 +263,11 @@ export class BaseHWConfig extends BaseConfig implements VideoCodecHWConfig {
}
export class ThumbnailConfig extends BaseConfig {
getBaseInputOptions(): string[] {
return ['-ss 00:00:00', '-sws_flags accurate_rnd+bitexact+full_chroma_int'];
}
getBaseOutputOptions() {
return ['-ss 00:00:00.000', '-frames:v 1'];
return ['-frames:v 1'];
}
getPresetOptions() {
@@ -277,16 +280,16 @@ export class ThumbnailConfig extends BaseConfig {
getScaling(videoStream: VideoStreamInfo) {
let options = super.getScaling(videoStream);
options += ':flags=lanczos+accurate_rnd+bitexact+full_chroma_int';
if (!this.shouldToneMap(videoStream)) {
options += ':out_color_matrix=bt601:out_range=pc';
options += ':out_color_matrix=601:out_range=pc';
}
return options;
}
getColors() {
return {
// jpeg and webp only support bt.601, so we need to convert to that directly when tone-mapping to avoid color shifts
primaries: 'bt470bg',
primaries: 'bt709',
transfer: '601',
matrix: 'bt470bg',
};