aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/create-transcoding-job.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/create-transcoding-job.ts')
-rwxr-xr-xscripts/create-transcoding-job.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.ts
index 3a552c19a..0bb9bfeab 100755
--- a/scripts/create-transcoding-job.ts
+++ b/scripts/create-transcoding-job.ts
@@ -6,9 +6,10 @@ import { VideoModel } from '../server/models/video/video'
6import { initDatabaseModels } from '../server/initializers/database' 6import { initDatabaseModels } from '../server/initializers/database'
7import { JobQueue } from '../server/lib/job-queue' 7import { JobQueue } from '../server/lib/job-queue'
8import { computeResolutionsToTranscode } from '@server/helpers/ffprobe-utils' 8import { computeResolutionsToTranscode } from '@server/helpers/ffprobe-utils'
9import { VideoTranscodingPayload } from '@shared/models' 9import { VideoState, VideoTranscodingPayload } from '@shared/models'
10import { CONFIG } from '@server/initializers/config' 10import { CONFIG } from '@server/initializers/config'
11import { isUUIDValid } from '@server/helpers/custom-validators/misc' 11import { isUUIDValid } from '@server/helpers/custom-validators/misc'
12import { addTranscodingJob } from '@server/lib/video'
12 13
13program 14program
14 .option('-v, --video [videoUUID]', 'Video UUID') 15 .option('-v, --video [videoUUID]', 'Video UUID')
@@ -47,7 +48,7 @@ async function run () {
47 if (!video) throw new Error('Video not found.') 48 if (!video) throw new Error('Video not found.')
48 49
49 const dataInput: VideoTranscodingPayload[] = [] 50 const dataInput: VideoTranscodingPayload[] = []
50 const { resolution } = await video.getMaxQualityResolution() 51 const resolution = video.getMaxQualityFile().resolution
51 52
52 // Generate HLS files 53 // Generate HLS files
53 if (options.generateHls || CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) { 54 if (options.generateHls || CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) {
@@ -62,6 +63,7 @@ async function run () {
62 resolution, 63 resolution,
63 isPortraitMode: false, 64 isPortraitMode: false,
64 copyCodecs: false, 65 copyCodecs: false,
66 isNewVideo: false,
65 isMaxQuality: false 67 isMaxQuality: false
66 }) 68 })
67 } 69 }
@@ -87,10 +89,13 @@ async function run () {
87 } 89 }
88 } 90 }
89 91
90 await JobQueue.Instance.init() 92 JobQueue.Instance.init()
93
94 video.state = VideoState.TO_TRANSCODE
95 await video.save()
91 96
92 for (const d of dataInput) { 97 for (const d of dataInput) {
93 await JobQueue.Instance.createJobWithPromise({ type: 'video-transcoding', payload: d }) 98 await addTranscodingJob(d, {})
94 console.log('Transcoding job for video %s created.', video.uuid) 99 console.log('Transcoding job for video %s created.', video.uuid)
95 } 100 }
96} 101}