ActivityPub-federated video streaming platform using P2P directly in your web browser
Simpler thumbnail generation
Chocobozzzb7f946892bcd
diff --git a/server/helpers/image-utils.ts b/server/helpers/image-utils.tsindex f86f7216d8..7b77e694ad 100644--- a/server/helpers/image-utils.ts+++ b/server/helpers/image-utils.ts@@ -51,7 +51,7 @@ async function generateImageFromVideoFile (options: {const pendingImagePath = join(folder, pendingImageName)try {- await generateThumbnailFromVideo({ fromPath, folder, imageName })+ await generateThumbnailFromVideo({ fromPath, output: pendingImagePath })const destination = join(folder, imageName)await processImage({ path: pendingImagePath, destination, newSize: size })diff --git a/shared/ffmpeg/ffmpeg-images.ts b/shared/ffmpeg/ffmpeg-images.tsindex 27305382ce..618fac7d13 100644--- a/shared/ffmpeg/ffmpeg-images.ts+++ b/shared/ffmpeg/ffmpeg-images.ts@@ -1,4 +1,5 @@import { FFmpegCommandWrapper, FFmpegCommandWrapperOptions } from './ffmpeg-command-wrapper'+import { getVideoStreamDuration } from './ffprobe'export class FFmpegImage {private readonly commandWrapper: FFmpegCommandWrapper@@ -36,25 +37,20 @@ export class FFmpegImage {async generateThumbnailFromVideo (options: {fromPath: string- folder: string- imageName: string+ output: string}) {- const { fromPath, folder, imageName } = options+ const { fromPath, output } = options- const pendingImageName = 'pending-' + imageName+ let duration = await getVideoStreamDuration(fromPath)+ if (isNaN(duration)) duration = 0- const thumbnailOptions = {- filename: pendingImageName,- count: 1,- folder- }+ this.commandWrapper.buildCommand(fromPath)+ .seekInput(duration / 2)+ .videoFilter('thumbnail=500')+ .outputOption('-frames:v 1')+ .output(output)- return new Promise<string>((res, rej) => {- this.commandWrapper.buildCommand(fromPath)- .on('error', rej)- .on('end', () => res(imageName))- .thumbnail(thumbnailOptions)- })+ return this.commandWrapper.runCommand()}async generateStoryboardFromVideo (options: {