Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

specific niceness for live transcoding

Rigel Kent7abb6060a915
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts
index 1f5e8d8f6f..d01e6f80ec 100644
--- a/server/helpers/ffmpeg-utils.ts
+++ b/server/helpers/ffmpeg-utils.ts
@@ -594,7 +594,10 @@ function presetOnlyAudio (command: ffmpeg.FfmpegCommand): ffmpeg.FfmpegCommand {
function getFFmpeg (input: string, type: 'live' | 'vod') {
// We set cwd explicitly because ffmpeg appears to create temporary files when trancoding which fails in read-only file systems
- const command = ffmpeg(input, { niceness: FFMPEG_NICE.TRANSCODING, cwd: CONFIG.STORAGE.TMP_DIR })
+ const command = ffmpeg(input, {
+ niceness: type === 'live' ? FFMPEG_NICE.LIVE : FFMPEG_NICE.VOD,
+ cwd: CONFIG.STORAGE.TMP_DIR
+ })
const threads = type === 'live'
? CONFIG.LIVE.TRANSCODING.THREADS
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 0e4ee4a0a1..182bdf9ccb 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -356,8 +356,11 @@ const VIDEO_RATE_TYPES: { [ id: string ]: VideoRateType } = {
}
const FFMPEG_NICE: { [ id: string ]: number } = {
- THUMBNAIL: 2, // 2 just for don't blocking servers
- TRANSCODING: 15
+ // parent process defaults to niceness = 0
+ // reminder: lower = higher priority, max value is 19, lowest is -20
+ THUMBNAIL: 2, // low value in order to avoid blocking server
+ LIVE: 9, // prioritize over VOD
+ VOD: 15
}
const VIDEO_CATEGORIES = {