diff options
author | Jorropo <jorropo.pgm@gmail.com> | 2018-07-27 11:45:05 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-01 10:57:13 +0200 |
commit | 80bc88c1330c5cf6f5da0ec9252f905e30037f59 (patch) | |
tree | a0a6f5b4b39687b74c538693e2ee30c7c2c3d573 /server/helpers/ffmpeg-utils.ts | |
parent | 4a5ccac5f1df4cbe1f016d1b6aad0a334bba33ae (diff) | |
download | PeerTube-80bc88c1330c5cf6f5da0ec9252f905e30037f59.tar.gz PeerTube-80bc88c1330c5cf6f5da0ec9252f905e30037f59.tar.zst PeerTube-80bc88c1330c5cf6f5da0ec9252f905e30037f59.zip |
Nice ffmpeg to 15 and 2
Niceness 15 for video conversionNiceness 2 for image generation
(niceness 2 doesn't make it slower, just don't block servers and other
app)
Diffstat (limited to 'server/helpers/ffmpeg-utils.ts')
-rw-r--r-- | server/helpers/ffmpeg-utils.ts | 6 |
1 files changed, 3 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 @@ | |||
1 | import * as ffmpeg from 'fluent-ffmpeg' | 1 | import * as ffmpeg from 'fluent-ffmpeg' |
2 | import { join } from 'path' | 2 | import { join } from 'path' |
3 | import { VideoResolution } from '../../shared/models/videos' | 3 | import { VideoResolution } from '../../shared/models/videos' |
4 | import { CONFIG, VIDEO_TRANSCODING_FPS } from '../initializers' | 4 | import { CONFIG, VIDEO_TRANSCODING_FPS, FFMPEG_NICE } from '../initializers' |
5 | import { unlinkPromise } from './core-utils' | 5 | import { unlinkPromise } from './core-utils' |
6 | import { processImage } from './image-utils' | 6 | import { processImage } from './image-utils' |
7 | import { logger } from './logger' | 7 | import { 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 | ||
85 | function transcode (options: TranscodeOptions) { | 85 | function 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 |