feat(server): accepted video containers (#11274)

* add accepted container config

* update api

* mp4 option makes no sense

* add to transcoding settings

* wording

* updated spec config

* formatting
This commit is contained in:
Mert
2024-07-21 17:14:23 -04:00
committed by GitHub
parent 7ecdcb3bc0
commit 9d2d556200
16 changed files with 234 additions and 30 deletions
+23
View File
@@ -957,6 +957,21 @@ describe(MediaService.name, () => {
);
});
it('should remux when input is not an accepted container', async () => {
mediaMock.probe.mockResolvedValue(probeStub.videoStreamAvi);
assetMock.getByIds.mockResolvedValue([assetStub.video]);
await sut.handleVideoConversion({ id: assetStub.video.id });
expect(mediaMock.transcode).toHaveBeenCalledWith(
'/original/path.ext',
'upload/encoded-video/user-id/as/se/asset-id.mp4',
{
inputOptions: expect.any(Array),
outputOptions: expect.arrayContaining(['-c:v copy', '-c:a copy']),
twoPass: false,
},
);
});
it('should throw an exception if transcode value is invalid', async () => {
mediaMock.probe.mockResolvedValue(probeStub.videoStream2160p);
systemMock.get.mockResolvedValue({ ffmpeg: { transcode: 'invalid' as any } });
@@ -973,6 +988,14 @@ describe(MediaService.name, () => {
expect(mediaMock.transcode).not.toHaveBeenCalled();
});
it('should not remux when input is not an accepted container and transcoding is disabled', async () => {
mediaMock.probe.mockResolvedValue(probeStub.matroskaContainer);
systemMock.get.mockResolvedValue({ ffmpeg: { transcode: TranscodePolicy.DISABLED } });
assetMock.getByIds.mockResolvedValue([assetStub.video]);
await sut.handleVideoConversion({ id: assetStub.video.id });
expect(mediaMock.transcode).not.toHaveBeenCalled();
});
it('should not transcode if target codec is invalid', async () => {
mediaMock.probe.mockResolvedValue(probeStub.videoStream2160p);
systemMock.get.mockResolvedValue({ ffmpeg: { targetVideoCodec: 'invalid' as any } });