aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers/video-transcoding.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-11-18 14:35:08 +0100
committerChocobozzz <me@florianbigard.com>2021-11-18 15:20:57 +0100
commitad5db1044c8599eaaaa2a578b350777ae996b068 (patch)
tree3e003cccf021152405d49b21c6c91b703c8ae96c /server/lib/job-queue/handlers/video-transcoding.ts
parentb46cf4b920984492df598c1b61179acfc7f6f22e (diff)
downloadPeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.tar.gz
PeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.tar.zst
PeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.zip
Add ability to run transcoding jobs
Diffstat (limited to 'server/lib/job-queue/handlers/video-transcoding.ts')
-rw-r--r--server/lib/job-queue/handlers/video-transcoding.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts
index 904ef2e3c..2d0798e12 100644
--- a/server/lib/job-queue/handlers/video-transcoding.ts
+++ b/server/lib/job-queue/handlers/video-transcoding.ts
@@ -14,7 +14,7 @@ import {
14 VideoTranscodingPayload 14 VideoTranscodingPayload
15} from '../../../../shared' 15} from '../../../../shared'
16import { retryTransactionWrapper } from '../../../helpers/database-utils' 16import { retryTransactionWrapper } from '../../../helpers/database-utils'
17import { computeResolutionsToTranscode } from '../../../helpers/ffprobe-utils' 17import { computeLowerResolutionsToTranscode } from '../../../helpers/ffprobe-utils'
18import { logger, loggerTagsFactory } from '../../../helpers/logger' 18import { logger, loggerTagsFactory } from '../../../helpers/logger'
19import { CONFIG } from '../../../initializers/config' 19import { CONFIG } from '../../../initializers/config'
20import { VideoModel } from '../../../models/video/video' 20import { VideoModel } from '../../../models/video/video'
@@ -81,7 +81,7 @@ async function handleHLSJob (job: Job, payload: HLSTranscodingPayload, video: MV
81 81
82 const videoOrStreamingPlaylist = videoFileInput.getVideoOrStreamingPlaylist() 82 const videoOrStreamingPlaylist = videoFileInput.getVideoOrStreamingPlaylist()
83 83
84 await VideoPathManager.Instance.makeAvailableVideoFile(videoOrStreamingPlaylist, videoFileInput, videoInputPath => { 84 await VideoPathManager.Instance.makeAvailableVideoFile(videoFileInput.withVideoOrPlaylist(videoOrStreamingPlaylist), videoInputPath => {
85 return generateHlsPlaylistResolution({ 85 return generateHlsPlaylistResolution({
86 video, 86 video,
87 videoInputPath, 87 videoInputPath,
@@ -135,7 +135,7 @@ async function handleWebTorrentOptimizeJob (job: Job, payload: OptimizeTranscodi
135// --------------------------------------------------------------------------- 135// ---------------------------------------------------------------------------
136 136
137async function onHlsPlaylistGeneration (video: MVideoFullLight, user: MUser, payload: HLSTranscodingPayload) { 137async function onHlsPlaylistGeneration (video: MVideoFullLight, user: MUser, payload: HLSTranscodingPayload) {
138 if (payload.isMaxQuality && CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) { 138 if (payload.isMaxQuality && payload.autoDeleteWebTorrentIfNeeded && CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) {
139 // Remove webtorrent files if not enabled 139 // Remove webtorrent files if not enabled
140 for (const file of video.VideoFiles) { 140 for (const file of video.VideoFiles) {
141 await video.removeWebTorrentFileAndTorrent(file) 141 await video.removeWebTorrentFileAndTorrent(file)
@@ -232,6 +232,7 @@ async function createHlsJobIfEnabled (user: MUserId, payload: {
232 isPortraitMode: payload.isPortraitMode, 232 isPortraitMode: payload.isPortraitMode,
233 copyCodecs: payload.copyCodecs, 233 copyCodecs: payload.copyCodecs,
234 isMaxQuality: payload.isMaxQuality, 234 isMaxQuality: payload.isMaxQuality,
235 autoDeleteWebTorrentIfNeeded: true,
235 isNewVideo: payload.isNewVideo 236 isNewVideo: payload.isNewVideo
236 } 237 }
237 238
@@ -261,7 +262,7 @@ async function createLowerResolutionsJobs (options: {
261 const { video, user, videoFileResolution, isPortraitMode, isNewVideo, type } = options 262 const { video, user, videoFileResolution, isPortraitMode, isNewVideo, type } = options
262 263
263 // Create transcoding jobs if there are enabled resolutions 264 // Create transcoding jobs if there are enabled resolutions
264 const resolutionsEnabled = computeResolutionsToTranscode(videoFileResolution, 'vod') 265 const resolutionsEnabled = computeLowerResolutionsToTranscode(videoFileResolution, 'vod')
265 const resolutionCreated: string[] = [] 266 const resolutionCreated: string[] = []
266 267
267 for (const resolution of resolutionsEnabled) { 268 for (const resolution of resolutionsEnabled) {
@@ -288,6 +289,7 @@ async function createLowerResolutionsJobs (options: {
288 isPortraitMode, 289 isPortraitMode,
289 copyCodecs: false, 290 copyCodecs: false,
290 isMaxQuality: false, 291 isMaxQuality: false,
292 autoDeleteWebTorrentIfNeeded: true,
291 isNewVideo 293 isNewVideo
292 } 294 }
293 295