diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-05 15:05:20 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-09 09:18:07 +0200 |
commit | 5e2afe4290103bf0d54ae7b3e62781f2a00487c9 (patch) | |
tree | 84e084135c60d208fc9afcee63180d3200f763e6 /server/lib/job-queue | |
parent | 64fd6158fd276f258bcfc4bb0c8fc2f64a220a11 (diff) | |
download | PeerTube-5e2afe4290103bf0d54ae7b3e62781f2a00487c9.tar.gz PeerTube-5e2afe4290103bf0d54ae7b3e62781f2a00487c9.tar.zst PeerTube-5e2afe4290103bf0d54ae7b3e62781f2a00487c9.zip |
Limit import depending on transcoding resolutions
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r-- | server/lib/job-queue/handlers/video-import.ts | 9 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/video-transcoding.ts | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index 40804e82e..4cde26aef 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -2,6 +2,7 @@ import { Job } from 'bull' | |||
2 | import { move, remove, stat } from 'fs-extra' | 2 | import { move, remove, stat } from 'fs-extra' |
3 | import { retryTransactionWrapper } from '@server/helpers/database-utils' | 3 | import { retryTransactionWrapper } from '@server/helpers/database-utils' |
4 | import { YoutubeDLWrapper } from '@server/helpers/youtube-dl' | 4 | import { YoutubeDLWrapper } from '@server/helpers/youtube-dl' |
5 | import { CONFIG } from '@server/initializers/config' | ||
5 | import { isPostImportVideoAccepted } from '@server/lib/moderation' | 6 | import { isPostImportVideoAccepted } from '@server/lib/moderation' |
6 | import { generateWebTorrentVideoFilename } from '@server/lib/paths' | 7 | import { generateWebTorrentVideoFilename } from '@server/lib/paths' |
7 | import { Hooks } from '@server/lib/plugins/hooks' | 8 | import { Hooks } from '@server/lib/plugins/hooks' |
@@ -25,7 +26,7 @@ import { | |||
25 | VideoResolution, | 26 | VideoResolution, |
26 | VideoState | 27 | VideoState |
27 | } from '@shared/models' | 28 | } from '@shared/models' |
28 | import { ffprobePromise, getVideoStreamDuration, getVideoStreamFPS, getVideoStreamDimensionsInfo } from '../../../helpers/ffmpeg' | 29 | import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamDuration, getVideoStreamFPS } from '../../../helpers/ffmpeg' |
29 | import { logger } from '../../../helpers/logger' | 30 | import { logger } from '../../../helpers/logger' |
30 | import { getSecureTorrentName } from '../../../helpers/utils' | 31 | import { getSecureTorrentName } from '../../../helpers/utils' |
31 | import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' | 32 | import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' |
@@ -80,7 +81,11 @@ async function processYoutubeDLImport (job: Job, videoImport: MVideoImportDefaul | |||
80 | 81 | ||
81 | const options = { type: payload.type, videoImportId: videoImport.id } | 82 | const options = { type: payload.type, videoImportId: videoImport.id } |
82 | 83 | ||
83 | const youtubeDL = new YoutubeDLWrapper(videoImport.targetUrl, ServerConfigManager.Instance.getEnabledResolutions('vod')) | 84 | const youtubeDL = new YoutubeDLWrapper( |
85 | videoImport.targetUrl, | ||
86 | ServerConfigManager.Instance.getEnabledResolutions('vod'), | ||
87 | CONFIG.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION | ||
88 | ) | ||
84 | 89 | ||
85 | return processFile( | 90 | return processFile( |
86 | () => youtubeDL.downloadVideo(payload.fileExt, JOB_TTL['video-import']), | 91 | () => youtubeDL.downloadVideo(payload.fileExt, JOB_TTL['video-import']), |
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts index 890d34e3b..4e5e97919 100644 --- a/server/lib/job-queue/handlers/video-transcoding.ts +++ b/server/lib/job-queue/handlers/video-transcoding.ts | |||
@@ -265,7 +265,7 @@ async function createLowerResolutionsJobs (options: { | |||
265 | 265 | ||
266 | // Create transcoding jobs if there are enabled resolutions | 266 | // Create transcoding jobs if there are enabled resolutions |
267 | const resolutionsEnabled = await Hooks.wrapObject( | 267 | const resolutionsEnabled = await Hooks.wrapObject( |
268 | computeResolutionsToTranscode({ inputResolution: videoFileResolution, type: 'vod', includeInputResolution: false }), | 268 | computeResolutionsToTranscode({ input: videoFileResolution, type: 'vod', includeInput: false, strictLower: true }), |
269 | 'filter:transcoding.auto.resolutions-to-transcode.result', | 269 | 'filter:transcoding.auto.resolutions-to-transcode.result', |
270 | options | 270 | options |
271 | ) | 271 | ) |