1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Add ability to customize frames to analyze

This commit is contained in:
Chocobozzz 2023-11-08 10:16:50 +01:00
parent 9880d2adf5
commit 2bc4d26b94
No known key found for this signature in database
GPG key ID: 583A612D890159BE
7 changed files with 34 additions and 3 deletions

View file

@ -39,16 +39,17 @@ export class FFmpegImage {
async generateThumbnailFromVideo (options: {
fromPath: string
output: string
framesToAnalyze: number
ffprobe?: FfprobeData
}) {
const { fromPath, output, ffprobe } = options
const { fromPath, output, ffprobe, framesToAnalyze } = options
let duration = await getVideoStreamDuration(fromPath, ffprobe)
if (isNaN(duration)) duration = 0
this.commandWrapper.buildCommand(fromPath)
.seekInput(duration / 2)
.videoFilter('thumbnail=50')
.videoFilter('thumbnail=' + framesToAnalyze)
.outputOption('-frames:v 1')
.output(output)