aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/transcoding/web-transcoding.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/transcoding/web-transcoding.ts')
-rw-r--r--server/lib/transcoding/web-transcoding.ts28
1 files changed, 2 insertions, 26 deletions
diff --git a/server/lib/transcoding/web-transcoding.ts b/server/lib/transcoding/web-transcoding.ts
index 22bd238ae..7cc8f20bc 100644
--- a/server/lib/transcoding/web-transcoding.ts
+++ b/server/lib/transcoding/web-transcoding.ts
@@ -3,8 +3,8 @@ import { copyFile, move, remove, stat } from 'fs-extra'
3import { basename, join } from 'path' 3import { basename, join } from 'path'
4import { computeOutputFPS } from '@server/helpers/ffmpeg' 4import { computeOutputFPS } from '@server/helpers/ffmpeg'
5import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' 5import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
6import { VideoModel } from '@server/models/video/video'
6import { MVideoFile, MVideoFullLight } from '@server/types/models' 7import { MVideoFile, MVideoFullLight } from '@server/types/models'
7import { toEven } from '@shared/core-utils'
8import { ffprobePromise, getVideoStreamDuration, getVideoStreamFPS, TranscodeVODOptionsType } from '@shared/ffmpeg' 8import { ffprobePromise, getVideoStreamDuration, getVideoStreamFPS, TranscodeVODOptionsType } from '@shared/ffmpeg'
9import { VideoResolution, VideoStorage } from '@shared/models' 9import { VideoResolution, VideoStorage } from '@shared/models'
10import { CONFIG } from '../../initializers/config' 10import { CONFIG } from '../../initializers/config'
@@ -13,8 +13,7 @@ import { generateWebTorrentVideoFilename } from '../paths'
13import { buildFileMetadata } from '../video-file' 13import { buildFileMetadata } from '../video-file'
14import { VideoPathManager } from '../video-path-manager' 14import { VideoPathManager } from '../video-path-manager'
15import { buildFFmpegVOD } from './shared' 15import { buildFFmpegVOD } from './shared'
16import { computeResolutionsToTranscode } from './transcoding-resolutions' 16import { buildOriginalFileResolution } from './transcoding-resolutions'
17import { VideoModel } from '@server/models/video/video'
18 17
19// Optimize the original video file and replace it. The resolution is not changed. 18// Optimize the original video file and replace it. The resolution is not changed.
20export async function optimizeOriginalVideofile (options: { 19export async function optimizeOriginalVideofile (options: {
@@ -248,26 +247,3 @@ export async function onWebTorrentVideoFileTranscoding (options: {
248 mutexReleaser() 247 mutexReleaser()
249 } 248 }
250} 249}
251
252// ---------------------------------------------------------------------------
253
254function buildOriginalFileResolution (inputResolution: number) {
255 if (CONFIG.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION === true) {
256 return toEven(inputResolution)
257 }
258
259 const resolutions = computeResolutionsToTranscode({
260 input: inputResolution,
261 type: 'vod',
262 includeInput: false,
263 strictLower: false,
264 // We don't really care about the audio resolution in this context
265 hasAudio: true
266 })
267
268 if (resolutions.length === 0) {
269 return toEven(inputResolution)
270 }
271
272 return Math.max(...resolutions)
273}