fix(server): set hvc1 tag when using hwa (#29908)

fix hvc1 check
This commit is contained in:
Mert
2026-07-14 11:03:30 -04:00
committed by GitHub
parent 3c43e8d6c1
commit 89b0d906e8
2 changed files with 22 additions and 1 deletions

View File

@@ -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 } });

View File

@@ -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');
}