aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/ffmpeg-utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/ffmpeg-utils.ts')
-rw-r--r--server/helpers/ffmpeg-utils.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts
index e328c49ac..d20ca5d56 100644
--- a/server/helpers/ffmpeg-utils.ts
+++ b/server/helpers/ffmpeg-utils.ts
@@ -5,11 +5,12 @@ import { dirname, join } from 'path'
5import { FFMPEG_NICE, VIDEO_LIVE } from '@server/initializers/constants' 5import { FFMPEG_NICE, VIDEO_LIVE } from '@server/initializers/constants'
6import { AvailableEncoders, EncoderOptionsBuilder, EncoderOptions, EncoderProfile, VideoResolution } from '../../shared/models/videos' 6import { AvailableEncoders, EncoderOptionsBuilder, EncoderOptions, EncoderProfile, VideoResolution } from '../../shared/models/videos'
7import { CONFIG } from '../initializers/config' 7import { CONFIG } from '../initializers/config'
8import { execPromise, promisify0 } from './core-utils' 8import { execPromise, isOdd, promisify0 } from './core-utils'
9import { computeFPS, getAudioStream, getVideoFileFPS } from './ffprobe-utils' 9import { computeFPS, getAudioStream, getVideoFileFPS } from './ffprobe-utils'
10import { processImage } from './image-utils' 10import { processImage } from './image-utils'
11import { logger } from './logger' 11import { logger } from './logger'
12import { FilterSpecification } from 'fluent-ffmpeg' 12import { FilterSpecification } from 'fluent-ffmpeg'
13import { findCommentId } from '@shared/extra-utils'
13 14
14/** 15/**
15 * 16 *
@@ -133,7 +134,7 @@ interface BaseTranscodeOptions {
133 availableEncoders: AvailableEncoders 134 availableEncoders: AvailableEncoders
134 profile: string 135 profile: string
135 136
136 resolution: VideoResolution 137 resolution: number
137 138
138 isPortraitMode?: boolean 139 isPortraitMode?: boolean
139 140
@@ -407,8 +408,7 @@ async function buildx264VODCommand (command: ffmpeg.FfmpegCommand, options: Tran
407async function buildAudioMergeCommand (command: ffmpeg.FfmpegCommand, options: MergeAudioTranscodeOptions) { 408async function buildAudioMergeCommand (command: ffmpeg.FfmpegCommand, options: MergeAudioTranscodeOptions) {
408 command = command.loop(undefined) 409 command = command.loop(undefined)
409 410
410 // Avoid "height not divisible by 2" error 411 const scaleFilterValue = getScaleCleanerValue()
411 const scaleFilterValue = 'trunc(iw/2)*2:trunc(ih/2)*2'
412 command = await presetVideo({ command, input: options.audioPath, transcodeOptions: options, scaleFilterValue }) 412 command = await presetVideo({ command, input: options.audioPath, transcodeOptions: options, scaleFilterValue })
413 413
414 command.outputOption('-preset:v veryfast') 414 command.outputOption('-preset:v veryfast')
@@ -542,7 +542,7 @@ async function getEncoderBuilderResult (options: {
542 } 542 }
543 } 543 }
544 544
545 const result = await builder({ input, resolution: resolution, fps, streamNum }) 545 const result = await builder({ input, resolution, fps, streamNum })
546 546
547 return { 547 return {
548 result, 548 result,
@@ -727,6 +727,11 @@ async function runCommand (options: {
727 }) 727 })
728} 728}
729 729
730// Avoid "height not divisible by 2" error
731function getScaleCleanerValue () {
732 return 'trunc(iw/2)*2:trunc(ih/2)*2'
733}
734
730// --------------------------------------------------------------------------- 735// ---------------------------------------------------------------------------
731 736
732export { 737export {