diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/helpers/ffmpeg/ffmpeg-edition.ts | 27 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/video-studio-edition.ts | 5 |
2 files changed, 24 insertions, 8 deletions
diff --git a/server/helpers/ffmpeg/ffmpeg-edition.ts b/server/helpers/ffmpeg/ffmpeg-edition.ts index 78de8f3b3..02c5ea8de 100644 --- a/server/helpers/ffmpeg/ffmpeg-edition.ts +++ b/server/helpers/ffmpeg/ffmpeg-edition.ts | |||
@@ -3,7 +3,7 @@ import { VIDEO_FILTERS } from '@server/initializers/constants' | |||
3 | import { AvailableEncoders } from '@shared/models' | 3 | import { AvailableEncoders } from '@shared/models' |
4 | import { logger, loggerTagsFactory } from '../logger' | 4 | import { logger, loggerTagsFactory } from '../logger' |
5 | import { getFFmpeg, runCommand } from './ffmpeg-commons' | 5 | import { getFFmpeg, runCommand } from './ffmpeg-commons' |
6 | import { presetCopy, presetVOD } from './ffmpeg-presets' | 6 | import { presetVOD } from './ffmpeg-presets' |
7 | import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamDuration, getVideoStreamFPS, hasAudioStream } from './ffprobe-utils' | 7 | import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamDuration, getVideoStreamFPS, hasAudioStream } from './ffprobe-utils' |
8 | 8 | ||
9 | const lTags = loggerTagsFactory('ffmpeg') | 9 | const lTags = loggerTagsFactory('ffmpeg') |
@@ -13,25 +13,38 @@ async function cutVideo (options: { | |||
13 | outputPath: string | 13 | outputPath: string |
14 | start?: number | 14 | start?: number |
15 | end?: number | 15 | end?: number |
16 | |||
17 | availableEncoders: AvailableEncoders | ||
18 | profile: string | ||
16 | }) { | 19 | }) { |
17 | const { inputPath, outputPath } = options | 20 | const { inputPath, outputPath, availableEncoders, profile } = options |
18 | 21 | ||
19 | logger.debug('Will cut the video.', { options, ...lTags() }) | 22 | logger.debug('Will cut the video.', { options, ...lTags() }) |
20 | 23 | ||
24 | const mainProbe = await ffprobePromise(inputPath) | ||
25 | const fps = await getVideoStreamFPS(inputPath, mainProbe) | ||
26 | const { resolution } = await getVideoStreamDimensionsInfo(inputPath, mainProbe) | ||
27 | |||
21 | let command = getFFmpeg(inputPath, 'vod') | 28 | let command = getFFmpeg(inputPath, 'vod') |
22 | .output(outputPath) | 29 | .output(outputPath) |
23 | 30 | ||
24 | command = presetCopy(command) | 31 | command = await presetVOD({ |
32 | command, | ||
33 | input: inputPath, | ||
34 | availableEncoders, | ||
35 | profile, | ||
36 | resolution, | ||
37 | fps, | ||
38 | canCopyAudio: false, | ||
39 | canCopyVideo: false | ||
40 | }) | ||
25 | 41 | ||
26 | if (options.start) { | 42 | if (options.start) { |
27 | // Using -ss as output option is more precise than using it as input option | ||
28 | command.outputOption('-ss ' + options.start) | 43 | command.outputOption('-ss ' + options.start) |
29 | } | 44 | } |
30 | 45 | ||
31 | if (options.end) { | 46 | if (options.end) { |
32 | const endSeeking = options.end - (options.start || 0) | 47 | command.outputOption('-to ' + options.end) |
33 | |||
34 | command.outputOption('-to ' + endSeeking) | ||
35 | } | 48 | } |
36 | 49 | ||
37 | await runCommand({ command }) | 50 | await runCommand({ command }) |
diff --git a/server/lib/job-queue/handlers/video-studio-edition.ts b/server/lib/job-queue/handlers/video-studio-edition.ts index 23f9a34cc..3e208d83d 100644 --- a/server/lib/job-queue/handlers/video-studio-edition.ts +++ b/server/lib/job-queue/handlers/video-studio-edition.ts | |||
@@ -164,7 +164,10 @@ function processCut (options: TaskProcessorOptions<VideoStudioTaskCutPayload>) { | |||
164 | ...pick(options, [ 'inputPath', 'outputPath' ]), | 164 | ...pick(options, [ 'inputPath', 'outputPath' ]), |
165 | 165 | ||
166 | start: task.options.start, | 166 | start: task.options.start, |
167 | end: task.options.end | 167 | end: task.options.end, |
168 | |||
169 | availableEncoders: VideoTranscodingProfilesManager.Instance.getAvailableEncoders(), | ||
170 | profile: CONFIG.TRANSCODING.PROFILE | ||
168 | }) | 171 | }) |
169 | } | 172 | } |
170 | 173 | ||