Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

higher priority for live transcoding compared to vod transcoding #3577

Merged
merged 1 commit into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion server/helpers/ffmpeg-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,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
Expand Down
7 changes: 5 additions & 2 deletions server/initializers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down