New plugin which downmixes to stereo and applies DNC (#194)

* added downmix and DNC plugin

* removed unused functions and code. corrected link address

* renamed the file to match the correct shorthand. updated links and id too

* made adjustments to requirements for processing to only process files with 1 audio stream

* Lint fix

* Run checkPlugins and add recommended changes

Co-authored-by: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com>
make-only-subtitle-default
Jens Andre Kålen 4 years ago committed by GitHub
parent ae251b0d3c
commit 06775a42a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,69 @@
const loadDefaultValues = require('../methods/loadDefaultValues');
const details = () => ({
id: 'Tdarr_Plugin_jeons001_Downmix_to_stereo_and_apply_DRC',
Stage: 'Pre-processing',
Name: 'Downmix & Dynamic range compression',
Type: 'Audio',
Operation: 'Transcode',
Description: 'Downmixes surround to AAC stereo AND applies dynamic range compression.'
+ 'Files already in stereo or with multiple audio tracks will be skipped \n\n',
Version: '1.00',
Tags: 'ffmpeg',
Inputs: [],
});
// eslint-disable-next-line no-unused-vars
const plugin = (file, librarySettings, inputs, otherArguments) => {
// eslint-disable-next-line no-unused-vars,no-param-reassign
inputs = loadDefaultValues(inputs, details);
const response = {
processFile: false,
preset: '',
handBrakeMode: false,
FFmpegMode: true,
reQueueAfter: true,
infoLog: '',
file,
removeFromDB: false,
updateDB: false,
container: `.${file.container}`,
};
let audioStreams = 0;
let surroundTrackFound = false;
for (let index = 0; index < file.ffProbeData.streams.length; index += 1) {
const stream = file.ffProbeData.streams[index];
if (stream.codec_type === 'audio') {
audioStreams += 1;
}
if (stream.codec_type === 'audio' && stream.channels && stream.channels > 3) {
surroundTrackFound = true;
}
}
if (audioStreams > 1) {
response.infoLog = 'File has more than 1 audio track - not processing';
return response;
}
if (!surroundTrackFound) {
response.infoLog = 'File has no surround tracks - not processing';
return response;
}
if (surroundTrackFound && audioStreams === 1) {
response.preset = '-sn <io> -vcodec copy -scodec copy -acodec aac -filter:a '
+ '"dynaudnorm,pan=stereo|FL < 1.0*FL + 0.707*FC + 0.707*BL|FR < 1.0*FR + 0.707*FC + 0.707*BR"';
response.processFile = true;
response.infoLog = 'File matches requirements for processing. Downmixing and applying DRC!';
return response;
}
return response;
};
module.exports.details = details;
module.exports.plugin = plugin;
Loading…
Cancel
Save