diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-18 14:35:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-18 15:20:57 +0100 |
commit | ad5db1044c8599eaaaa2a578b350777ae996b068 (patch) | |
tree | 3e003cccf021152405d49b21c6c91b703c8ae96c /scripts | |
parent | b46cf4b920984492df598c1b61179acfc7f6f22e (diff) | |
download | PeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.tar.gz PeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.tar.zst PeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.zip |
Add ability to run transcoding jobs
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/create-transcoding-job.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.ts index 29c398822..244c38fcd 100755 --- a/scripts/create-transcoding-job.ts +++ b/scripts/create-transcoding-job.ts | |||
@@ -5,7 +5,7 @@ import { program } from 'commander' | |||
5 | import { VideoModel } from '../server/models/video/video' | 5 | import { VideoModel } from '../server/models/video/video' |
6 | import { initDatabaseModels } from '../server/initializers/database' | 6 | import { initDatabaseModels } from '../server/initializers/database' |
7 | import { JobQueue } from '../server/lib/job-queue' | 7 | import { JobQueue } from '../server/lib/job-queue' |
8 | import { computeResolutionsToTranscode } from '@server/helpers/ffprobe-utils' | 8 | import { computeLowerResolutionsToTranscode } from '@server/helpers/ffprobe-utils' |
9 | import { VideoState, VideoTranscodingPayload } from '@shared/models' | 9 | import { VideoState, VideoTranscodingPayload } from '@shared/models' |
10 | import { CONFIG } from '@server/initializers/config' | 10 | import { CONFIG } from '@server/initializers/config' |
11 | import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' | 11 | import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' |
@@ -50,13 +50,13 @@ async function run () { | |||
50 | if (!video) throw new Error('Video not found.') | 50 | if (!video) throw new Error('Video not found.') |
51 | 51 | ||
52 | const dataInput: VideoTranscodingPayload[] = [] | 52 | const dataInput: VideoTranscodingPayload[] = [] |
53 | const resolution = video.getMaxQualityFile().resolution | 53 | const maxResolution = video.getMaxQualityFile().resolution |
54 | 54 | ||
55 | // Generate HLS files | 55 | // Generate HLS files |
56 | if (options.generateHls || CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) { | 56 | if (options.generateHls || CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) { |
57 | const resolutionsEnabled = options.resolution | 57 | const resolutionsEnabled = options.resolution |
58 | ? [ parseInt(options.resolution) ] | 58 | ? [ parseInt(options.resolution) ] |
59 | : computeResolutionsToTranscode(resolution, 'vod').concat([ resolution ]) | 59 | : computeLowerResolutionsToTranscode(maxResolution, 'vod').concat([ maxResolution ]) |
60 | 60 | ||
61 | for (const resolution of resolutionsEnabled) { | 61 | for (const resolution of resolutionsEnabled) { |
62 | dataInput.push({ | 62 | dataInput.push({ |
@@ -66,7 +66,8 @@ async function run () { | |||
66 | isPortraitMode: false, | 66 | isPortraitMode: false, |
67 | copyCodecs: false, | 67 | copyCodecs: false, |
68 | isNewVideo: false, | 68 | isNewVideo: false, |
69 | isMaxQuality: false | 69 | isMaxQuality: maxResolution === resolution, |
70 | autoDeleteWebTorrentIfNeeded: false | ||
70 | }) | 71 | }) |
71 | } | 72 | } |
72 | } else { | 73 | } else { |