Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* eslint-disable */
- function details() {
- return {
- id: "Tdarr_Plugin_WS_Remove_Closed_Captions",
- Stage: "Pre-processing",
- Name: "Remove burned closed captions",
- Type: "Video",
- Operation: "Remux",
- Description:
- "[Contains built-in filter] If detected, closed captions (XDS,608,708) will be removed. Derived from x7ac Closed Captions plugin.",
- Version: "1.00",
- Link:
- "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/",
- Tags: "pre-processing,ffmpeg,subtitle only",
- };
- }
- function plugin(file) {
- //Must return this object
- var response = {
- processFile: false,
- preset: "",
- container: ".mp4",
- handBrakeMode: false,
- FFmpegMode: false,
- reQueueAfter: true,
- infoLog: "",
- };
- if (file.fileMedium !== "video") {
- console.log("File is not video");
- response.infoLog += "☒File is not video \n";
- response.processFile = false;
- return response;
- }
- //Check if there Closed Captions are set at file level
- if (file.hasClosedCaptions === true) {
- response = {
- processFile: true,
- preset: ',-map 0 -codec copy -bsf:v "filter_units=remove_types=6"',
- container: "." + file.container,
- handBrakeMode: false,
- FFmpegMode: true,
- reQueueAfter: true,
- infoLog: "☒This file has closed captions \n",
- };
- return response;
- }
- // Now go through each stream in the file
- for (var i = 0; i < file.ffProbeData.streams.length; i++) {
- var stream = file.ffProbeData.streams[i]
- //Check if there are burned Closed Captions
- if (stream.closed_captions === 1) {
- response = {
- processFile: true,
- preset: ',-map 0 -codec copy -bsf:v "filter_units=remove_types=6"',
- container: "." + file.container,
- handBrakeMode: false,
- FFmpegMode: true,
- reQueueAfter: true,
- infoLog: "☒This file has burned closed captions \n",
- };
- return response;
- }
- }
- //Nothing detected
- response.infoLog += "☑Closed captions have not been detected on this file \n";
- response.processFile = false;
- return response;
- }
- module.exports.details = details;
- module.exports.plugin = plugin;
Add Comment
Please, Sign In to add comment