ActivityPub-federated video streaming platform using P2P directly in your web browser
Improve generated image quality
Chocobozzzfb2dc408585d
diff --git a/packages/ffmpeg/src/ffmpeg-images.ts b/packages/ffmpeg/src/ffmpeg-images.tsindex f9f352e3c2..296cd10fba 100644--- a/packages/ffmpeg/src/ffmpeg-images.ts+++ b/packages/ffmpeg/src/ffmpeg-images.ts@@ -42,6 +42,10 @@ export class FFmpegImage {fromPath: stringoutput: stringframesToAnalyze: number+ scale?: {+ width: number+ height: number+ }ffprobe?: FfprobeData}) {const { fromPath, ffprobe } = options@@ -69,14 +73,25 @@ export class FFmpegImage {fromPath: stringoutput: stringframesToAnalyze: number+ scale?: {+ width: number+ height: number+ }}) {- const { fromPath, output, framesToAnalyze } = options+ const { fromPath, output, framesToAnalyze, scale } = options- return this.commandWrapper.buildCommand(fromPath)+ const command = this.commandWrapper.buildCommand(fromPath).videoFilter('thumbnail=' + framesToAnalyze).outputOption('-frames:v 1')+ .outputOption('-q:v 5').outputOption('-abort_on empty_output').output(output)++ if (scale) {+ command.videoFilter(`scale=${scale.width}x${scale.height}:force_original_aspect_ratio=decrease`)+ }++ return command}// ---------------------------------------------------------------------------diff --git a/packages/tests/fixtures/custom-preview.jpg b/packages/tests/fixtures/custom-preview.jpgindex 5a039d8307..a070c2bc50 100644Binary files a/packages/tests/fixtures/custom-preview.jpg and b/packages/tests/fixtures/custom-preview.jpg differdiff --git a/packages/tests/fixtures/custom-thumbnail-from-preview.jpg b/packages/tests/fixtures/custom-thumbnail-from-preview.jpgindex fe8545b481..8238f4b8ce 100644Binary files a/packages/tests/fixtures/custom-thumbnail-from-preview.jpg and b/packages/tests/fixtures/custom-thumbnail-from-preview.jpg differdiff --git a/packages/tests/fixtures/thumbnail-playlist.jpg b/packages/tests/fixtures/thumbnail-playlist.jpgindex cc51fc7839..061f19f70a 100644Binary files a/packages/tests/fixtures/thumbnail-playlist.jpg and b/packages/tests/fixtures/thumbnail-playlist.jpg differdiff --git a/packages/tests/fixtures/video_short.mp4.jpg b/packages/tests/fixtures/video_short.mp4.jpgindex 2ff0144395..1b8ed917a9 100644Binary files a/packages/tests/fixtures/video_short.mp4.jpg and b/packages/tests/fixtures/video_short.mp4.jpg differdiff --git a/packages/tests/fixtures/video_short.ogv.jpg b/packages/tests/fixtures/video_short.ogv.jpgindex 4fcb8fbd1d..a4c514d132 100644Binary files a/packages/tests/fixtures/video_short.ogv.jpg and b/packages/tests/fixtures/video_short.ogv.jpg differdiff --git a/packages/tests/fixtures/video_short.webm.jpg b/packages/tests/fixtures/video_short.webm.jpgindex cc51fc7839..061f19f70a 100644Binary files a/packages/tests/fixtures/video_short.webm.jpg and b/packages/tests/fixtures/video_short.webm.jpg differdiff --git a/packages/tests/fixtures/video_short1-preview.webm.jpg b/packages/tests/fixtures/video_short1-preview.webm.jpgindex 60b6927748..de930f2d72 100644Binary files a/packages/tests/fixtures/video_short1-preview.webm.jpg and b/packages/tests/fixtures/video_short1-preview.webm.jpg differdiff --git a/packages/tests/fixtures/video_short1.webm.jpg b/packages/tests/fixtures/video_short1.webm.jpgindex 13922ca51a..88d950b3d6 100644Binary files a/packages/tests/fixtures/video_short1.webm.jpg and b/packages/tests/fixtures/video_short1.webm.jpg differdiff --git a/packages/tests/fixtures/video_short2.webm.jpg b/packages/tests/fixtures/video_short2.webm.jpgindex 1920f2348b..1016f63549 100644Binary files a/packages/tests/fixtures/video_short2.webm.jpg and b/packages/tests/fixtures/video_short2.webm.jpg differdiff --git a/packages/tests/fixtures/video_short3.webm.jpg b/packages/tests/fixtures/video_short3.webm.jpgindex 857b3d1c16..f5fabefbdf 100644Binary files a/packages/tests/fixtures/video_short3.webm.jpg and b/packages/tests/fixtures/video_short3.webm.jpg differdiff --git a/server/core/lib/thumbnail.ts b/server/core/lib/thumbnail.tsindex 14b849fb4e..41479638c1 100644--- a/server/core/lib/thumbnail.ts+++ b/server/core/lib/thumbnail.ts@@ -380,7 +380,7 @@ async function generateImageFromVideoFile (options: {try {const framesToAnalyze = CONFIG.THUMBNAILS.GENERATION_FROM_VIDEO.FRAMES_TO_ANALYZE- await generateThumbnailFromVideo({ fromPath, output: pendingImagePath, framesToAnalyze, ffprobe })+ await generateThumbnailFromVideo({ fromPath, output: pendingImagePath, framesToAnalyze, ffprobe, scale: size })const destination = join(folder, imageName)await processImageFromWorker({ path: pendingImagePath, destination, newSize: size })