From 32efacd41160ee14d30545261c0628ebb7685d59 Mon Sep 17 00:00:00 2001 From: Bobby Date: Sat, 24 Sep 2022 06:24:56 +0700 Subject: [PATCH] feat: configure timemark for video thumbnails --- config.sample.js | 5 ++++- controllers/utilsController.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config.sample.js b/config.sample.js index 88c25e0..dcf034d 100644 --- a/config.sample.js +++ b/config.sample.js @@ -594,7 +594,10 @@ module.exports = { video: true, // Placeholder defaults to 'public/images/unavailable.png'. placeholder: null, - size: 200 + size: 200, + // https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/tree/v2.1.2#screenshotsoptions-dirname-generate-thumbnails + // Only accepts a single value. Defaults to 20%. + videoTimemark: '20%' }, /* diff --git a/controllers/utilsController.js b/controllers/utilsController.js index f58497a..20278d2 100644 --- a/controllers/utilsController.js +++ b/controllers/utilsController.js @@ -524,7 +524,9 @@ self.generateThumbs = async (name, extname, force) => { .screenshots({ folder: paths.thumbs, filename: name.slice(0, -extname.length) + '.png', - timestamps: ['20%'], + timemarks: [ + config.uploads.generateThumbs.videoTimemark || '20%' + ], size: videoStream.width >= videoStream.height ? `${self.thumbsSize}x?` : `?x${self.thumbsSize}`