Ability to change the scaling algorithm and default is now bicubic instead of fast_bilinear. Related to #116

This commit is contained in:
vexorian 2021-01-10 13:47:43 -04:00
parent 59253cd9ca
commit 17e565ee6f
4 changed files with 27 additions and 2 deletions

View File

@ -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,

View File

@ -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) ) )

View File

@ -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"},
];
}
}
}

View File

@ -91,10 +91,18 @@
<br />
<label>Video Buffer Size (k)</label>
<input type="number" class="form-control form-control-sm" ng-model="settings.videoBufSize"/>
<br />
<label>Max Frame Rate</label>
<select class='form-control custom-select' ng-model="settings.maxFPS" ria-describedby="fpsHelp"
ng-options="o.id as o.description for o in fpsOptions" ></select>
<small id='fpsHelp' class='form-text text-muted'>Will transcode videos that have FPS higher than this.</small>
<br />
<label>Scaling Algorithm</label>
<select class='form-control custom-select' ng-model="settings.scalingAlgorithm" ria-describedby="scalingHelp"
ng-options="o.id as o.description for o in scalingOptions" ></select>
<small id='scalingHelp' class='form-text text-muted'>Scaling algorithm to use when the transcoder needs to change the video size.</small>
</div>
<div class="form-group">