mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09:37 +02:00
server/server -> server/core
This commit is contained in:
parent
114327d4ce
commit
5a3d0650c9
838 changed files with 111 additions and 111 deletions
45
server/core/helpers/ffmpeg/ffmpeg-options.ts
Normal file
45
server/core/helpers/ffmpeg/ffmpeg-options.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import { logger } from '@server/helpers/logger.js'
|
||||
import { CONFIG } from '@server/initializers/config.js'
|
||||
import { FFMPEG_NICE } from '@server/initializers/constants.js'
|
||||
import { FFmpegCommandWrapperOptions } from '@peertube/peertube-ffmpeg'
|
||||
import { AvailableEncoders } from '@peertube/peertube-models'
|
||||
|
||||
type CommandType = 'live' | 'vod' | 'thumbnail'
|
||||
|
||||
export function getFFmpegCommandWrapperOptions (type: CommandType, availableEncoders?: AvailableEncoders): FFmpegCommandWrapperOptions {
|
||||
return {
|
||||
availableEncoders,
|
||||
profile: getProfile(type),
|
||||
|
||||
niceness: FFMPEG_NICE[type.toUpperCase()],
|
||||
tmpDirectory: CONFIG.STORAGE.TMP_DIR,
|
||||
threads: getThreads(type),
|
||||
|
||||
logger: {
|
||||
debug: logger.debug.bind(logger),
|
||||
info: logger.info.bind(logger),
|
||||
warn: logger.warn.bind(logger),
|
||||
error: logger.error.bind(logger)
|
||||
},
|
||||
lTags: { tags: [ 'ffmpeg' ] }
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function getThreads (type: CommandType) {
|
||||
if (type === 'live') return CONFIG.LIVE.TRANSCODING.THREADS
|
||||
if (type === 'vod') return CONFIG.TRANSCODING.THREADS
|
||||
|
||||
// Auto
|
||||
return 0
|
||||
}
|
||||
|
||||
function getProfile (type: CommandType) {
|
||||
if (type === 'live') return CONFIG.LIVE.TRANSCODING.PROFILE
|
||||
if (type === 'vod') return CONFIG.TRANSCODING.PROFILE
|
||||
|
||||
return undefined
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue