mirror of
https://github.com/bpatrik/pigallery2.git
synced 2024-12-23 01:27:14 +02:00
Fixing codec path #569
This commit is contained in:
parent
d11719cc39
commit
0c6c18bb1c
@ -1,14 +1,11 @@
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { constants as fsConstants, promises as fsp } from 'fs';
|
import {constants as fsConstants, promises as fsp} from 'fs';
|
||||||
import { ITaskExecuter, TaskExecuter } from '../threading/TaskExecuter';
|
import {ITaskExecuter, TaskExecuter} from '../threading/TaskExecuter';
|
||||||
import {
|
import {VideoConverterInput, VideoConverterWorker,} from '../threading/VideoConverterWorker';
|
||||||
VideoConverterInput,
|
import {MetadataLoader} from '../threading/MetadataLoader';
|
||||||
VideoConverterWorker,
|
import {Config} from '../../../common/config/private/Config';
|
||||||
} from '../threading/VideoConverterWorker';
|
import {ProjectPath} from '../../ProjectPath';
|
||||||
import { MetadataLoader } from '../threading/MetadataLoader';
|
import {SupportedFormats} from '../../../common/SupportedFormats';
|
||||||
import { Config } from '../../../common/config/private/Config';
|
|
||||||
import { ProjectPath } from '../../ProjectPath';
|
|
||||||
import { SupportedFormats } from '../../../common/SupportedFormats';
|
|
||||||
|
|
||||||
export class VideoProcessing {
|
export class VideoProcessing {
|
||||||
private static taskQue: ITaskExecuter<VideoConverterInput, void> =
|
private static taskQue: ITaskExecuter<VideoConverterInput, void> =
|
||||||
@ -83,7 +80,9 @@ export class VideoProcessing {
|
|||||||
videoPath,
|
videoPath,
|
||||||
output: {
|
output: {
|
||||||
path: outPath,
|
path: outPath,
|
||||||
codec: Config.Media.Video.transcoding.codec,
|
codec: Config.Media.Video.transcoding.format === 'mp4' ?
|
||||||
|
Config.Media.Video.transcoding.mp4Codec :
|
||||||
|
Config.Media.Video.transcoding.webmCodec,
|
||||||
format: Config.Media.Video.transcoding.format,
|
format: Config.Media.Video.transcoding.format,
|
||||||
crf: Config.Media.Video.transcoding.crf,
|
crf: Config.Media.Video.transcoding.crf,
|
||||||
preset: Config.Media.Video.transcoding.preset,
|
preset: Config.Media.Video.transcoding.preset,
|
||||||
@ -108,7 +107,7 @@ export class VideoProcessing {
|
|||||||
|
|
||||||
const outDir = path.dirname(renderInput.output.path);
|
const outDir = path.dirname(renderInput.output.path);
|
||||||
|
|
||||||
await fsp.mkdir(outDir, { recursive: true });
|
await fsp.mkdir(outDir, {recursive: true});
|
||||||
await VideoProcessing.taskQue.execute(renderInput);
|
await VideoProcessing.taskQue.execute(renderInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +120,9 @@ export class VideoProcessing {
|
|||||||
return (
|
return (
|
||||||
Math.round(Config.Media.Video.transcoding.bitRate / 1024) +
|
Math.round(Config.Media.Video.transcoding.bitRate / 1024) +
|
||||||
'k' +
|
'k' +
|
||||||
Config.Media.Video.transcoding.codec.toString().toLowerCase() +
|
(Config.Media.Video.transcoding.format === 'mp4' ?
|
||||||
|
Config.Media.Video.transcoding.mp4Codec :
|
||||||
|
Config.Media.Video.transcoding.webmCodec).toString().toLowerCase() +
|
||||||
Config.Media.Video.transcoding.resolution +
|
Config.Media.Video.transcoding.resolution +
|
||||||
'.' +
|
'.' +
|
||||||
Config.Media.Video.transcoding.format.toLowerCase()
|
Config.Media.Video.transcoding.format.toLowerCase()
|
||||||
|
@ -27,7 +27,7 @@ describe('VideoProcessing', () => {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
const convertedPath = VideoProcessing.generateConvertedFilePath(videoPath);
|
const convertedPath = VideoProcessing.generateConvertedFilePath(videoPath);
|
||||||
Config.Media.Video.transcoding.codec = 'codec_text' as any;
|
Config.Media.Video.transcoding.mp4Codec = 'codec_text' as any;
|
||||||
expect(await VideoProcessing.isValidConvertedPath(convertedPath)).to.be.false;
|
expect(await VideoProcessing.isValidConvertedPath(convertedPath)).to.be.false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user