diff --git a/src/database-migration.js b/src/database-migration.js index bfab008..1c6f0ef 100644 --- a/src/database-migration.js +++ b/src/database-migration.js @@ -20,7 +20,7 @@ const path = require('path'); var fs = require('fs'); -const TARGET_VERSION = 700; +const TARGET_VERSION = 701; const STEPS = [ // [v, v2, x] : if the current version is v, call x(db), and version becomes v2 @@ -33,6 +33,7 @@ const STEPS = [ [ 501, 600, () => extractFillersFromChannels() ], [ 600, 601, (db) => addFPS(db) ], [ 601, 700, (db) => migrateWatermark(db) ], + [ 700, 701, (db) => addScalingAlgorithm(db) ], ] const { v4: uuidv4 } = require('uuid'); @@ -395,6 +396,7 @@ function ffmpeg() { normalizeResolution: true, normalizeAudio: true, maxFPS: 60, + scalingAlgorithm: "bicubic", } } @@ -746,6 +748,14 @@ function migrateWatermark(db, channelDB) { console.log("Done migrating watermarks in channels."); } +function addScalingAlgorithm(db) { + let ffmpegSettings = db['ffmpeg-settings'].find()[0]; + let f = path.join(process.env.DATABASE, 'ffmpeg-settings.json'); + ffmpegSettings.scalingAlgorithm = "bicubic"; + fs.writeFileSync( f, JSON.stringify( [ffmpegSettings] ) ); +} + + module.exports = { initDB: initDB, defaultFFMPEG: ffmpeg, diff --git a/src/ffmpeg.js b/src/ffmpeg.js index f7e5de6..b884c1c 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -256,7 +256,7 @@ class FFMPEG extends events.EventEmitter { // Resolution fix: Add scale filter, current stream becomes [siz] let beforeSizeChange = currentVideo; - let algo = "fast_bilinear"; + let algo = this.opts.scalingAlgorithm; let resizeMsg = ""; if ( (this.ensureResolution && ( streamStats.anamorphic || (iW != this.wantedW || iH != this.wantedH) ) ) diff --git a/web/directives/ffmpeg-settings.js b/web/directives/ffmpeg-settings.js index 6388b55..f4f66c7 100644 --- a/web/directives/ffmpeg-settings.js +++ b/web/directives/ffmpeg-settings.js @@ -60,6 +60,13 @@ module.exports = function (dizquetv, resolutionOptions) { {id: 60, description: "60 frames per second"}, {id: 120, description: "120 frames per second"}, ]; + scope.scalingOptions = [ + {id: "bicubic", description: "bicubic (default)"}, + {id: "fast_bilinear", description: "fast_bilinear"}, + {id: "lanczos", description: "lanczos"}, + {id: "spline", description: "spline"}, + ]; + } } } \ No newline at end of file diff --git a/web/public/templates/ffmpeg-settings.html b/web/public/templates/ffmpeg-settings.html index 4958c7f..71a66bb 100644 --- a/web/public/templates/ffmpeg-settings.html +++ b/web/public/templates/ffmpeg-settings.html @@ -91,10 +91,18 @@
+
Will transcode videos that have FPS higher than this. + +
+ + + Scaling algorithm to use when the transcoder needs to change the video size. +