aboutsummaryrefslogtreecommitdiffhomepage
path: root/packages/peertube-runner/server/process/shared/process-studio.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/peertube-runner/server/process/shared/process-studio.ts')
-rw-r--r--packages/peertube-runner/server/process/shared/process-studio.ts50
1 files changed, 29 insertions, 21 deletions
diff --git a/packages/peertube-runner/server/process/shared/process-studio.ts b/packages/peertube-runner/server/process/shared/process-studio.ts
index f8262096e..9c745d031 100644
--- a/packages/peertube-runner/server/process/shared/process-studio.ts
+++ b/packages/peertube-runner/server/process/shared/process-studio.ts
@@ -1,11 +1,11 @@
1import { remove } from 'fs-extra' 1import { remove } from 'fs-extra'
2import { pick } from 'lodash' 2import { pick } from 'lodash'
3import { logger } from 'packages/peertube-runner/shared' 3import { logger } from 'packages/peertube-runner/shared'
4import { extname, join } from 'path' 4import { join } from 'path'
5import { buildUUID } from '@shared/extra-utils' 5import { buildUUID } from '@shared/extra-utils'
6import { 6import {
7 RunnerJobVideoEditionTranscodingPayload, 7 RunnerJobStudioTranscodingPayload,
8 VideoEditionTranscodingSuccess, 8 VideoStudioTranscodingSuccess,
9 VideoStudioTask, 9 VideoStudioTask,
10 VideoStudioTaskCutPayload, 10 VideoStudioTaskCutPayload,
11 VideoStudioTaskIntroPayload, 11 VideoStudioTaskIntroPayload,
@@ -16,7 +16,7 @@ import {
16import { ConfigManager } from '../../../shared/config-manager' 16import { ConfigManager } from '../../../shared/config-manager'
17import { buildFFmpegEdition, downloadInputFile, JobWithToken, ProcessOptions } from './common' 17import { buildFFmpegEdition, downloadInputFile, JobWithToken, ProcessOptions } from './common'
18 18
19export async function processStudioTranscoding (options: ProcessOptions<RunnerJobVideoEditionTranscodingPayload>) { 19export async function processStudioTranscoding (options: ProcessOptions<RunnerJobStudioTranscodingPayload>) {
20 const { server, job, runnerToken } = options 20 const { server, job, runnerToken } = options
21 const payload = job.payload 21 const payload = job.payload
22 22
@@ -43,7 +43,7 @@ export async function processStudioTranscoding (options: ProcessOptions<RunnerJo
43 tmpInputFilePath = outputPath 43 tmpInputFilePath = outputPath
44 } 44 }
45 45
46 const successBody: VideoEditionTranscodingSuccess = { 46 const successBody: VideoStudioTranscodingSuccess = {
47 videoFile: outputPath 47 videoFile: outputPath
48 } 48 }
49 49
@@ -94,14 +94,18 @@ async function processAddIntroOutro (options: TaskProcessorOptions<VideoStudioTa
94 94
95 const introOutroPath = await downloadInputFile({ url: task.options.file, runnerToken, job }) 95 const introOutroPath = await downloadInputFile({ url: task.options.file, runnerToken, job })
96 96
97 return buildFFmpegEdition().addIntroOutro({ 97 try {
98 ...pick(options, [ 'inputPath', 'outputPath' ]), 98 await buildFFmpegEdition().addIntroOutro({
99 ...pick(options, [ 'inputPath', 'outputPath' ]),
99 100
100 introOutroPath, 101 introOutroPath,
101 type: task.name === 'add-intro' 102 type: task.name === 'add-intro'
102 ? 'intro' 103 ? 'intro'
103 : 'outro' 104 : 'outro'
104 }) 105 })
106 } finally {
107 await remove(introOutroPath)
108 }
105} 109}
106 110
107function processCut (options: TaskProcessorOptions<VideoStudioTaskCutPayload>) { 111function processCut (options: TaskProcessorOptions<VideoStudioTaskCutPayload>) {
@@ -124,15 +128,19 @@ async function processAddWatermark (options: TaskProcessorOptions<VideoStudioTas
124 128
125 const watermarkPath = await downloadInputFile({ url: task.options.file, runnerToken, job }) 129 const watermarkPath = await downloadInputFile({ url: task.options.file, runnerToken, job })
126 130
127 return buildFFmpegEdition().addWatermark({ 131 try {
128 ...pick(options, [ 'inputPath', 'outputPath' ]), 132 await buildFFmpegEdition().addWatermark({
133 ...pick(options, [ 'inputPath', 'outputPath' ]),
129 134
130 watermarkPath, 135 watermarkPath,
131 136
132 videoFilters: { 137 videoFilters: {
133 watermarkSizeRatio: task.options.watermarkSizeRatio, 138 watermarkSizeRatio: task.options.watermarkSizeRatio,
134 horitonzalMarginRatio: task.options.horitonzalMarginRatio, 139 horitonzalMarginRatio: task.options.horitonzalMarginRatio,
135 verticalMarginRatio: task.options.verticalMarginRatio 140 verticalMarginRatio: task.options.verticalMarginRatio
136 } 141 }
137 }) 142 })
143 } finally {
144 await remove(watermarkPath)
145 }
138} 146}