Change videothumnail to use -ss ot -t0, not both

Log (warn) on error if the first thumbnail fails because the error can be handy in debugging
master
Thomas Lynch 3 months ago
parent c41d1f9354
commit 6d1aedf552
  1. 3
      lib/file/video/videothumbnail.js
  2. 7
      models/forms/makepost.js

@ -9,8 +9,7 @@ module.exports = (file, geometry, timestamp) => {
const { thumbSize } = config.get;
let inputArgs = [
`-ss ${timestamp}`,
'-t 0',
timestamp === 0 ? '-t 0' : `-ss ${timestamp}`
];
let outputArgs = [
`-vf scale=${geometry.width > geometry.height ? thumbSize + ':-2' : '-2:' + thumbSize}`,

@ -331,9 +331,10 @@ module.exports = async (req, res) => {
const timestamp = ((numFrames === 'N/A' && subtype !== 'webm') || numFrames <= 1) ? 0 : processedFile.duration * videoThumbPercentage / 100;
try {
await videoThumbnail(processedFile, processedFile.geometry, timestamp);
} catch (err) { /*No keyframe after timestamp probably. ignore, we'll retry*/ }
//check and fix bad thumbnails in all cases, helps prevent complaints from child molesters who want improper encoding handled better
//for example, can fail on videos without keyframes after the seek timestamp e.g. music with only an album cover frame
} catch (err) {
//No keyframe after timestamp probably. ignore, we'll retry
console.warn(err); //printing log because this error can actually be useful and we dont wanna mask it
}
let videoThumbStat = null;
try {
videoThumbStat = await fsStat(`${uploadDirectory}/file/thumb/${processedFile.hash}${processedFile.thumbextension}`);

Loading…
Cancel
Save