1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

Fixing codec path #569

This commit is contained in:
Patrik J. Braun 2023-01-01 22:09:24 +01:00
parent d11719cc39
commit 0c6c18bb1c
2 changed files with 15 additions and 14 deletions

View File

@ -1,10 +1,7 @@
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,
VideoConverterWorker,
} from '../threading/VideoConverterWorker';
import {MetadataLoader} from '../threading/MetadataLoader'; import {MetadataLoader} from '../threading/MetadataLoader';
import {Config} from '../../../common/config/private/Config'; import {Config} from '../../../common/config/private/Config';
import {ProjectPath} from '../../ProjectPath'; import {ProjectPath} from '../../ProjectPath';
@ -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,
@ -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()

View File

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