mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Add ability to customize frames to analyze
This commit is contained in:
parent
9880d2adf5
commit
2bc4d26b94
7 changed files with 34 additions and 3 deletions
|
@ -53,6 +53,7 @@ function checkConfig () {
|
|||
checkLiveConfig()
|
||||
checkObjectStorageConfig()
|
||||
checkVideoStudioConfig()
|
||||
checkThumbnailsConfig()
|
||||
}
|
||||
|
||||
// We get db by param to not import it in this file (import orders)
|
||||
|
@ -331,3 +332,9 @@ function checkVideoStudioConfig () {
|
|||
throw new Error('Video studio cannot be enabled if transcoding is disabled')
|
||||
}
|
||||
}
|
||||
|
||||
function checkThumbnailsConfig () {
|
||||
if (CONFIG.THUMBNAILS.GENERATION_FROM_VIDEO.FRAMES_TO_ANALYZE < 2) {
|
||||
throw new Error('thumbnails.generation_from_video.frames_to_analyze must be a number greater than 1')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ function checkMissedConfig () {
|
|||
'video_studio.enabled', 'video_studio.remote_runners.enabled',
|
||||
'video_file.update.enabled',
|
||||
'remote_runners.stalled_jobs.vod', 'remote_runners.stalled_jobs.live',
|
||||
'thumbnails.generation_from_video.frames_to_analyze',
|
||||
'import.videos.http.enabled', 'import.videos.torrent.enabled', 'import.videos.concurrency', 'import.videos.timeout',
|
||||
'import.video_channel_synchronization.enabled', 'import.video_channel_synchronization.max_per_user',
|
||||
'import.video_channel_synchronization.check_interval', 'import.video_channel_synchronization.videos_limit_per_synchronization',
|
||||
|
|
|
@ -344,6 +344,11 @@ const CONFIG = {
|
|||
VOD: parseDurationToMs(config.get<string>('remote_runners.stalled_jobs.vod'))
|
||||
}
|
||||
},
|
||||
THUMBNAILS: {
|
||||
GENERATION_FROM_VIDEO: {
|
||||
FRAMES_TO_ANALYZE: config.get<number>('thumbnails.generation_from_video.frames_to_analyze')
|
||||
}
|
||||
},
|
||||
ADMIN: {
|
||||
get EMAIL () { return config.get<string>('admin.email') }
|
||||
},
|
||||
|
|
|
@ -379,7 +379,8 @@ async function generateImageFromVideoFile (options: {
|
|||
const pendingImagePath = join(folder, pendingImageName)
|
||||
|
||||
try {
|
||||
await generateThumbnailFromVideo({ fromPath, output: pendingImagePath, ffprobe })
|
||||
const framesToAnalyze = CONFIG.THUMBNAILS.GENERATION_FROM_VIDEO.FRAMES_TO_ANALYZE
|
||||
await generateThumbnailFromVideo({ fromPath, output: pendingImagePath, framesToAnalyze, ffprobe })
|
||||
|
||||
const destination = join(folder, imageName)
|
||||
await processImageFromWorker({ path: pendingImagePath, destination, newSize: size })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue