You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.7 KiB
54 lines
1.7 KiB
const lib = require('../methods/lib')();
|
|
|
|
const details = () => ({
|
|
id: 'Tdarr_Plugin_x7ac_Remove_Closed_Captions',
|
|
Stage: 'Pre-processing',
|
|
Name: 'Remove burned closed captions',
|
|
Type: 'Video',
|
|
Operation: 'Transcode',
|
|
Description:
|
|
'[Contains built-in filter] If detected, closed captions (XDS,608,708) will be removed from streams.',
|
|
Version: '1.01',
|
|
Tags: 'pre-processing,ffmpeg,subtitle only',
|
|
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 = lib.loadDefaultValues(inputs, details);
|
|
const response = {
|
|
processFile: false,
|
|
// eslint-disable-next-line no-useless-escape
|
|
preset: ',-map 0 -codec copy -bsf:v \"filter_units=remove_types=6\"',
|
|
container: `.${file.container}`,
|
|
handBrakeMode: false,
|
|
FFmpegMode: true,
|
|
reQueueAfter: true,
|
|
infoLog: '',
|
|
};
|
|
if (file.fileMedium !== 'video') {
|
|
response.infoLog += '☒File is not video \n';
|
|
return response;
|
|
}
|
|
// Check if Closed Captions are set at file level
|
|
if (file.hasClosedCaptions) {
|
|
response.processFile = true;
|
|
response.infoLog += '☒This file has closed captions \n';
|
|
return response;
|
|
}
|
|
// If not, check for Closed Captions in the streams
|
|
const { streams } = file.ffProbeData;
|
|
streams.forEach((stream) => {
|
|
if (stream.closed_captions) {
|
|
response.processFile = true;
|
|
}
|
|
});
|
|
|
|
response.infoLog += response.processFile ? '☒This file has burnt closed captions \n'
|
|
: '☑Closed captions have not been detected on this file \n';
|
|
return response;
|
|
};
|
|
module.exports.details = details;
|
|
module.exports.plugin = plugin;
|