mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:29:32 -05:00 
			
		
		
		
	fix(server): video thumbnail generation failing when using qsv (#9808)
fix multiplier
This commit is contained in:
		
							parent
							
								
									0fc6d69824
								
							
						
					
					
						commit
						fbc3790cb6
					
				@ -363,6 +363,23 @@ describe(MediaService.name, () => {
 | 
				
			|||||||
      );
 | 
					      );
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    it('should use scaling divisible by 2 even when using quick sync', async () => {
 | 
				
			||||||
 | 
					      mediaMock.probe.mockResolvedValue(probeStub.videoStream2160p);
 | 
				
			||||||
 | 
					      systemMock.get.mockResolvedValue({ ffmpeg: { accel: TranscodeHWAccel.QSV } });
 | 
				
			||||||
 | 
					      assetMock.getByIds.mockResolvedValue([assetStub.video]);
 | 
				
			||||||
 | 
					      await sut.handleGeneratePreview({ id: assetStub.video.id });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      expect(mediaMock.transcode).toHaveBeenCalledWith(
 | 
				
			||||||
 | 
					        '/original/path.ext',
 | 
				
			||||||
 | 
					        'upload/thumbs/user-id/as/se/asset-id-preview.jpeg',
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          inputOptions: expect.any(Array),
 | 
				
			||||||
 | 
					          outputOptions: expect.arrayContaining([expect.stringContaining('scale=-2:1440')]),
 | 
				
			||||||
 | 
					          twoPass: false,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('should run successfully', async () => {
 | 
					    it('should run successfully', async () => {
 | 
				
			||||||
      assetMock.getByIds.mockResolvedValue([assetStub.image]);
 | 
					      assetMock.getByIds.mockResolvedValue([assetStub.image]);
 | 
				
			||||||
      await sut.handleGeneratePreview({ id: assetStub.image.id });
 | 
					      await sut.handleGeneratePreview({ id: assetStub.image.id });
 | 
				
			||||||
 | 
				
			|||||||
@ -226,9 +226,8 @@ export class BaseConfig implements VideoCodecSWConfig {
 | 
				
			|||||||
    return videoStream.isHDR && this.config.tonemap !== ToneMapping.DISABLED;
 | 
					    return videoStream.isHDR && this.config.tonemap !== ToneMapping.DISABLED;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getScaling(videoStream: VideoStreamInfo) {
 | 
					  getScaling(videoStream: VideoStreamInfo, mult = 2) {
 | 
				
			||||||
    const targetResolution = this.getTargetResolution(videoStream);
 | 
					    const targetResolution = this.getTargetResolution(videoStream);
 | 
				
			||||||
    const mult = this.config.accel === TranscodeHWAccel.QSV ? 1 : 2; // QSV doesn't support scaling numbers below -1
 | 
					 | 
				
			||||||
    return this.isVideoVertical(videoStream) ? `${targetResolution}:-${mult}` : `-${mult}:${targetResolution}`;
 | 
					    return this.isVideoVertical(videoStream) ? `${targetResolution}:-${mult}` : `-${mult}:${targetResolution}`;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -709,6 +708,10 @@ export class QsvSwDecodeConfig extends BaseHWConfig {
 | 
				
			|||||||
  useCQP() {
 | 
					  useCQP() {
 | 
				
			||||||
    return this.config.cqMode === CQMode.CQP || this.config.targetVideoCodec === VideoCodec.VP9;
 | 
					    return this.config.cqMode === CQMode.CQP || this.config.targetVideoCodec === VideoCodec.VP9;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  getScaling(videoStream: VideoStreamInfo): string {
 | 
				
			||||||
 | 
					    return super.getScaling(videoStream, 1);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class QsvHwDecodeConfig extends QsvSwDecodeConfig {
 | 
					export class QsvHwDecodeConfig extends QsvSwDecodeConfig {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user