High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(server): set hvc1 tag when using hwa (#29908)
Mert89b0d906e8f6
diff --git a/server/src/services/media.service.spec.ts b/server/src/services/media.service.spec.tsindex b453082574..58b797a18b 100644--- a/server/src/services/media.service.spec.ts+++ b/server/src/services/media.service.spec.ts@@ -2232,6 +2232,26 @@ describe(MediaService.name, () => {);});+ it('should include hevc tag when target is hevc and using hwa', async () => {+ mocks.assetJob.getForVideoConversion.mockResolvedValue({ ...asset, ...probeStub.videoStreamHDR10 });+ mocks.systemMetadata.get.mockResolvedValue({+ ffmpeg: {+ targetVideoCodec: VideoCodec.Hevc,+ accel: TranscodeHardwareAcceleration.Nvenc,+ },+ });+ await sut.handleVideoConversion({ id: 'video-id' });+ expect(mocks.media.transcode).toHaveBeenCalledWith(+ '/original/path.ext',+ expect.any(String),+ expect.objectContaining({+ inputOptions: expect.any(Array),+ outputOptions: expect.arrayContaining(['-c:v', 'hevc_nvenc', '-tag:v', 'hvc1']),+ twoPass: false,+ }),+ );+ });+it('should copy audio stream when audio matches target', async () => {mocks.assetJob.getForVideoConversion.mockResolvedValue({ ...asset, ...probeStub.audioStreamAac });mocks.systemMetadata.get.mockResolvedValue({ ffmpeg: { transcode: TranscodePolicy.Optimal } });diff --git a/server/src/utils/media.ts b/server/src/utils/media.tsindex 5c81001eba..aceb03baa4 100644--- a/server/src/utils/media.ts+++ b/server/src/utils/media.ts@@ -241,7 +241,8 @@ export class BaseConfig implements VideoCodecSWConfig {options.push('-keyint_min', `${this.getGopSize()}`);}}- const isHvc = (videoCodec === 'copy' ? videoStream.codecName : videoCodec) === VideoCodec.Hevc;+ const isHvc =+ this.config.targetVideoCodec === VideoCodec.Hevc && (videoCodec !== 'copy' || videoStream.codecName === 'hevc');if (isHvc) {options.push('-tag:v', 'hvc1');}