From 9bdfb41e9c00e0053994fbfe9f46f377016656d3 Mon Sep 17 00:00:00 2001 From: lyyn <79758863+lyynd@users.noreply.github.com> Date: Sun, 13 Oct 2024 19:19:40 +0200 Subject: [PATCH] fix(server): incorrect out_color_matrix value when generating thumbnails (#13409) --- server/src/services/media.service.spec.ts | 6 +++--- server/src/utils/media.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/services/media.service.spec.ts b/server/src/services/media.service.spec.ts index 08e49f088a0bd..23f322df4638a 100644 --- a/server/src/services/media.service.spec.ts +++ b/server/src/services/media.service.spec.ts @@ -410,7 +410,7 @@ describe(MediaService.name, () => { '-frames:v 1', '-update 1', '-v verbose', - String.raw`-vf fps=12:eof_action=pass:round=down,thumbnail=12,select=gt(scene\,0.1)-eq(prev_selected_n\,n)+isnan(prev_selected_n)+gt(n\,20),trim=end_frame=2,reverse,scale=-2:1440:flags=lanczos+accurate_rnd+full_chroma_int:out_color_matrix=601:out_range=pc,format=yuv420p`, + String.raw`-vf fps=12:eof_action=pass:round=down,thumbnail=12,select=gt(scene\,0.1)-eq(prev_selected_n\,n)+isnan(prev_selected_n)+gt(n\,20),trim=end_frame=2,reverse,scale=-2:1440:flags=lanczos+accurate_rnd+full_chroma_int:out_color_matrix=bt601:out_range=pc,format=yuv420p`, ], twoPass: false, }), @@ -445,7 +445,7 @@ describe(MediaService.name, () => { '-frames:v 1', '-update 1', '-v verbose', - String.raw`-vf fps=12:eof_action=pass:round=down,thumbnail=12,select=gt(scene\,0.1)-eq(prev_selected_n\,n)+isnan(prev_selected_n)+gt(n\,20),trim=end_frame=2,reverse,zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=601:m=bt470bg:range=pc,format=yuv420p`, + String.raw`-vf fps=12:eof_action=pass:round=down,thumbnail=12,select=gt(scene\,0.1)-eq(prev_selected_n\,n)+isnan(prev_selected_n)+gt(n\,20),trim=end_frame=2,reverse,zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=bt601:m=bt470bg:range=pc,format=yuv420p`, ], twoPass: false, }), @@ -482,7 +482,7 @@ describe(MediaService.name, () => { '-frames:v 1', '-update 1', '-v verbose', - String.raw`-vf fps=12:eof_action=pass:round=down,thumbnail=12,select=gt(scene\,0.1)-eq(prev_selected_n\,n)+isnan(prev_selected_n)+gt(n\,20),trim=end_frame=2,reverse,zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=601:m=bt470bg:range=pc,format=yuv420p`, + String.raw`-vf fps=12:eof_action=pass:round=down,thumbnail=12,select=gt(scene\,0.1)-eq(prev_selected_n\,n)+isnan(prev_selected_n)+gt(n\,20),trim=end_frame=2,reverse,zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=bt601:m=bt470bg:range=pc,format=yuv420p`, ], twoPass: false, }), diff --git a/server/src/utils/media.ts b/server/src/utils/media.ts index 6f0ab4ef81d90..8665a2149671e 100644 --- a/server/src/utils/media.ts +++ b/server/src/utils/media.ts @@ -424,7 +424,7 @@ export class ThumbnailConfig extends BaseConfig { getScaling(videoStream: VideoStreamInfo) { let options = super.getScaling(videoStream) + ':flags=lanczos+accurate_rnd+full_chroma_int'; if (!this.shouldToneMap(videoStream)) { - options += ':out_color_matrix=601:out_range=pc'; + options += ':out_color_matrix=bt601:out_range=pc'; } return options; } @@ -432,7 +432,7 @@ export class ThumbnailConfig extends BaseConfig { getColors() { return { primaries: 'bt709', - transfer: '601', + transfer: 'bt601', matrix: 'bt470bg', }; }