Merge pull request #235 from jasongdove/ffmpeg-deinterlace

add ffmpeg deinterlace options
This commit is contained in:
vexorian 2021-01-14 17:17:54 -04:00 committed by GitHub
commit edbfce11e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 1 deletions

View File

@ -20,7 +20,7 @@
const path = require('path');
var fs = require('fs');
const TARGET_VERSION = 701;
const TARGET_VERSION = 702;
const STEPS = [
// [v, v2, x] : if the current version is v, call x(db), and version becomes v2
@ -34,6 +34,7 @@ const STEPS = [
[ 600, 601, (db) => addFPS(db) ],
[ 601, 700, (db) => migrateWatermark(db) ],
[ 700, 701, (db) => addScalingAlgorithm(db) ],
[ 701, 702, (db) => addDeinterlaceFilter(db) ]
]
const { v4: uuidv4 } = require('uuid');
@ -397,6 +398,7 @@ function ffmpeg() {
normalizeAudio: true,
maxFPS: 60,
scalingAlgorithm: "bicubic",
deinterlaceFilter: "none"
}
}
@ -755,6 +757,12 @@ function addScalingAlgorithm(db) {
fs.writeFileSync( f, JSON.stringify( [ffmpegSettings] ) );
}
function addDeinterlaceFilter(db) {
let ffmpegSettings = db['ffmpeg-settings'].find()[0];
let f = path.join(process.env.DATABASE, 'ffmpeg-settings.json');
ffmpegSettings.deinterlaceFilter = "none";
fs.writeFileSync( f, JSON.stringify( [ffmpegSettings] ) );
}
module.exports = {
initDB: initDB,

View File

@ -165,6 +165,12 @@ class FFMPEG extends events.EventEmitter {
currentVideo ="[fpchange]";
}
// deinterlace if desired
if (streamStats.videoScanType == 'interlaced' && this.opts.deinterlaceFilter != 'none') {
videoComplex += `;${currentVideo}${this.opts.deinterlaceFilter}[deinterlaced]`;
currentVideo = "[deinterlaced]";
}
// prepare input streams
if ( typeof(streamUrl.errorTitle) !== 'undefined') {
doOverlay = false; //never show icon in the error screen

View File

@ -236,6 +236,7 @@ lang=en`
// Rounding framerate avoids scenarios where
// 29.9999999 & 30 don't match.
ret.videoDecision = (typeof stream.decision === 'undefined') ? 'copy' : stream.decision;
ret.videoScanType = stream.scanType;
}
// Audio. Only look at stream being used
if (stream["streamType"] == "2" && stream["selected"] == "1") {

View File

@ -66,6 +66,14 @@ module.exports = function (dizquetv, resolutionOptions) {
{id: "lanczos", description: "lanczos"},
{id: "spline", description: "spline"},
];
scope.deinterlaceOptions = [
{value: "none", description: "do not deinterlace"},
{value: "bwdif=0", description: "bwdif send frame"},
{value: "bwdif=1", description: "bwdif send field"},
{value: "w3fdif", description: "w3fdif"},
{value: "yadif=0", description: "yadif send frame"},
{value: "yadif=1", description: "yadif send field"}
];
}
}

View File

@ -103,6 +103,11 @@
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>
<br />
<label>Deinterlace Filter</label>
<select class='form-control custom-select' ng-model="settings.deinterlaceFilter" ria-describedby="deinterlaceHelp"
ng-options="o.value as o.description for o in deinterlaceOptions" ></select>
<small id='deinterlaceHelp' class='form-text text-muted'>Deinterlace filter to use when video is interlaced. This is only needed when Plex transcoding is not used.</small>
</div>
<div class="form-group">