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:
parent
9880d2adf5
commit
2bc4d26b94
7 changed files with 34 additions and 3 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue