mirror of
https://github.com/immich-app/immich.git
synced 2025-01-07 00:50:23 -05:00
fix(server): ffmpeg matrices (#13461)
* Fix ffmpeg matrices * override `getColors` * formatting --------- Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
This commit is contained in:
parent
c266465317
commit
782ba48470
2 changed files with 38 additions and 14 deletions
|
@ -410,7 +410,7 @@ describe(MediaService.name, () => {
|
||||||
'-frames:v 1',
|
'-frames:v 1',
|
||||||
'-update 1',
|
'-update 1',
|
||||||
'-v verbose',
|
'-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,
|
twoPass: false,
|
||||||
}),
|
}),
|
||||||
|
@ -445,7 +445,7 @@ describe(MediaService.name, () => {
|
||||||
'-frames:v 1',
|
'-frames:v 1',
|
||||||
'-update 1',
|
'-update 1',
|
||||||
'-v verbose',
|
'-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=709:t=601:m=470bg:range=pc,format=yuv420p`,
|
||||||
],
|
],
|
||||||
twoPass: false,
|
twoPass: false,
|
||||||
}),
|
}),
|
||||||
|
@ -482,7 +482,7 @@ describe(MediaService.name, () => {
|
||||||
'-frames:v 1',
|
'-frames:v 1',
|
||||||
'-update 1',
|
'-update 1',
|
||||||
'-v verbose',
|
'-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=709:t=601:m=470bg:range=pc,format=yuv420p`,
|
||||||
],
|
],
|
||||||
twoPass: false,
|
twoPass: false,
|
||||||
}),
|
}),
|
||||||
|
@ -2096,7 +2096,7 @@ describe(MediaService.name, () => {
|
||||||
inputOptions: [],
|
inputOptions: [],
|
||||||
outputOptions: expect.arrayContaining([
|
outputOptions: expect.arrayContaining([
|
||||||
expect.stringContaining(
|
expect.stringContaining(
|
||||||
'zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=bt709:m=bt709:range=pc,format=yuv420p',
|
'zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=709:t=709:m=709:range=pc,format=yuv420p',
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
twoPass: false,
|
twoPass: false,
|
||||||
|
@ -2120,7 +2120,7 @@ describe(MediaService.name, () => {
|
||||||
inputOptions: [],
|
inputOptions: [],
|
||||||
outputOptions: expect.arrayContaining([
|
outputOptions: expect.arrayContaining([
|
||||||
expect.stringContaining(
|
expect.stringContaining(
|
||||||
'zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=bt709:m=bt709:range=pc,format=yuv420p',
|
'zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=709:t=709:m=709:range=pc,format=yuv420p',
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
twoPass: false,
|
twoPass: false,
|
||||||
|
@ -2141,7 +2141,7 @@ describe(MediaService.name, () => {
|
||||||
outputOptions: expect.arrayContaining([
|
outputOptions: expect.arrayContaining([
|
||||||
'-c:v h264',
|
'-c:v h264',
|
||||||
'-c:a copy',
|
'-c:a copy',
|
||||||
'-vf zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=bt709:m=bt709:range=pc,format=yuv420p',
|
'-vf zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=709:t=709:m=709:range=pc,format=yuv420p',
|
||||||
]),
|
]),
|
||||||
twoPass: false,
|
twoPass: false,
|
||||||
}),
|
}),
|
||||||
|
@ -2161,7 +2161,7 @@ describe(MediaService.name, () => {
|
||||||
outputOptions: expect.arrayContaining([
|
outputOptions: expect.arrayContaining([
|
||||||
'-c:v h264',
|
'-c:v h264',
|
||||||
'-c:a copy',
|
'-c:a copy',
|
||||||
'-vf zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=bt709:m=bt709:range=pc,format=yuv420p',
|
'-vf zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=709:t=709:m=709:range=pc,format=yuv420p',
|
||||||
]),
|
]),
|
||||||
twoPass: false,
|
twoPass: false,
|
||||||
}),
|
}),
|
||||||
|
@ -2181,7 +2181,7 @@ describe(MediaService.name, () => {
|
||||||
outputOptions: expect.arrayContaining([
|
outputOptions: expect.arrayContaining([
|
||||||
'-c:v h264',
|
'-c:v h264',
|
||||||
'-c:a copy',
|
'-c:a copy',
|
||||||
'-vf zscale=t=linear:npl=250,tonemap=mobius:desat=0,zscale=p=bt709:t=bt709:m=bt709:range=pc,format=yuv420p',
|
'-vf zscale=t=linear:npl=250,tonemap=mobius:desat=0,zscale=p=709:t=709:m=709:range=pc,format=yuv420p',
|
||||||
]),
|
]),
|
||||||
twoPass: false,
|
twoPass: false,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -270,9 +270,9 @@ export class BaseConfig implements VideoCodecSWConfig {
|
||||||
|
|
||||||
getColors() {
|
getColors() {
|
||||||
return {
|
return {
|
||||||
primaries: 'bt709',
|
primaries: '709',
|
||||||
transfer: 'bt709',
|
transfer: '709',
|
||||||
matrix: 'bt709',
|
matrix: '709',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,16 +424,16 @@ export class ThumbnailConfig extends BaseConfig {
|
||||||
getScaling(videoStream: VideoStreamInfo) {
|
getScaling(videoStream: VideoStreamInfo) {
|
||||||
let options = super.getScaling(videoStream) + ':flags=lanczos+accurate_rnd+full_chroma_int';
|
let options = super.getScaling(videoStream) + ':flags=lanczos+accurate_rnd+full_chroma_int';
|
||||||
if (!this.shouldToneMap(videoStream)) {
|
if (!this.shouldToneMap(videoStream)) {
|
||||||
options += ':out_color_matrix=601:out_range=pc';
|
options += ':out_color_matrix=bt601:out_range=pc';
|
||||||
}
|
}
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
getColors() {
|
getColors() {
|
||||||
return {
|
return {
|
||||||
primaries: 'bt709',
|
primaries: '709',
|
||||||
transfer: '601',
|
transfer: '601',
|
||||||
matrix: 'bt470bg',
|
matrix: '470bg',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -650,6 +650,14 @@ export class NvencHwDecodeConfig extends NvencSwDecodeConfig {
|
||||||
getOutputThreadOptions() {
|
getOutputThreadOptions() {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getColors() {
|
||||||
|
return {
|
||||||
|
primaries: 'bt709',
|
||||||
|
transfer: 'bt709',
|
||||||
|
matrix: 'bt709',
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class QsvSwDecodeConfig extends BaseHWConfig {
|
export class QsvSwDecodeConfig extends BaseHWConfig {
|
||||||
|
@ -793,6 +801,14 @@ export class QsvHwDecodeConfig extends QsvSwDecodeConfig {
|
||||||
getInputThreadOptions() {
|
getInputThreadOptions() {
|
||||||
return [`-threads 1`];
|
return [`-threads 1`];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getColors() {
|
||||||
|
return {
|
||||||
|
primaries: 'bt709',
|
||||||
|
transfer: 'bt709',
|
||||||
|
matrix: 'bt709',
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class VAAPIConfig extends BaseHWConfig {
|
export class VAAPIConfig extends BaseHWConfig {
|
||||||
|
@ -940,4 +956,12 @@ export class RkmppHwDecodeConfig extends RkmppSwDecodeConfig {
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getColors() {
|
||||||
|
return {
|
||||||
|
primaries: 'bt709',
|
||||||
|
transfer: 'bt709',
|
||||||
|
matrix: 'bt709',
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue