diff options
Diffstat (limited to 'server/helpers/ffmpeg/ffmpeg-vod.ts')
-rw-r--r-- | server/helpers/ffmpeg/ffmpeg-vod.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/server/helpers/ffmpeg/ffmpeg-vod.ts b/server/helpers/ffmpeg/ffmpeg-vod.ts index c3622ceb1..f84157e0f 100644 --- a/server/helpers/ffmpeg/ffmpeg-vod.ts +++ b/server/helpers/ffmpeg/ffmpeg-vod.ts | |||
@@ -7,7 +7,7 @@ import { AvailableEncoders, VideoResolution } from '@shared/models' | |||
7 | import { logger, loggerTagsFactory } from '../logger' | 7 | import { logger, loggerTagsFactory } from '../logger' |
8 | import { getFFmpeg, runCommand } from './ffmpeg-commons' | 8 | import { getFFmpeg, runCommand } from './ffmpeg-commons' |
9 | import { presetCopy, presetOnlyAudio, presetVOD } from './ffmpeg-presets' | 9 | import { presetCopy, presetOnlyAudio, presetVOD } from './ffmpeg-presets' |
10 | import { computeFPS, getVideoStreamFPS } from './ffprobe-utils' | 10 | import { computeFPS, ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS } from './ffprobe-utils' |
11 | import { VIDEO_TRANSCODING_FPS } from '@server/initializers/constants' | 11 | import { VIDEO_TRANSCODING_FPS } from '@server/initializers/constants' |
12 | 12 | ||
13 | const lTags = loggerTagsFactory('ffmpeg') | 13 | const lTags = loggerTagsFactory('ffmpeg') |
@@ -27,8 +27,6 @@ interface BaseTranscodeVODOptions { | |||
27 | 27 | ||
28 | resolution: number | 28 | resolution: number |
29 | 29 | ||
30 | isPortraitMode?: boolean | ||
31 | |||
32 | job?: Job | 30 | job?: Job |
33 | } | 31 | } |
34 | 32 | ||
@@ -115,13 +113,17 @@ export { | |||
115 | // --------------------------------------------------------------------------- | 113 | // --------------------------------------------------------------------------- |
116 | 114 | ||
117 | async function buildVODCommand (command: FfmpegCommand, options: TranscodeVODOptions) { | 115 | async function buildVODCommand (command: FfmpegCommand, options: TranscodeVODOptions) { |
118 | let fps = await getVideoStreamFPS(options.inputPath) | 116 | const probe = await ffprobePromise(options.inputPath) |
117 | |||
118 | let fps = await getVideoStreamFPS(options.inputPath, probe) | ||
119 | fps = computeFPS(fps, options.resolution) | 119 | fps = computeFPS(fps, options.resolution) |
120 | 120 | ||
121 | let scaleFilterValue: string | 121 | let scaleFilterValue: string |
122 | 122 | ||
123 | if (options.resolution !== undefined) { | 123 | if (options.resolution !== undefined) { |
124 | scaleFilterValue = options.isPortraitMode === true | 124 | const videoStreamInfo = await getVideoStreamDimensionsInfo(options.inputPath, probe) |
125 | |||
126 | scaleFilterValue = videoStreamInfo?.isPortraitMode === true | ||
125 | ? `w=${options.resolution}:h=-2` | 127 | ? `w=${options.resolution}:h=-2` |
126 | : `w=-2:h=${options.resolution}` | 128 | : `w=-2:h=${options.resolution}` |
127 | } | 129 | } |