mirror of
https://github.com/immich-app/immich.git
synced 2025-02-11 01:18:24 -05:00
fix(server): always disable two-pass mode for video thumbnails (#4258)
* always disable two-pass mode for thumbnails * add regression test * added bitrate constraint to config mock
This commit is contained in:
parent
098ab9eae5
commit
c145963b02
2 changed files with 28 additions and 0 deletions
|
@ -265,6 +265,30 @@ describe(MediaService.name, () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should always generate video thumbnail in one pass', async () => {
|
||||||
|
mediaMock.probe.mockResolvedValue(probeStub.videoStreamHDR);
|
||||||
|
configMock.load.mockResolvedValue([
|
||||||
|
{ key: SystemConfigKey.FFMPEG_TWO_PASS, value: true },
|
||||||
|
{ key: SystemConfigKey.FFMPEG_MAX_BITRATE, value: '5000k' },
|
||||||
|
]);
|
||||||
|
assetMock.getByIds.mockResolvedValue([assetStub.video]);
|
||||||
|
await sut.handleGenerateJpegThumbnail({ id: assetStub.video.id });
|
||||||
|
|
||||||
|
expect(mediaMock.transcode).toHaveBeenCalledWith(
|
||||||
|
'/original/path.ext',
|
||||||
|
'upload/thumbs/user-id/as/se/asset-id.jpeg',
|
||||||
|
{
|
||||||
|
inputOptions: ['-ss 00:00:00', '-sws_flags accurate_rnd+bitexact+full_chroma_int'],
|
||||||
|
outputOptions: [
|
||||||
|
'-frames:v 1',
|
||||||
|
'-v verbose',
|
||||||
|
'-vf zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=601:m=bt470bg:range=pc,format=yuv420p',
|
||||||
|
],
|
||||||
|
twoPass: false,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should run successfully', async () => {
|
it('should run successfully', async () => {
|
||||||
assetMock.getByIds.mockResolvedValue([assetStub.image]);
|
assetMock.getByIds.mockResolvedValue([assetStub.image]);
|
||||||
await sut.handleGenerateJpegThumbnail({ id: assetStub.image.id });
|
await sut.handleGenerateJpegThumbnail({ id: assetStub.image.id });
|
||||||
|
|
|
@ -278,6 +278,10 @@ export class ThumbnailConfig extends BaseConfig {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eligibleForTwoPass() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
getScaling(videoStream: VideoStreamInfo) {
|
getScaling(videoStream: VideoStreamInfo) {
|
||||||
let options = super.getScaling(videoStream);
|
let options = super.getScaling(videoStream);
|
||||||
options += ':flags=lanczos+accurate_rnd+bitexact+full_chroma_int';
|
options += ':flags=lanczos+accurate_rnd+bitexact+full_chroma_int';
|
||||||
|
|
Loading…
Add table
Reference in a new issue