aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/helpers/ffmpeg-utils.ts6
-rw-r--r--server/initializers/constants.ts6
2 files changed, 9 insertions, 3 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts
index 13bce7d30..ab187aa59 100644
--- a/server/helpers/ffmpeg-utils.ts
+++ b/server/helpers/ffmpeg-utils.ts
@@ -1,7 +1,7 @@
1import * as ffmpeg from 'fluent-ffmpeg' 1import * as ffmpeg from 'fluent-ffmpeg'
2import { join } from 'path' 2import { join } from 'path'
3import { VideoResolution } from '../../shared/models/videos' 3import { VideoResolution } from '../../shared/models/videos'
4import { CONFIG, VIDEO_TRANSCODING_FPS } from '../initializers' 4import { CONFIG, VIDEO_TRANSCODING_FPS, FFMPEG_NICE } from '../initializers'
5import { unlinkPromise } from './core-utils' 5import { unlinkPromise } from './core-utils'
6import { processImage } from './image-utils' 6import { processImage } from './image-utils'
7import { logger } from './logger' 7import { logger } from './logger'
@@ -56,7 +56,7 @@ async function generateImageFromVideoFile (fromPath: string, folder: string, ima
56 56
57 try { 57 try {
58 await new Promise<string>((res, rej) => { 58 await new Promise<string>((res, rej) => {
59 ffmpeg(fromPath) 59 ffmpeg(fromPath, { 'niceness': FFMPEG_NICE.THUMBNAIL })
60 .on('error', rej) 60 .on('error', rej)
61 .on('end', () => res(imageName)) 61 .on('end', () => res(imageName))
62 .thumbnail(options) 62 .thumbnail(options)
@@ -84,7 +84,7 @@ type TranscodeOptions = {
84 84
85function transcode (options: TranscodeOptions) { 85function transcode (options: TranscodeOptions) {
86 return new Promise<void>(async (res, rej) => { 86 return new Promise<void>(async (res, rej) => {
87 let command = ffmpeg(options.inputPath) 87 let command = ffmpeg(options.inputPath, { 'niceness': FFMPEG_NICE.TRANSCODING })
88 .output(options.outputPath) 88 .output(options.outputPath)
89 .outputOption('-threads ' + CONFIG.TRANSCODING.THREADS) 89 .outputOption('-threads ' + CONFIG.TRANSCODING.THREADS)
90 .renice(5) // we don't want to make the system unrepsonsive 90 .renice(5) // we don't want to make the system unrepsonsive
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 6256cf38e..bec343bb7 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -316,6 +316,11 @@ const VIDEO_RATE_TYPES: { [ id: string ]: VideoRateType } = {
316 DISLIKE: 'dislike' 316 DISLIKE: 'dislike'
317} 317}
318 318
319const FFMPEG_NICE: { [ id: string ]: number } = {
320 THUMBNAIL: 2, // 2 just for don't blocking servers
321 TRANSCODING: 15
322}
323
319const VIDEO_CATEGORIES = { 324const VIDEO_CATEGORIES = {
320 1: 'Music', 325 1: 'Music',
321 2: 'Films', 326 2: 'Films',
@@ -570,6 +575,7 @@ export {
570 VIDEO_RATE_TYPES, 575 VIDEO_RATE_TYPES,
571 VIDEO_MIMETYPE_EXT, 576 VIDEO_MIMETYPE_EXT,
572 VIDEO_TRANSCODING_FPS, 577 VIDEO_TRANSCODING_FPS,
578 FFMPEG_NICE,
573 JOB_REQUEST_TIMEOUT, 579 JOB_REQUEST_TIMEOUT,
574 JOB_REQUEST_TTL, 580 JOB_REQUEST_TTL,
575 USER_PASSWORD_RESET_LIFETIME, 581 USER_PASSWORD_RESET_LIFETIME,