2019-12-26 22:03:10 +02:00
|
|
|
import {expect} from 'chai';
|
2023-10-14 17:54:21 +02:00
|
|
|
import {VideoProcessing} from '../../../../../src/backend/model/fileaccess/fileprocessing/VideoProcessing';
|
2019-12-26 22:03:10 +02:00
|
|
|
import {Config} from '../../../../../src/common/config/private/Config';
|
|
|
|
import {ProjectPath} from '../../../../../src/backend/ProjectPath';
|
|
|
|
import * as path from 'path';
|
|
|
|
|
|
|
|
|
|
|
|
describe('VideoProcessing', () => {
|
|
|
|
|
2022-04-04 19:37:31 +02:00
|
|
|
/* eslint-disable no-unused-expressions,@typescript-eslint/no-unused-expressions */
|
2019-12-26 22:03:10 +02:00
|
|
|
it('should generate converted file path', async () => {
|
|
|
|
|
2020-01-07 23:28:59 +02:00
|
|
|
ProjectPath.ImageFolder = path.join(__dirname, './../../../assets');
|
2019-12-26 22:03:10 +02:00
|
|
|
const videoPath = path.join(ProjectPath.ImageFolder, 'video.mp4');
|
|
|
|
expect(await VideoProcessing
|
|
|
|
.isValidConvertedPath(VideoProcessing.generateConvertedFilePath(videoPath)))
|
|
|
|
.to.be.true;
|
|
|
|
|
|
|
|
expect(await VideoProcessing
|
|
|
|
.isValidConvertedPath(VideoProcessing.generateConvertedFilePath(videoPath + 'noPath')))
|
|
|
|
.to.be.false;
|
|
|
|
|
|
|
|
{
|
|
|
|
const convertedPath = VideoProcessing.generateConvertedFilePath(videoPath);
|
2022-12-28 20:12:18 +02:00
|
|
|
Config.Media.Video.transcoding.bitRate = 10;
|
2019-12-26 22:03:10 +02:00
|
|
|
expect(await VideoProcessing.isValidConvertedPath(convertedPath)).to.be.false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
const convertedPath = VideoProcessing.generateConvertedFilePath(videoPath);
|
2023-01-01 23:09:24 +02:00
|
|
|
Config.Media.Video.transcoding.mp4Codec = 'codec_text' as any;
|
2019-12-26 22:03:10 +02:00
|
|
|
expect(await VideoProcessing.isValidConvertedPath(convertedPath)).to.be.false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
const convertedPath = VideoProcessing.generateConvertedFilePath(videoPath);
|
2022-12-28 20:12:18 +02:00
|
|
|
Config.Media.Video.transcoding.format = 'format_test' as any;
|
2019-12-26 22:03:10 +02:00
|
|
|
expect(await VideoProcessing.isValidConvertedPath(convertedPath)).to.be.false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
const convertedPath = VideoProcessing.generateConvertedFilePath(videoPath);
|
2022-12-28 20:12:18 +02:00
|
|
|
Config.Media.Video.transcoding.resolution = 1 as any;
|
2019-12-26 22:03:10 +02:00
|
|
|
expect(await VideoProcessing.isValidConvertedPath(convertedPath)).to.be.false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|