aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/ffmpeg/ffmpeg-vod.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/ffmpeg/ffmpeg-vod.ts')
-rw-r--r--server/helpers/ffmpeg/ffmpeg-vod.ts12
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'
7import { logger, loggerTagsFactory } from '../logger' 7import { logger, loggerTagsFactory } from '../logger'
8import { getFFmpeg, runCommand } from './ffmpeg-commons' 8import { getFFmpeg, runCommand } from './ffmpeg-commons'
9import { presetCopy, presetOnlyAudio, presetVOD } from './ffmpeg-presets' 9import { presetCopy, presetOnlyAudio, presetVOD } from './ffmpeg-presets'
10import { computeFPS, getVideoStreamFPS } from './ffprobe-utils' 10import { computeFPS, ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS } from './ffprobe-utils'
11import { VIDEO_TRANSCODING_FPS } from '@server/initializers/constants' 11import { VIDEO_TRANSCODING_FPS } from '@server/initializers/constants'
12 12
13const lTags = loggerTagsFactory('ffmpeg') 13const 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
117async function buildVODCommand (command: FfmpegCommand, options: TranscodeVODOptions) { 115async 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 }