From fc343a8c97e886ebd89dab1067375ae768949711 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Fri, 7 Feb 2020 01:07:32 +0000 Subject: [PATCH 01/51] Example update --- Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 2 +- Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js | 4 ++-- Tdarr_Plugin_aaaa_Pre_Proc_Example.js | 4 ++-- Tdarr_Plugin_zzzz_Post_Proc_Example.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index c4ba044..6211ad1 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -13,7 +13,7 @@ function details() { Inputs: [ { name: 'install_packages', - tooltip: `Please change this to "yes", it allows the plugin to install the required nodemodule. (iso-639-2)` + tooltip: `Please change this to "yes", it allows the plugin to install the required nodemodule. (iso-639-2) \nExample:\n yes` }, ] } diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js index 2c80b8c..094fd8b 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js @@ -13,11 +13,11 @@ function details() { Inputs: [ { name: 'languages', - tooltip: `Desired Languages you would like to keep, language format has to be according to the iso-639-2 standard: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes\nIt could look like: "eng","dut"` + tooltip: `Desired Languages you would like to keep, language format has to be according to the iso-639-2 standard: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes\nExample:\n eng,dut` }, { name: 'special', - tooltip: `This is if you want a specific language to be logged to a file in your Tdarr documents folder.\nIt will add the name of the file that is being processed if this language(s) has been found.\nThe file is created the first time it finds a file with the language.\nIt could look like: "eng","dut"\nThe languages don't have to be in "languages".` + tooltip: `This is if you want a specific language to be logged to a file in your Tdarr documents folder.\nIt will add the name of the file that is being processed if this language(s) has been found.\nThe file is created the first time it finds a file with the language. \nThe languages don't have to be in "languages". \nExample:\n eng,dut ` } ] } diff --git a/Tdarr_Plugin_aaaa_Pre_Proc_Example.js b/Tdarr_Plugin_aaaa_Pre_Proc_Example.js index c14b336..e9d7b78 100644 --- a/Tdarr_Plugin_aaaa_Pre_Proc_Example.js +++ b/Tdarr_Plugin_aaaa_Pre_Proc_Example.js @@ -16,11 +16,11 @@ module.exports.details = function details() { Inputs: [ //(Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI { name: 'language', - tooltip: `Enter one language tag here for the language of the subtitles you'd like to keep. For example: eng` + tooltip: `Enter one language tag here for the language of the subtitles you'd like to keep. \nExample:\n eng \nExample:\n fr \nExample:\n de` //Each line following `Example:` will be clearly formatted }, { name: 'channels', - tooltip: `Desired audio channel number. For example: 2` + tooltip: `Desired audio channel number. \nExample:\n 2` }, ] diff --git a/Tdarr_Plugin_zzzz_Post_Proc_Example.js b/Tdarr_Plugin_zzzz_Post_Proc_Example.js index 3461cd6..cdcd8aa 100644 --- a/Tdarr_Plugin_zzzz_Post_Proc_Example.js +++ b/Tdarr_Plugin_zzzz_Post_Proc_Example.js @@ -16,11 +16,11 @@ module.exports.details = function details() { Inputs: [ //(Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI { name: 'language', - tooltip: `Enter one language tag here for the language of the subtitles you'd like to keep. For example: eng` + tooltip: `Enter one language tag here for the language of the subtitles you'd like to keep. \nExample:\n eng \nExample:\n fr \nExample:\n de` //Each line following `Example:` will be clearly formatted }, { name: 'channels', - tooltip: `Desired audio channel number. For example: 2` + tooltip: `Desired audio channel number. \nExample:\n 2` }, ] From 270f35004b1cf7da16020a7687eeec1288581199 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Fri, 7 Feb 2020 19:35:53 +0000 Subject: [PATCH 02/51] Example update --- Tdarr_Plugin_aaaa_Pre_Proc_Example.js | 18 ++++++++++++++++-- Tdarr_Plugin_zzzz_Post_Proc_Example.js | 16 ++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Tdarr_Plugin_aaaa_Pre_Proc_Example.js b/Tdarr_Plugin_aaaa_Pre_Proc_Example.js index e9d7b78..e0eed10 100644 --- a/Tdarr_Plugin_aaaa_Pre_Proc_Example.js +++ b/Tdarr_Plugin_aaaa_Pre_Proc_Example.js @@ -16,11 +16,25 @@ module.exports.details = function details() { Inputs: [ //(Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI { name: 'language', - tooltip: `Enter one language tag here for the language of the subtitles you'd like to keep. \nExample:\n eng \nExample:\n fr \nExample:\n de` //Each line following `Example:` will be clearly formatted + tooltip: `Enter one language tag here for the language of the subtitles you'd like to keep. + + \\nExample:\\n + eng + + \\nExample:\\n + + fr + + \\nExample:\\n + + de` //Each line following `Example:` will be clearly formatted. \\n used for line breaks }, { name: 'channels', - tooltip: `Desired audio channel number. \nExample:\n 2` + tooltip: `Desired audio channel number. + + \\nExample:\\n + 2` }, ] diff --git a/Tdarr_Plugin_zzzz_Post_Proc_Example.js b/Tdarr_Plugin_zzzz_Post_Proc_Example.js index cdcd8aa..37627b9 100644 --- a/Tdarr_Plugin_zzzz_Post_Proc_Example.js +++ b/Tdarr_Plugin_zzzz_Post_Proc_Example.js @@ -16,11 +16,23 @@ module.exports.details = function details() { Inputs: [ //(Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI { name: 'language', - tooltip: `Enter one language tag here for the language of the subtitles you'd like to keep. \nExample:\n eng \nExample:\n fr \nExample:\n de` //Each line following `Example:` will be clearly formatted + tooltip: `Enter one language tag here for the language of the subtitles you'd like to keep. + + \\nExample:\\n + eng + + \\nExample:\\n + fr + + \\nExample:\\n + de` //Each line following `Example:` will be clearly formatted. \\n used for line breaks }, { name: 'channels', - tooltip: `Desired audio channel number. \nExample:\n 2` + tooltip: `Desired audio channel number. + + \\nExample:\\n + 2` }, ] From 1620b32fc2009d98dd1961182564a58f70e77fb7 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Fri, 7 Feb 2020 22:01:19 +0000 Subject: [PATCH 03/51] New --- ...darr_Plugin_075a_Transcode_Customisable.js | 195 ++++++++++++++++++ ...darr_Plugin_076a_re_order_audio_streams.js | 154 ++++++++++++++ ...r_Plugin_076b_re_order_subtitle_streams.js | 156 ++++++++++++++ ...Plugin_z18s_rename_files_based_on_codec.js | 63 ++++++ 4 files changed, 568 insertions(+) create mode 100644 Community/Tdarr_Plugin_075a_Transcode_Customisable.js create mode 100644 Community/Tdarr_Plugin_076a_re_order_audio_streams.js create mode 100644 Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js create mode 100644 Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js diff --git a/Community/Tdarr_Plugin_075a_Transcode_Customisable.js b/Community/Tdarr_Plugin_075a_Transcode_Customisable.js new file mode 100644 index 0000000..581dc64 --- /dev/null +++ b/Community/Tdarr_Plugin_075a_Transcode_Customisable.js @@ -0,0 +1,195 @@ + + + +module.exports.details = function details() { + + return { + id: "Tdarr_Plugin_075a_Transcode_Customisable", + Stage: "Pre-processing", + Name: "Transcode Customisable", + Type: "", + Operation: "Transcode", + Description: `[TESTING][Contains built-in filter] Specify codec filter and transcode arguments for HandBrake or FFmpeg \n\n`, + Version: "1.00", + Link: "", + Inputs: [ + { + name: 'codecs_to_exclude', + tooltip: `Input codecs, separated by a comma, that should be excluded when processing. + + \\nFor example, if you're transcoding into hevc (h265), then add a filter to prevent hevc being transcoded so your newly transcoded files won't be infinitely looped/processed. \\n + + \\nExample:\\n + + hevc + + \\nYou can also enter multiple codecs: + + \\nExample:\\n + + mp3,aac,dts + + \\nExample:\\n + + h264,vp9 + + ` + }, + { + name: 'cli', + tooltip: `Enter the CLI to use. + + \\nExample:\\n + handbrake + + \\nExample:\\n + ffmpeg + + ` + }, + { + name: 'transcode_arguments', + tooltip: `\\nEnter HandBrake or FFmpeg transcode arguments. + + \\nHandBrake examples: + + \\nExample:\\n + -e x264 -q 20 -B + + \\nExample:\\n + -Z "Very Fast 1080p30" + + \\nExample:\\n + -Z "Fast 1080p30" -e nvenc_h265 + + \\nExample:\\n + -Z "Very Fast 1080p30" --all-subtitles --all-audio + + \\nExample:\\n + -Z "Very Fast 480p30" + + \\nExample:\\n + --preset-import-file "C:\Users\HaveAGitGat\Desktop\testpreset.json" -Z "My Preset" + + \\nYou can learn more about HandBrake presets here: + + \\nhttps://handbrake.fr/docs/en/latest/technical/official-presets.html + + + \\nWhen using FFmpeg, you need to separate the input and output parameters with a comma. FFmpeg Examples: + + \\nExample:\\n +-r 1,-r 24 + +\\nExample:\\n +,-sn -c:v copy -c:a copy + +\\nExample:\\n +,-c:v lib265 -crf 23 -ac 6 -c:a aac -preset veryfast + +\\nExample:\\n +,-map 0 -c copy -c:v libx265 -c:a aac + +\\nExample:\\n +-c:v h264_cuvid,-c:v hevc_nvenc -preset slow -c:a copy + +\\nPlease see the following for help with creating FFmpeg commands: + +\\nhttps://opensource.com/article/17/6/ffmpeg-convert-media-file-formats + + + + + ` + }, + { + name: 'output_container', + tooltip: ` + \\nEnter the output container of the new file + + \\nExample:\\n + .mp4 + + \\nExample:\\n + .mp3 + + \\nExample:\\n + .mkv + + ` + }, + ] + } + +} + +module.exports.plugin = function plugin(file, librarySettings, inputs) { + + + + //Must return this object + + var response = { + + processFile: false, + preset: '', + container: '.mp4', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: '', + + } + + if (inputs.codecs_to_exclude === undefined + || inputs.cli === undefined + || inputs.transcode_arguments === undefined + || inputs.output_container === undefined) { + + response.processFile = false + response.infoLog += "☒ Inputs not entered! \n" + return response + + + } + + + if (inputs.codecs_to_exclude.includes(file.ffProbeData.streams[0].codec_name)) { + response.processFile = false + response.infoLog += `☑File is already in ${file.ffProbeData.streams[0].codec_name}! \n` + return response + } + + + + + //transcode settings + + if (inputs.cli == `handbrake`) { + response.handBrakeMode = true + response.FFmpegMode = false + } else if (inputs.cli == `ffmpeg`) { + response.handBrakeMode = false + response.FFmpegMode = true + + } else { + response.processFile = false + response.infoLog += "☒ CLI not input correctly! \n" + return response + + } + + + + response.processFile = true; + response.preset = inputs.transcode_arguments + response.container = inputs.output_container + + response.reQueueAfter = true; + response.infoLog += `☒File is not in desired codec! \n` + return response + + + +} + diff --git a/Community/Tdarr_Plugin_076a_re_order_audio_streams.js b/Community/Tdarr_Plugin_076a_re_order_audio_streams.js new file mode 100644 index 0000000..e1fdf39 --- /dev/null +++ b/Community/Tdarr_Plugin_076a_re_order_audio_streams.js @@ -0,0 +1,154 @@ + + + +module.exports.details = function details() { + + return { + id: "Tdarr_Plugin_076a_re_order_audio_streams", + Stage: "Pre-processing", + Name: "Re-order audio streams", + Type: "", + Operation: "Transcode", + Description: `[TESTING][Contains built-in filter] Specify a language tag for Tdarr to try and put as 1st audio track \n\n`, + Version: "1.00", + Link: "", + Inputs: [ + { + name: 'preferred_language', + tooltip: `Specify one language tag for Tdarr to try and put as 1st audio track + + \\nExample:\\n + + eng + + \\nExample:\\n + + en + + \\nExample:\\n + + fr + + \\nExample:\\n + + de + + ` + } + ] + } + +} + +module.exports.plugin = function plugin(file, librarySettings, inputs) { + + + + //Must return this object + + var response = { + + processFile: false, + preset: '', + container: '.mp4', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: '', + + } + + + console.log(inputs.preferred_language) + + if (inputs.preferred_language === undefined) { + + response.processFile = false + response.infoLog += "☒ Inputs not entered! \n" + return response + + + } + + + var desiredTrackPosition = file.ffProbeData.streams.filter(stream => stream.codec_type.toLowerCase() == "video").length + + var audioInLang = file.ffProbeData.streams.filter(stream => { + + + if (stream.codec_type.toLowerCase() == "audio" + && stream.tags && stream.tags.language && inputs.preferred_language.includes(stream.tags.language.toLowerCase())) { + return true + } + + return false + + }) + + + if (audioInLang.length == 0) { + + response.processFile = false + response.infoLog += "☒ No audio tracks in desired language! \n" + return response + + } + + + var streamToMove = audioInLang[0] + + if (streamToMove.index == desiredTrackPosition) { + + response.processFile = false + response.infoLog += "☑ Preferred language is already first audio track! \n" + return response + + } + + + var ffmpegCommand = ', -c copy' + + if (file.ffProbeData.streams[0].codec_type.toLowerCase() == "video") { + ffmpegCommand += ` -map 0:v ` + } + + var allAudioTracks = file.ffProbeData.streams.filter(stream => stream.codec_type.toLowerCase() == "audio") + + + var streamIdx + + for (var i = 0; i < allAudioTracks.length; i++) { + + if (allAudioTracks[i].index == streamToMove.index) { + streamIdx = i + break + + } + } + + ffmpegCommand += ` -map 0:a:${streamIdx} -disposition:a:${streamIdx} default` + + for (var i = 0; i < allAudioTracks.length; i++) { + + if (i !== streamIdx) { + ffmpegCommand += ` -map 0:a:${i} -disposition:a:${i} none ` + } + } + + ffmpegCommand += ` -map 0:s? -map 0:d? ` + + + + response.processFile = true + response.preset = ffmpegCommand + response.container = `.` + file.container + response.handBrakeMode = false + response.FFmpegMode = true + response.reQueueAfter = true; + response.infoLog += `☒ Desired audio lang is not first audio stream, moving! \n` + return response + + + +} + diff --git a/Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js b/Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js new file mode 100644 index 0000000..91904e6 --- /dev/null +++ b/Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js @@ -0,0 +1,156 @@ + + + +module.exports.details = function details() { + + return { + id: "Tdarr_Plugin_076b_re_order_subtitle_streams", + Stage: "Pre-processing", + Name: "Re-order subtitle streams", + Type: "", + Operation: "Transcode", + Description: `[TESTING][Contains built-in filter] Specify a language tag for Tdarr to try and put as 1st subtitle track \n\n`, + Version: "1.00", + Link: "", + Inputs: [ + { + name: 'preferred_language', + tooltip: `Specify one language tag for Tdarr to try and put as 1st subtitle track + + \\nExample:\\n + + eng + + \\nExample:\\n + + en + + \\nExample:\\n + + fr + + \\nExample:\\n + + de + + ` + } + ] + } + +} + +module.exports.plugin = function plugin(file, librarySettings, inputs) { + + + + //Must return this object + + var response = { + + processFile: false, + preset: '', + container: '.mp4', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: '', + + } + + + console.log(inputs.preferred_language) + + if (inputs.preferred_language === undefined) { + + response.processFile = false + response.infoLog += "☒ Inputs not entered! \n" + return response + + + } + + + var desiredTrackPosition = file.ffProbeData.streams.filter(stream => stream.codec_type.toLowerCase() == "video" || stream.codec_type.toLowerCase() == "audio").length + + + + var subtitleInLang = file.ffProbeData.streams.filter(stream => { + + + if (stream.codec_type.toLowerCase() == "subtitle" + && stream.tags && stream.tags.language && inputs.preferred_language.includes(stream.tags.language.toLowerCase())) { + return true + } + + return false + + }) + + + if (subtitleInLang.length == 0) { + + response.processFile = false + response.infoLog += "☒ No subtitle tracks in desired language! \n" + return response + + } + + + var streamToMove = subtitleInLang[0] + + if (streamToMove.index == desiredTrackPosition) { + + response.processFile = false + response.infoLog += "☑ Preferred language is already first subtitle track! \n" + return response + + } + + + var ffmpegCommand = ', -c copy ' + + if (file.ffProbeData.streams[0].codec_type.toLowerCase() == "video") { + ffmpegCommand += ` -map 0:v -map 0:a ` + } + + var allSubtitleTracks = file.ffProbeData.streams.filter(stream => stream.codec_type.toLowerCase() == "subtitle") + + + var streamIdx + + for (var i = 0; i < allSubtitleTracks.length; i++) { + + if (allSubtitleTracks[i].index == streamToMove.index) { + streamIdx = i + break + + } + } + + ffmpegCommand += ` -map 0:s:${streamIdx} -disposition:s:${streamIdx} default` + + for (var i = 0; i < allSubtitleTracks.length; i++) { + + if (i !== streamIdx) { + ffmpegCommand += ` -map 0:s:${i} -disposition:a:${i} none ` + } + } + + ffmpegCommand += ` -map 0:d? ` + + + + response.processFile = true + response.preset = ffmpegCommand + response.container = `.` + file.container + response.handBrakeMode = false + response.FFmpegMode = true + response.reQueueAfter = true; + response.infoLog += `☒ Desired subtitle lang is not first subtitle stream, moving! \n` + return response + + + +} + diff --git a/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js b/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js new file mode 100644 index 0000000..43ad46d --- /dev/null +++ b/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js @@ -0,0 +1,63 @@ + + + +module.exports.details = function details() { + + return { + id: "Tdarr_Plugin_z18s_rename_files_based_on_codec", + Stage: "Post-processing", + Name: "Rename based on codec", + Type: "Video", + Operation: "", + Description: `[TESTING][Contains built-in filter]This plugin renames 264 files to 265 or vice versa depending on codec. \n\n`, + Version: "1.00", + Link: "", + + } + +} + +module.exports.plugin = function plugin(file, librarySettings, inputs) { + + try { + + var fsextra = require('fs-extra') + + var fileNameOld = file._id + + if (file.ffProbeData.streams[0].codec_name == 'hevc' && file._id.includes('264')) { + file._id = file._id.replace("264", "265"); + file.file = file.file.replace("264", "265"); + } + + + + if (file.ffProbeData.streams[0].codec_name == 'h264' && file._id.includes('265')) { + file._id = file._id.replace("265", "264"); + file.file = file.file.replace("265", "264"); + } + + if (file.ffProbeData.streams[0].codec_name == 'h264' && file._id.includes('hevc')) { + file._id = file._id.replace("hevc", "264"); + file.file = file.file.replace("hevc", "264"); + } + + if (fileNameOld != file._id) { + + fsextra.moveSync(fileNameOld, file._id, { + overwrite: true + }) + + var response = { + file, + removeFromDB: false, + updateDB: true, + } + + return response + + + } + + } catch (err) { console.log(err) } +} From 7b84114d83e656cc214eaa0a0e3b5c456a054829 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Fri, 7 Feb 2020 22:15:09 +0000 Subject: [PATCH 04/51] Migz Plugin Additions 1) Transcode plugin using nvidia GPU. 2) Plugin to clean title metadata from video if detected. This only cleans the title, the current plugin cleans all metadata if title is detected. 3) Plugin to clean audio, remove unwanted languages & tag unknown language tracks. 4) Plugin to clean subtitles, remove unwanted languages & tag unknown language tracks. 5) Plugin to convert stereo tracks to AAC and/or create downmix audio tracks. 6) Organise streams into order. --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 125 +++++++++++++ .../Tdarr_Plugin_MC93_Migz2CleanTitle.js | 65 +++++++ .../Tdarr_Plugin_MC93_Migz3CleanAudio.js | 170 ++++++++++++++++++ Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js | 125 +++++++++++++ .../Tdarr_Plugin_MC93_Migz5ConvertAudio.js | 119 ++++++++++++ .../Tdarr_Plugin_MC93_Migz6OrderStreams.js | 136 ++++++++++++++ 6 files changed, 740 insertions(+) create mode 100644 Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js create mode 100644 Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js create mode 100644 Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js create mode 100644 Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js create mode 100644 Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js create mode 100644 Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js new file mode 100644 index 0000000..e42c1fe --- /dev/null +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -0,0 +1,125 @@ +function details() { + return { + id: "Tdarr_Plugin_MC93_Migz1FFMPEG", + Stage: "Pre-processing", + Name: "Migz-Transcode Using Nvidia GPU & FFMPEG", + Type: "Video", + Operation:"Transcode", + Description: `[TESTING]Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on current file size. NVDEC & NVENC compatable GPU required. \n\n`, + Version: "2.00", + Link: "", + Inputs: [ + { + name: 'container', + tooltip: `Specify output container of file, ensure that all stream types you may have are supported by your chosen container. mkv is recommended. + \\nExample:\\n + mkv + + \\nExample:\\n + mp4` + + + }, + ] + } +} + +function plugin(file, librarySettings, inputs) { + var response = { + processFile: false, + preset: '', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: '' + } + + var bitrateSettings = "" + + if (inputs.container == "") { + response.infoLog += "☒Container has not been configured within plugin settings, please configure required options. Skipping this plugin. \n" + response.processFile = false + return response + } else { + response.container = '.' + inputs.container + } + + if (file.fileMedium !== "video") { + response.processFile = false + response.infoLog += "☒File is not a video. \n" + return response + } + + response.infoLog += `Container for video selected as ${inputs.container}. \n` + + if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container == inputs.container) { + response.processFile = false + response.infoLog += `☑File is already in ${inputs.container} & hevc. \n` + return response + } + + if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container != '${inputs.container}') { + response.infoLog += `☒File is hevc but is not in ${inputs.container} container. Remuxing. \n` + response.preset = ', -map 0 -c copy' + response.processFile = true; + return response + } + +//codec will be checked so it can be transcoded correctly + if (file.video_codec_name == 'h263') { + response.preset = `-c:v h263_cuvid` + } + else if (file.video_codec_name == 'h264') { + if (file.ffProbeData.streams[0].profile != 'High 10') { //if a h264 coded video is not HDR + response.preset = `-c:v h264_cuvid` + } + } + else if (file.video_codec_name == 'mjpeg') { + response.preset = `c:v mjpeg_cuvid` + } + else if (file.video_codec_name == 'mpeg1') { + response.preset = `-c:v mpeg1_cuvid` + } + else if (file.video_codec_name == 'mpeg2') { + response.preset = `-c:v mpeg2_cuvid` + } + else if (file.video_codec_name == 'vc1') { + response.preset = `-c:v vc1_cuvid` + } + else if (file.video_codec_name == 'vp8') { + response.preset = `-c:v vp8_cuvid` + } + else if (file.video_codec_name == 'vp9') { + response.preset = `-c:v vp9_cuvid` + } + + if (file.file_size >= "30000") { + bitrateSettings = "-b:v 30M -minrate 20M" + } else if (file.file_size < "30000" && file.file_size >= "25000") { + bitrateSettings = "-b:v 15M -minrate 10M -maxrate 20M" + } else if (file.file_size < "25000" && file.file_size >= "20000") { + bitrateSettings = "-b:v 12M -minrate 8M -maxrate 16M" + } else if (file.file_size < "20000" && file.file_size >= "15000") { + bitrateSettings = "-b:v 10M -minrate 7M -maxrate 13M" + } else if (file.file_size < "15000" && file.file_size >= "10000") { + bitrateSettings = "-b:v 8M -minrate 6M -maxrate 10M" + } else if (file.file_size < "10000" && file.file_size >= "8000") { + bitrateSettings = "-b:v 5M -minrate 3M -maxrate 8M" + } else if (file.file_size < "8000" && file.file_size >= "6000") { + bitrateSettings = "-b:v 4M -minrate 2M -maxrate 6M" + } else if (file.file_size < "6000" && file.file_size >= "2000") { + bitrateSettings = "-b:v 3M -minrate 1M -maxrate 5M" + } else if (file.file_size < "2000" && file.file_size >= "500") { + bitrateSettings = "-b:v 1M -minrate 500k -maxrate 2M" + } else if (file.file_size < "500" ) { + bitrateSettings = "-b:v 250K -minrate 100k -maxrate 500k" + } + + response.preset += `,-map 0 -c:v hevc_nvenc -rc:v vbr_hq ${bitrateSettings} -bufsize 2M -spatial_aq:v 1 -c:a copy -c:s copy -max_muxing_queue_size 4096` + response.processFile = true + response.infoLog += `☒File is not hevc. Transcoding. \n` + return response +} + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js new file mode 100644 index 0000000..ef3a9b3 --- /dev/null +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -0,0 +1,65 @@ +function details() { + return { + id: "Tdarr_Plugin_MC93_Migz2CleanTitle", + Stage: "Pre-processing", + Name: "Migz-Clean title metadata", + Type: "Video", + Operation: "Clean", + Description: `[TESTING]This plugin removes video title metadata if it exists. \n\n`, + Version: "1.00", + Link: "" + } +} + +function plugin(file) { + var response = { + + processFile : false, + preset : '', + container: '.' + file.container, + handBrakeMode : false, + FFmpegMode : true, + reQueueAfter : false, + infoLog : '', + + } + + var ffmpegCommandInsert = '' + var videoIdx = 0 + var convert = false + + if (file.fileMedium !== "video") { + console.log("File is not video") + response.infoLog += "☒File is not video \n" + response.processFile = false; + return response + } + + if(file.meta.Title != undefined ){ + ffmpegCommandInsert += ` -metadata title="" ` + convert = true + } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") { + if (file.ffProbeData.streams[i].tags.title != undefined) { + ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" ` + convert = true + } + videoIdx++ + } + } + + if(convert == true){ + response.infoLog += "☒File has title metadata \n" + response.preset = `,${ffmpegCommandInsert} -c copy` + response.reQueueAfter = true; + response.processFile = true; + }else{ + response.infoLog += "☑File has no title metadata \n" + } + return response +} + +module.exports.details = details; +module.exports.plugin = plugin; \ No newline at end of file diff --git a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js new file mode 100644 index 0000000..cee7df5 --- /dev/null +++ b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js @@ -0,0 +1,170 @@ +function details() { + return { + id: "Tdarr_Plugin_MC93_Migz3CleanAudio", + Stage: "Pre-processing", + Name: "Migz-Clean audio streams.", + Type: "Audio", + Operation: "Clean", + Description: `[TESTING]This plugin removes audio tracks which are not wanted & tags those that have an unknown language. \n\n`, + Version: "2.00", + Link: "", + Inputs: [ + { + name: 'language', + tooltip: `Specify language tag/s here for the audio tracks you'd like to keep, recommended to keep "und" as this stands for undertermined, some files may not have the language specified. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes + \\nExample:\\n + eng + + \\nExample:\\n + eng,und + + \\nExample:\\n + eng,und,jap` + }, + { + name: 'commentary', + tooltip: `Specify if audio tracks that contain commentary/description should be removed. + \\nExample:\\n + true + + \\nExample:\\n + false` + }, + { + name: 'tag_language', + tooltip: `Specify a single language for audio tracks with no language or unknown language to be tagged with, leave empty to disable, you must have "und" in your list of languages to keep for this to function. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes + \\nExample:\\n + eng + + \\nExample:\\n + ` + }, + { + name: 'tag_title', + tooltip: `Specify audio tracks with no title to be tagged with the number of channels they contain. Do NOT use this with mp4, as mp4 does not support title tags. + \\nExample:\\n + true + + \\nExample:\\n + false` + }, + ] + } +} + +function plugin(file, librarySettings, inputs) { + var response = { + processFile: false, + preset: '', + container: '.' + file.container, + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: false, + infoLog: '', + } + + if (file.fileMedium !== "video") { + console.log("File is not video") + response.infoLog += "☒File is not video \n" + response.processFile = false; + return response + } + + if (inputs.language == "") { + response.infoLog += "☒Language/s keep have not been configured within plugin settings, please configure required options. Skipping this plugin. \n" + response.processFile = false; + return response + } + + var language = inputs.language.split(",") + var ffmpegCommandInsert = '' + var convert = false + var audioIdx = -1 + var audioStreamsRemoved = 0 + var audioStreamCount = file.ffProbeData.streams.filter(row => (row.codec_type.toLowerCase() == "audio")).length; + + console.log("audioStreamCount:" + audioStreamCount) + response.infoLog += `Languages to keep are ${language} \n` + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { + audioIdx++ + } + } catch (err) { } + + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && language.indexOf(file.ffProbeData.streams[i].tags.language.toLowerCase()) === -1) { + audioStreamsRemoved++ + ffmpegCommandInsert += `-map -0:a:${audioIdx} ` + response.infoLog += `☒Audio stream detected as being an unwanted language, removing. Audio stream 0:a:${audioIdx} - ${file.ffProbeData.streams[i].tags.language.toLowerCase()} \n` + convert = true + } + } catch (err) { } + + try { + if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description'))) { + audioStreamsRemoved++ + ffmpegCommandInsert += `-map -0:a:${audioIdx} ` + response.infoLog += `☒Audio stream detected as being Commentary or Description, removing. Audio stream 0:a:${audioIdx} - ${file.ffProbeData.streams[i].tags.title}. \n` + convert = true + } + } catch (err) { } + + try { + if (inputs.tag_language != "") { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].tags.language.toLowerCase().includes('und') && language.indexOf('und') !== -1) { + ffmpegCommandInsert += `-metadata:s:a:${audioIdx} language=${inputs.tag_language} ` + response.infoLog += `☒Audio stream detected as having unknown language tagged, tagging as ${inputs.tag_language}. \n` + convert = true + } + + if (typeof file.ffProbeData.streams[i].tags.language === 'undefined' && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { + ffmpegCommandInsert += `-metadata:s:a:${audioIdx} language=${inputs.tag_language} ` + response.infoLog += `☒Audio stream detected as having no language tagged, tagging as ${inputs.tag_language}. \n` + convert = true + } + } + } catch (err) { } + + try { + if (typeof file.ffProbeData.streams[i].tags.title == 'undefined' && inputs.tag_title.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { + if (file.ffProbeData.streams[i].channels == "8") { + ffmpegCommandInsert += `-metadata:s:a:${audioIdx} title="7.1" ` + response.infoLog += `☒Audio stream detected as 8 channel audio track with no title, tagging title. Audio stream 0:a:${audioIdx} tagged as "7.1" \n` + convert = true + } + if (file.ffProbeData.streams[i].channels == "6") { + ffmpegCommandInsert += `-metadata:s:a:${audioIdx} title="5.1" ` + response.infoLog += `☒Audio stream detected as 6 channel audio track with no title, tagging title. Audio stream 0:a:${audioIdx} tagged as "5.1" \n` + convert = true + } + if (file.ffProbeData.streams[i].channels == "2") { + ffmpegCommandInsert += `-metadata:s:a:${audioIdx} title="2.0" ` + response.infoLog += `☒Audio stream detected as 2 channel audio track with no title, tagging title. Audio stream 0:a:${audioIdx} tagged as "2.0" \n` + convert = true + } + } + } catch (err) { } + + } + + if (audioStreamsRemoved == audioStreamCount) { + response.infoLog += "☒Cancelling plugin otherwise all audio tracks would be removed. \n" + response.processFile = false + return response + } + + if (convert === true && (audioStreamsRemoved != audioStreamCount)) { + response.processFile = true + response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy` + response.container = '.' + file.container + response.reQueueAfter = true + } else { + response.processFile = false + response.infoLog += "☑File doesn't contain audio tracks which are unwanted or that require tagging.\n" + } + return response +} +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js new file mode 100644 index 0000000..1180d78 --- /dev/null +++ b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js @@ -0,0 +1,125 @@ +function details() { + return { + id: "Tdarr_Plugin_MC93_Migz4CleanSubs", + Stage: "Pre-processing", + Name: "Migz-Clean subtitle streams.", + Type: "subtitless", + Operation: "Clean", + Description: `[TESTING]This plugin removes subtitle tracks which are not wanted & tags subtitles that have an unknown language. \n\n`, + Version: "2.00", + Link: "", + Inputs: [ + { + name: 'language', + tooltip: `Specify language tag/s here for the subtitle tracks you'd like to keep. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes + \\nExample:\\n + eng + + \\nExample:\\n + eng,jap` + }, + { + name: 'commentary', + tooltip: `Specify if subtitle tracks that contain commentary/description should be removed. + \\nExample:\\n + true + + \\nExample:\\n + false` + }, + { + name: 'tag_title', + tooltip: `Specify a single language for subtitle tracks with no language or unknown language to be tagged with, leave empty to disable. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes + \\nExample:\\n + eng + + \\nExample:\\n + por` + }, + ] + } +} + +function plugin(file, librarySettings, inputs) { + var response = { + processFile: false, + preset: '', + container: '.' + file.container, + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: false, + infoLog: '', + } + + if (file.fileMedium !== "video") { + console.log("File is not video") + response.infoLog += "☒File is not video \n" + response.processFile = false; + return response + } + + if (inputs.language == "") { + response.infoLog += "☒Language/s keep have not been configured within plugin settings, please configure required options. Skipping this plugin. \n" + response.processFile = false; + return response + } + + var language = inputs.language.split(",") + var ffmpegCommandInsert = '' + var subtitleIdx = -1 + var convert = false + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") { + subtitleIdx++ + } + } catch (err) { } + + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && language.indexOf(file.ffProbeData.streams[i].tags.language.toLowerCase()) === -1) { + ffmpegCommandInsert += `-map -0:s:${subtitleIdx} ` + response.infoLog += `☒Subtitle stream detected as being an unwanted language, removing. Subtitle stream 0:s:${subtitleIdx} - ${file.ffProbeData.streams[i].tags.language.toLowerCase()} \n` + convert = true + } + } catch (err) { } + + try { + if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description'))) { + ffmpegCommandInsert += `-map -0:s:${subtitleIdx} ` + response.infoLog += `☒Subtitle stream detected as being Commentary or Description, removing. Subtitle stream 0:s:${SubtitleIdx} - ${file.ffProbeData.streams[i].tags.title}. \n` + convert = true + } + } catch (err) { } + + try { + if (inputs.tag_title != "") { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && file.ffProbeData.streams[i].tags.language.toLowerCase().includes('und')) { + ffmpegCommandInsert += `-metadata:s:s:${subtitleIdx} language=${inputs.tag_title} ` + response.infoLog += `☒Subtitle stream detected as having unknown language tagged, tagging as ${inputs.tag_title}. \n` + convert = true + } + } + } catch (err) { } + + try { + if (typeof file.ffProbeData.streams[i].tags.language == 'undefined' && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") { + ffmpegCommandInsert += `-metadata:s:s:${subtitleIdx} language=${inputs.tag_title} ` + response.infoLog += `☒Subtitle stream detected as having no language tagged, tagging as ${inputs.tag_title}. \n` + convert = true + } + } catch (err) { } + } + if (convert === true ) { + response.processFile = true; + response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy` + response.container = '.' + file.container + response.reQueueAfter = true; + } else { + response.processFile = false; + response.infoLog += "☑File doesn't contain subtitle tracks which are unwanted or that require tagging.\n" + } + return response +} +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js new file mode 100644 index 0000000..3df9b03 --- /dev/null +++ b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js @@ -0,0 +1,119 @@ +function details() { + return { + id: "Tdarr_Plugin_MC93_Migz5ConvertAudio", + Stage: "Pre-processing", + Name: "Migz-Convert audio streams.", + Type: "Audio", + Operation: "Transcode", + Description: `[TESTING]This plugin can convert any 2.0 audio track/s to AAC and can create downmixed audio tracks. \n\n`, + Version: "2.00", + Link: "", + Inputs: [ + { + name: 'aac_stereo', + tooltip: `Specify if any 2.0 audio tracks should be converted to aac for maximum compatability with devices. + \\nExample:\\n + true + + \\nExample:\\n + false` + }, + { + name: 'downmix', + tooltip: `Specify if downmixing should be used to create extra audio tracks. I.e if you have an 8ch but no 2ch or 6ch, create the missing audio tracks from the 8 ch. Likewise if you only have 6ch, create the missing 2ch from it. + \\nExample:\\n + true + + \\nExample:\\n + false` + }, + ] + } +} + +function plugin(file, librarySettings, inputs) { + var response = { + processFile: false, + container: '.' + file.container, + handBrakeMode: false, + FFmpegMode: true, + 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 + } + + if (inputs.aac_stereo == "" && inputs.downmix == "") { + response.infoLog += "☒Neither aac_stereo or downmix options have been configured within plugin settings, please configure required options. Skipping this plugin. \n" + response.processFile = false + return response + } + + var ffmpegCommandInsert = '' + var audioIdx = 0 + var has2Channel = false + var has6Channel = false + var has8Channel = false + var convert = false + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { + if (file.ffProbeData.streams[i].channels == "2") { + has2Channel = true + } + if (file.ffProbeData.streams[i].channels == "6") { + has6Channel = true + } + if (file.ffProbeData.streams[i].channels == "8") { + has8Channel = true + } + } + } catch (err) { } + } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { + if (inputs.downmix.toLowerCase() == "true") { + if (has8Channel == true && has6Channel == false && file.ffProbeData.streams[i].channels == "8") { + ffmpegCommandInsert += `-map 0:${i} -c:a:${audioIdx} ac3 -ac 6 -metadata:s:a:${audioIdx} title="5.1 " ` + response.infoLog += "☒Audio track is 8 channel, no 6 channel exists. Creating 2 channel from 6 channel. \n" + convert = true + } + if (has6Channel == true && has2Channel == false && file.ffProbeData.streams[i].channels == "6") { + ffmpegCommandInsert += `-map 0:${i} -c:a:${audioIdx} aac -ac 2 -metadata:s:a:${audioIdx} title="2.0 " ` + response.infoLog += "☒Audio track is 6 channel, no 2 channel exists. Creating 2 channel from 6 channel. \n" + convert = true + } + } + if (inputs.aac_stereo.toLowerCase() == "true") { + if (file.ffProbeData.streams[i].codec_name != "aac" && file.ffProbeData.streams[i].channels == "2" ) { + ffmpegCommandInsert += `-c:a:${audioIdx} aac ` + response.infoLog += "☒Audio track is 2 channel but is not AAC. Converting. \n" + convert = true + } + } + audioIdx++ + } + + } + + if (convert == true) { + response.processFile = true; + response.preset = `, -map 0 -c:v copy -c:a copy ${ffmpegCommandInsert} -strict -2 -c:s copy ` + } else { + response.infoLog += "☑File contains all required audio formats. \n" + response.processFile = false; + } + return response + +} + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js new file mode 100644 index 0000000..e028e15 --- /dev/null +++ b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js @@ -0,0 +1,136 @@ +function details() { + return { + id: "Tdarr_Plugin_MC93_Migz6OrderStreams", + Stage: "Pre-processing", + Name: "Migz-Organize Streams.", + Type: "Streams", + Operation: "Organize", + Description: `[TESTING]Organizes streams into Video first, then Audio (2ch, 6ch, 8ch) and finally Subtitles. \n\n`, + Version: "1.00", + Link: "" + } +} + +function plugin(file) { + var response = { + processFile: false, + preset: '', + container: '.' + file.container, + handBrakeMode: false, + FFmpegMode: true, + infoLog: '', + } + + var ffmpegCommandInsert = '' + var videoIdx = 0 + var audioIdx = 0 + var audio2Idx = 0 + var audio6Idx = 0 + var audio8Idx = 0 + var subtitleIdx = 0 + var convert = false + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") { + if (audioIdx != "0" || subtitleIdx != "0") { + convert = true + response.infoLog += "☒ Video not first. \n" + } + videoIdx++ + } + + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { + if (subtitleIdx != "0") { + convert = true + response.infoLog += "☒ Audio not first. \n" + } + audioIdx++ + if (file.ffProbeData.streams[i].channels == "2") { + if (audio6Idx != "0" || audio8Idx != "0") { + convert = true + response.infoLog += "☒ Audio 2ch not first. \n" + } + audio2Idx++ + } + if (file.ffProbeData.streams[i].channels == "6") { + if (audio8Idx != "0") { + convert = true + response.infoLog += "☒ Audio 6ch not second. \n" + } + audio6Idx++ + } + if (file.ffProbeData.streams[i].channels == "8") { + audio8Idx++ + response.infoLog += "☒ Audio 8ch not last. \n" + } + } + + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") { + subtitleIdx++ + } + } catch (err) { } + } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video" && file.ffProbeData.streams[i].codec_name.toLowerCase() != "mjpeg") { + ffmpegCommandInsert += `-map 0:${i} ` + } + } catch (err) { } + } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels == "2") { + ffmpegCommandInsert += `-map 0:${i} ` + } + } catch (err) { } + } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels == "6") { + ffmpegCommandInsert += `-map 0:${i} ` + } + } catch (err) { } + } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels == "8") { + ffmpegCommandInsert += `-map 0:${i} ` + } + } catch (err) { } + } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels != "2" && file.ffProbeData.streams[i].channels != "6" && file.ffProbeData.streams[i].channels != "8") { + ffmpegCommandInsert += `-map 0:${i} ` + } + } catch (err) { } + } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") { + ffmpegCommandInsert += `-map 0:${i} ` + } + } catch (err) { } + } + + if (convert == true) { + response.processFile = true; + response.preset = `,${ffmpegCommandInsert} -c copy` + response.reQueueAfter = true; + response.infoLog += "☒ Streams are out of order, reorganizing streams. Video, Audio, Subtitles. \n" + } else { + response.infoLog += "☑ Streams are in expected order. \n " + response.processFile = false; + } + return response + +} +module.exports.details = details; +module.exports.plugin = plugin; \ No newline at end of file From 0d14fd3c0615a154d2cb29e3366f6600afb35da6 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Fri, 7 Feb 2020 22:21:42 +0000 Subject: [PATCH 05/51] New --- Community/Tdarr_Plugin_43az_add_to_radarr.js | 113 +++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 Community/Tdarr_Plugin_43az_add_to_radarr.js diff --git a/Community/Tdarr_Plugin_43az_add_to_radarr.js b/Community/Tdarr_Plugin_43az_add_to_radarr.js new file mode 100644 index 0000000..18e28e4 --- /dev/null +++ b/Community/Tdarr_Plugin_43az_add_to_radarr.js @@ -0,0 +1,113 @@ + + + +module.exports.details = function details() { + + return { + id: "Tdarr_Plugin_43az_add_to_radarr", + Stage: "Post-processing", + Name: "Add movie to Radarr after processing", + Type: "Video", + Operation: "", + Description: `[TESTING]Add movie to Radarr after processing \n\n`, + Version: "1.00", + Link: "", + + Inputs: [ + { + name: 'server_ip', + tooltip: ` + Enter the server IP address + + \\nExample:\\n + 192.168.0.10 + ` + }, + { + name: 'port', + tooltip: ` + Enter the port Radarr is using + + \\nExample:\\n + 7878 + ` + }, + { + name: 'radarr_api_key', + tooltip: ` + + Enter the Radarr API key. You can find it on Radarr at /settings/general + + \\nExample:\\n + 3ff1ae1c39a2a2a397315e15266dea48 + ` + }, + ] + } +} + +module.exports.plugin = function plugin(file, librarySettings, inputs) { + + + + const request = require('request') + + const IP = inputs.server_ip + const port = inputs.port + const APIKey = inputs.radarr_api_key + + + var term = file.file.split("/") + term = term[term.length - 1] + term = term.split(".") + term = term[term.length - 2] + term = encodeURI(term) + + + console.log(IP) + console.log(term) + + request.get(`http://${IP}:${port}/api/movie/lookup?term=${term}&apikey=${APIKey}`, { + json: { + } + }, (error, res, body) => { + if (error) { + console.error(error) + } + // console.log(`statusCode: ${res.statusCode}`) + //console.log(body) + + + var response = body[0] + console.log(response.title) //Shrek + + + response.profileId = 6 + response.path = file.file + response.qualityProfile = 6 + + + request.post(`http://${IP}:${port}/api/movie?apikey=${APIKey}`, { + json: response + }, (error, res, body) => { + if (error) { + console.error(error) + } + console.log(`statusCode: ${res.statusCode}`) + // console.log(body) + }) + + }) + + + //Optional response if you need to modify database + var response = { + file, + removeFromDB: false, + updateDB: false, + } + + //return response + +} + From e41b457e202fab8dd38c1c8fffec140f72575992 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 8 Feb 2020 07:45:41 +0000 Subject: [PATCH 06/51] Codec examples --- .../Tdarr_Plugin_075a_Transcode_Customisable.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_075a_Transcode_Customisable.js b/Community/Tdarr_Plugin_075a_Transcode_Customisable.js index 581dc64..1bfa927 100644 --- a/Community/Tdarr_Plugin_075a_Transcode_Customisable.js +++ b/Community/Tdarr_Plugin_075a_Transcode_Customisable.js @@ -6,7 +6,7 @@ module.exports.details = function details() { return { id: "Tdarr_Plugin_075a_Transcode_Customisable", Stage: "Pre-processing", - Name: "Transcode Customisable", + Name: "Video Transcode Customisable", Type: "", Operation: "Transcode", Description: `[TESTING][Contains built-in filter] Specify codec filter and transcode arguments for HandBrake or FFmpeg \n\n`, @@ -19,6 +19,18 @@ module.exports.details = function details() { \\nFor example, if you're transcoding into hevc (h265), then add a filter to prevent hevc being transcoded so your newly transcoded files won't be infinitely looped/processed. \\n + + \\nCommon video codecs: + + \\nmpeg4 + \\nhevc + \\nh264 + \\nmpeg2video + \\ntheora + \\nvp8 + \\nvp9 + + \\nExample:\\n hevc From 0966dff55739318ea8444a491443b3a35bc54947 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 8 Feb 2020 07:48:16 +0000 Subject: [PATCH 07/51] Formatting --- Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 2 +- Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index 6211ad1..4624fbf 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -13,7 +13,7 @@ function details() { Inputs: [ { name: 'install_packages', - tooltip: `Please change this to "yes", it allows the plugin to install the required nodemodule. (iso-639-2) \nExample:\n yes` + tooltip: `Please change this to "yes", it allows the plugin to install the required nodemodule. (iso-639-2) \\nExample:\\n yes` }, ] } diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js index 094fd8b..0ef8e1c 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js @@ -17,7 +17,7 @@ function details() { }, { name: 'special', - tooltip: `This is if you want a specific language to be logged to a file in your Tdarr documents folder.\nIt will add the name of the file that is being processed if this language(s) has been found.\nThe file is created the first time it finds a file with the language. \nThe languages don't have to be in "languages". \nExample:\n eng,dut ` + tooltip: `This is if you want a specific language to be logged to a file in your Tdarr documents folder.\nIt will add the name of the file that is being processed if this language(s) has been found.\nThe file is created the first time it finds a file with the language. \nThe languages don't have to be in "languages". \\nExample:\\n eng,dut ` } ] } From 8a89d6f3307bbf453a920a6ffac574b5a09517da Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 8 Feb 2020 07:49:18 +0000 Subject: [PATCH 08/51] Formatting --- Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js index 0ef8e1c..b96ccb3 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js @@ -13,7 +13,7 @@ function details() { Inputs: [ { name: 'languages', - tooltip: `Desired Languages you would like to keep, language format has to be according to the iso-639-2 standard: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes\nExample:\n eng,dut` + tooltip: `Desired Languages you would like to keep, language format has to be according to the iso-639-2 standard: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes\\nExample:\\n eng,dut` }, { name: 'special', From 5268eaad909ffcbe8b04e7e4427547ca42108fd6 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 8 Feb 2020 08:44:10 +0000 Subject: [PATCH 09/51] New --- ..._Transcode_Specific_Audio_Stream_Codecs.js | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js diff --git a/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js b/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js new file mode 100644 index 0000000..50b1213 --- /dev/null +++ b/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js @@ -0,0 +1,148 @@ + + + +module.exports.details = function details() { + + return { + id: "Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs", + Stage: "Pre-processing", + Name: "Transcode Specific Audio Stream Codecs", + Type: "", + Operation: "Transcode", + Description: `[TESTING][Contains built-in filter] Transcode audio streams with specific codecs into another codec. \n\n`, + Version: "1.00", + Link: "", + Inputs: [ + { + name: 'codecs_to_transcode', + tooltip: `Specifiy the codecs which you'd like to transcode + + \\nExample:\\n + + ac3 + + \\nExample:\\n + + eac3,ac3,aac + + + + + + ` + }, + { + name: 'codec', + tooltip: `Specify the codec you'd like to transcode into: + + \\n aac + \\n ac3 + \\n eac3 + \\n dts + \\n flac + \\n mp2 + \\n mp3 + \\n truehd + + \\nExample:\\n + eac3 + + + + + + ` + } + ] + } + +} + +module.exports.plugin = function plugin(file, librarySettings, inputs) { + + + + //Must return this object + + var response = { + + processFile: false, + preset: '', + container: '.mp4', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: '', + + } + + if (inputs.codecs_to_transcode === undefined + || inputs.codec === undefined + ) { + + response.processFile = false + response.infoLog += "☒ Inputs not entered! \n" + return response + } + + + var encoder = inputs.codec + + if (encoder == 'mp3') { + encoder = `libmp3lame` + } else if (encoder == 'dts') { + encoder = `dca` + } + + + + + var codecs_to_transcode = inputs.codecs_to_transcode + var hasStreamsToTranscode = false + + + var ffmpegCommand = `, -c copy -map 0:v ` + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && + file.ffProbeData.streams[i].codec_name && + codecs_to_transcode.toLowerCase().includes(file.ffProbeData.streams[i].codec_name.toLowerCase()) + ) { + + ffmpegCommand += ` -map 0:${i} -c:${i} ${encoder} ` + hasStreamsToTranscode = true + + } + } + + + ffmpegCommand += ` -map 0:s? -map 0:d? ` + + console.log + + + if (hasStreamsToTranscode == false) { + + response.processFile = false + response.infoLog += "☑ File does not have any streams that need to be transcoded! \n" + return response + + } else { + + response.processFile = true; + response.preset = ffmpegCommand + response.container = '.' + file.container + response.handBrakeMode = false + response.FFmpegMode = true + response.reQueueAfter = true; + response.infoLog += `☒ File has streams which aren't in desired codec! \n` + return response + + + + + + } +} + From 967b9733130069b0115a5af957d8b459568b8a9a Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Sat, 8 Feb 2020 13:22:14 +0000 Subject: [PATCH 10/51] Migz Plugins Description Update to the CleanAudio & CleanSubs plugins to make the description clearer. --- Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js | 2 +- Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js index cee7df5..431717e 100644 --- a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js @@ -5,7 +5,7 @@ function details() { Name: "Migz-Clean audio streams.", Type: "Audio", Operation: "Clean", - Description: `[TESTING]This plugin removes audio tracks which are not wanted & tags those that have an unknown language. \n\n`, + Description: `[TESTING]This plugin keeps only specified language audio tracks & can tag those that have an unknown language. \n\n`, Version: "2.00", Link: "", Inputs: [ diff --git a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js index 1180d78..2749aa5 100644 --- a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js +++ b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js @@ -5,7 +5,7 @@ function details() { Name: "Migz-Clean subtitle streams.", Type: "subtitless", Operation: "Clean", - Description: `[TESTING]This plugin removes subtitle tracks which are not wanted & tags subtitles that have an unknown language. \n\n`, + Description: `[TESTING] This plugin keeps only specified language subtitle tracks & can tag those that have an unknown language. \n\n`, Version: "2.00", Link: "", Inputs: [ From ca6f11480e9be152101d899143819c9babe0d199 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Sat, 8 Feb 2020 15:44:20 +0000 Subject: [PATCH 11/51] Migz Plugins: Name Cleanup to names of a few files to remove "." --- Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js | 4 ++-- Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js | 2 +- Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js | 2 +- Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js index 431717e..2482387 100644 --- a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js @@ -2,10 +2,10 @@ function details() { return { id: "Tdarr_Plugin_MC93_Migz3CleanAudio", Stage: "Pre-processing", - Name: "Migz-Clean audio streams.", + Name: "Migz-Clean audio streams", Type: "Audio", Operation: "Clean", - Description: `[TESTING]This plugin keeps only specified language audio tracks & can tag those that have an unknown language. \n\n`, + Description: `[TESTING]This plugin keeps only specified language audio tracks & can tags those that have an unknown language. \n\n`, Version: "2.00", Link: "", Inputs: [ diff --git a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js index 2749aa5..355a580 100644 --- a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js +++ b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js @@ -2,7 +2,7 @@ function details() { return { id: "Tdarr_Plugin_MC93_Migz4CleanSubs", Stage: "Pre-processing", - Name: "Migz-Clean subtitle streams.", + Name: "Migz-Clean subtitle streams", Type: "subtitless", Operation: "Clean", Description: `[TESTING] This plugin keeps only specified language subtitle tracks & can tag those that have an unknown language. \n\n`, diff --git a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js index 3df9b03..f5fb2b8 100644 --- a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js @@ -2,7 +2,7 @@ function details() { return { id: "Tdarr_Plugin_MC93_Migz5ConvertAudio", Stage: "Pre-processing", - Name: "Migz-Convert audio streams.", + Name: "Migz-Convert audio streams", Type: "Audio", Operation: "Transcode", Description: `[TESTING]This plugin can convert any 2.0 audio track/s to AAC and can create downmixed audio tracks. \n\n`, diff --git a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js index e028e15..609e98a 100644 --- a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js +++ b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js @@ -2,7 +2,7 @@ function details() { return { id: "Tdarr_Plugin_MC93_Migz6OrderStreams", Stage: "Pre-processing", - Name: "Migz-Organize Streams.", + Name: "Migz-Organize Streams", Type: "Streams", Operation: "Organize", Description: `[TESTING]Organizes streams into Video first, then Audio (2ch, 6ch, 8ch) and finally Subtitles. \n\n`, From ae9f51731d75ca533a0fc00fc7e2c7cb01358252 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Sun, 9 Feb 2020 00:56:44 +0000 Subject: [PATCH 12/51] Migz Plugin: Change plugin to work via bitrate related targets instead of filesize related target. --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 32 ++++++---------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index e42c1fe..effccd3 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -5,7 +5,7 @@ function details() { Name: "Migz-Transcode Using Nvidia GPU & FFMPEG", Type: "Video", Operation:"Transcode", - Description: `[TESTING]Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on current file size. NVDEC & NVENC compatable GPU required. \n\n`, + Description: `[TESTING]Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`, Version: "2.00", Link: "", Inputs: [ @@ -35,6 +35,12 @@ function plugin(file, librarySettings, inputs) { } var bitrateSettings = "" + var filesize = (file.file_size / 1000) + var duration = (file.meta.Duration * 0.0166667) + var targetBitrate = ~~((file.file_size / (duration * 0.0075)) / 2) + var minimumBitrate = ~~(targetBitrate * 0.7) + var maximumBitrate = ~~(targetBitrate * 1.3) + bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k` if (inputs.container == "") { response.infoLog += "☒Container has not been configured within plugin settings, please configure required options. Skipping this plugin. \n" @@ -50,7 +56,7 @@ function plugin(file, librarySettings, inputs) { return response } - response.infoLog += `Container for video selected as ${inputs.container}. \n` +response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n` if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container == inputs.container) { response.processFile = false @@ -93,28 +99,6 @@ function plugin(file, librarySettings, inputs) { response.preset = `-c:v vp9_cuvid` } - if (file.file_size >= "30000") { - bitrateSettings = "-b:v 30M -minrate 20M" - } else if (file.file_size < "30000" && file.file_size >= "25000") { - bitrateSettings = "-b:v 15M -minrate 10M -maxrate 20M" - } else if (file.file_size < "25000" && file.file_size >= "20000") { - bitrateSettings = "-b:v 12M -minrate 8M -maxrate 16M" - } else if (file.file_size < "20000" && file.file_size >= "15000") { - bitrateSettings = "-b:v 10M -minrate 7M -maxrate 13M" - } else if (file.file_size < "15000" && file.file_size >= "10000") { - bitrateSettings = "-b:v 8M -minrate 6M -maxrate 10M" - } else if (file.file_size < "10000" && file.file_size >= "8000") { - bitrateSettings = "-b:v 5M -minrate 3M -maxrate 8M" - } else if (file.file_size < "8000" && file.file_size >= "6000") { - bitrateSettings = "-b:v 4M -minrate 2M -maxrate 6M" - } else if (file.file_size < "6000" && file.file_size >= "2000") { - bitrateSettings = "-b:v 3M -minrate 1M -maxrate 5M" - } else if (file.file_size < "2000" && file.file_size >= "500") { - bitrateSettings = "-b:v 1M -minrate 500k -maxrate 2M" - } else if (file.file_size < "500" ) { - bitrateSettings = "-b:v 250K -minrate 100k -maxrate 500k" - } - response.preset += `,-map 0 -c:v hevc_nvenc -rc:v vbr_hq ${bitrateSettings} -bufsize 2M -spatial_aq:v 1 -c:a copy -c:s copy -max_muxing_queue_size 4096` response.processFile = true response.infoLog += `☒File is not hevc. Transcoding. \n` From 1a8db15269a32ecdf223f081eb2ec243d7c14c11 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 9 Feb 2020 01:52:54 +0000 Subject: [PATCH 13/51] Revert "Merge pull request #42 from Migz93/master" This reverts commit bd9eb39a0ef1eb6b2ad618ff4fbae12e01506dc4, reversing changes made to 745d39404b9dc6bcac297e2d8413eb40abd05d11. --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index effccd3..e42c1fe 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -5,7 +5,7 @@ function details() { Name: "Migz-Transcode Using Nvidia GPU & FFMPEG", Type: "Video", Operation:"Transcode", - Description: `[TESTING]Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`, + Description: `[TESTING]Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on current file size. NVDEC & NVENC compatable GPU required. \n\n`, Version: "2.00", Link: "", Inputs: [ @@ -35,12 +35,6 @@ function plugin(file, librarySettings, inputs) { } var bitrateSettings = "" - var filesize = (file.file_size / 1000) - var duration = (file.meta.Duration * 0.0166667) - var targetBitrate = ~~((file.file_size / (duration * 0.0075)) / 2) - var minimumBitrate = ~~(targetBitrate * 0.7) - var maximumBitrate = ~~(targetBitrate * 1.3) - bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k` if (inputs.container == "") { response.infoLog += "☒Container has not been configured within plugin settings, please configure required options. Skipping this plugin. \n" @@ -56,7 +50,7 @@ function plugin(file, librarySettings, inputs) { return response } -response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n` + response.infoLog += `Container for video selected as ${inputs.container}. \n` if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container == inputs.container) { response.processFile = false @@ -99,6 +93,28 @@ response.infoLog += `Container for output selected as ${inputs.container}. \n Cu response.preset = `-c:v vp9_cuvid` } + if (file.file_size >= "30000") { + bitrateSettings = "-b:v 30M -minrate 20M" + } else if (file.file_size < "30000" && file.file_size >= "25000") { + bitrateSettings = "-b:v 15M -minrate 10M -maxrate 20M" + } else if (file.file_size < "25000" && file.file_size >= "20000") { + bitrateSettings = "-b:v 12M -minrate 8M -maxrate 16M" + } else if (file.file_size < "20000" && file.file_size >= "15000") { + bitrateSettings = "-b:v 10M -minrate 7M -maxrate 13M" + } else if (file.file_size < "15000" && file.file_size >= "10000") { + bitrateSettings = "-b:v 8M -minrate 6M -maxrate 10M" + } else if (file.file_size < "10000" && file.file_size >= "8000") { + bitrateSettings = "-b:v 5M -minrate 3M -maxrate 8M" + } else if (file.file_size < "8000" && file.file_size >= "6000") { + bitrateSettings = "-b:v 4M -minrate 2M -maxrate 6M" + } else if (file.file_size < "6000" && file.file_size >= "2000") { + bitrateSettings = "-b:v 3M -minrate 1M -maxrate 5M" + } else if (file.file_size < "2000" && file.file_size >= "500") { + bitrateSettings = "-b:v 1M -minrate 500k -maxrate 2M" + } else if (file.file_size < "500" ) { + bitrateSettings = "-b:v 250K -minrate 100k -maxrate 500k" + } + response.preset += `,-map 0 -c:v hevc_nvenc -rc:v vbr_hq ${bitrateSettings} -bufsize 2M -spatial_aq:v 1 -c:a copy -c:s copy -max_muxing_queue_size 4096` response.processFile = true response.infoLog += `☒File is not hevc. Transcoding. \n` From c97fdeff989441472531bd554790a681753de08c Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Sun, 9 Feb 2020 02:31:10 +0000 Subject: [PATCH 14/51] Migz Plugins: Bug Fixes 1) Fixed bug with Migz1FFMPEG where sometimes duration was not available, get duration from stream 0, if duration still not available then exit plugin. 2) Fixed bug with Migz1FFMPEG where it would fail if using mkv and source has a data stream (mkv does not support data streams). 3) Fixed bug with Migz2CleanTitle where if title info did not exist at all it would fail rather then skip. --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 35 +++++++++++++------ .../Tdarr_Plugin_MC93_Migz2CleanTitle.js | 27 ++++++++------ 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index effccd3..381d69c 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -34,14 +34,6 @@ function plugin(file, librarySettings, inputs) { infoLog: '' } - var bitrateSettings = "" - var filesize = (file.file_size / 1000) - var duration = (file.meta.Duration * 0.0166667) - var targetBitrate = ~~((file.file_size / (duration * 0.0075)) / 2) - var minimumBitrate = ~~(targetBitrate * 0.7) - var maximumBitrate = ~~(targetBitrate * 1.3) - bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k` - if (inputs.container == "") { response.infoLog += "☒Container has not been configured within plugin settings, please configure required options. Skipping this plugin. \n" response.processFile = false @@ -55,8 +47,27 @@ function plugin(file, librarySettings, inputs) { response.infoLog += "☒File is not a video. \n" return response } + + if (typeof file.meta.Duration != 'undefined') { + var duration = (file.meta.Duration * 0.0166667) + } else { + var duration = (file.ffProbeData.streams[0].duration * 0.0166667) + } + + var bitrateSettings = "" + var filesize = (file.file_size / 1000) + var targetBitrate = ~~((file.file_size / (duration * 0.0075)) / 2) + var minimumBitrate = ~~(targetBitrate * 0.7) + var maximumBitrate = ~~(targetBitrate * 1.3) -response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n` + if (targetBitrate == "0") { + response.processFile = false + response.infoLog += "☒Target bitrate could not be calculated. Skipping this plugin. \n" + return response + } + + bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k` + response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n` if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container == inputs.container) { response.processFile = false @@ -99,7 +110,11 @@ response.infoLog += `Container for output selected as ${inputs.container}. \n Cu response.preset = `-c:v vp9_cuvid` } - response.preset += `,-map 0 -c:v hevc_nvenc -rc:v vbr_hq ${bitrateSettings} -bufsize 2M -spatial_aq:v 1 -c:a copy -c:s copy -max_muxing_queue_size 4096` + if (inputs.container == "mkv") { + extraArguments = "-map -0:d " + } + + response.preset += `,-map 0 -c:v hevc_nvenc -rc:v vbr_hq ${bitrateSettings} -bufsize 2M -spatial_aq:v 1 -c:a copy -c:s copy -max_muxing_queue_size 4096 ${extraArguments}` response.processFile = true response.infoLog += `☒File is not hevc. Transcoding. \n` return response diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js index ef3a9b3..0b84ce1 100644 --- a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -6,14 +6,13 @@ function details() { Type: "Video", Operation: "Clean", Description: `[TESTING]This plugin removes video title metadata if it exists. \n\n`, - Version: "1.00", + Version: "1.10", Link: "" } } function plugin(file) { var response = { - processFile : false, preset : '', container: '.' + file.container, @@ -35,18 +34,24 @@ function plugin(file) { return response } - if(file.meta.Title != undefined ){ - ffmpegCommandInsert += ` -metadata title="" ` - convert = true - } + try { + if (typeof file.meta.Title != 'undefined' ){ + ffmpegCommandInsert += ` -metadata title="" ` + response.infoLog += "1" + convert = true + } + } catch (err) { } for (var i = 0; i < file.ffProbeData.streams.length; i++) { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") { - if (file.ffProbeData.streams[i].tags.title != undefined) { - ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" ` - convert = true - } - videoIdx++ + try { + if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') { + ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" ` + response.infoLog += "2" + convert = true + } + } catch (err) { } + videoIdx++ } } From c5a1ee55a902e1177245427fab5d87b5337f9784 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 9 Feb 2020 19:56:26 +0000 Subject: [PATCH 15/51] Update Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js --- ...ugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js b/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js index 50b1213..b663619 100644 --- a/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js +++ b/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js @@ -97,7 +97,7 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) { - var codecs_to_transcode = inputs.codecs_to_transcode + var codecs_to_transcode = inputs.codecs_to_transcode.split(',') var hasStreamsToTranscode = false @@ -107,7 +107,7 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].codec_name && - codecs_to_transcode.toLowerCase().includes(file.ffProbeData.streams[i].codec_name.toLowerCase()) + codecs_to_transcode.includes(file.ffProbeData.streams[i].codec_name.toLowerCase()) ) { ffmpegCommand += ` -map 0:${i} -c:${i} ${encoder} ` From 5ac9c85c06c20e41b2d8088b58d2ab360132ff4d Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Sun, 9 Feb 2020 21:58:05 +0000 Subject: [PATCH 16/51] Migz Plugin: Bug Fix Resolve bug with Migz1FFMPEG where bitrate transcode targets were always displayed, even if the file already meets h265/container and isn't used. --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index 381d69c..6cdd9ac 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -65,9 +65,6 @@ function plugin(file, librarySettings, inputs) { response.infoLog += "☒Target bitrate could not be calculated. Skipping this plugin. \n" return response } - - bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k` - response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n` if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container == inputs.container) { response.processFile = false @@ -81,6 +78,9 @@ function plugin(file, librarySettings, inputs) { response.processFile = true; return response } + + bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k` + response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n` //codec will be checked so it can be transcoded correctly if (file.video_codec_name == 'h263') { From 7d5ded76001363ba603d3c3fb563dc9bbac67109 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Mon, 10 Feb 2020 07:06:40 +0000 Subject: [PATCH 17/51] Remove bug tag --- .../Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js | 2 +- .../Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js | 2 +- .../Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js | 2 +- ...Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js index ed699c7..073b382 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -8,7 +8,7 @@ function details() { Stage: "Pre-processing", Name: "TheRealShadoh FFmpeg Subs Medium, video MP4, audio AAC, keep subs. ", Type: "Video", - Description: `[BUG][Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Medium' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n + Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Medium' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n `, Version: "1.00", Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js" diff --git a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js index bdcbfa0..7802655 100644 --- a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -8,7 +8,7 @@ function details() { Stage: "Pre-processing", Name: "TheRealShadoh FFmpeg Subs Fast, video MP4, audio AAC, keep subs. ", Type: "Video", - Description: `[BUG][Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Fast' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n + Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Fast' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n `, Version: "1.00", Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js" diff --git a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js index 9b98a58..9d2476c 100644 --- a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -8,7 +8,7 @@ function details() { Stage: "Pre-processing", Name: "TheRealShadoh FFmpeg Subs Slow, video MP4, audio AAC, keep subs. ", Type: "Video", - Description: `[BUG][Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Slow' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n + Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Slow' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n `, Version: "1.00", Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js" diff --git a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js index 07852af..1449ec5 100644 --- a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -8,7 +8,7 @@ function details() { Stage: "Pre-processing", Name: "TheRealShadoh FFmpeg Subs VeryFast, video MP4, audio AAC, keep subs. ", Type: "Video", - Description: `[BUG][Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'VeryFast' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n + Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'VeryFast' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n `, Version: "1.00", Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_Veryfast.js" From a45de61b72b3466f65216afd016ab350bfe8bb55 Mon Sep 17 00:00:00 2001 From: Jack Dallas <3620144+JackDallas@users.noreply.github.com> Date: Wed, 12 Feb 2020 13:55:08 +0000 Subject: [PATCH 18/51] Initial Commit of Generic FFmpeg preset plugin h264/mp4 --- ...gin_da11_Dallas_FFmpeg_Presets_H264_MP4.js | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js diff --git a/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js b/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js new file mode 100644 index 0000000..12f64d8 --- /dev/null +++ b/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js @@ -0,0 +1,193 @@ +function details() { + return { + id: "Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4", + Stage: "Pre-processing", + Name: "Dallas FFmpeg h264 mp4. Video: h264/mp4, Subs: Convert to mov_text or drop, Audio: aac", + Type: "Video", + Description: `This plugin transcodes into H264 with an MP4 container using the FFmpeg preset you select (slow,medium,fast,veryfast). It maintains all compatible subtitles and audio tracks. \n\n`, + Version: "1.00", + Link: "https://github.com/JackDallas/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js", + Inputs: [ + { + name: 'FFmpeg_preset', + tooltip: `Select the FFmpeg preset you wish to use,(slow,medium,fast,veryfast). + + \\nExample:\\n + slow + + \\nExample:\\n + medium + + \\nExample:\\n + fast + + \\nExample:\\n + veryfast` + } + ] + }; +} + +const presets = [ + "slow", "medium", "fast", "veryfast" +]; + +// Normalizes the preset or if invalid returns null +function getPreset(preset) { + if (!preset) + return null; + + preset = preset.toLowerCase(); + // Strip Spaces + preset = preset.replace(/\s+/g, ''); + + if (presets.includes(preset)) { + return preset; + } + + return null; +} + +const GOOD = true; +const BAD = false; + +function plugin(file, librarySettings, inputs) { + var response = { + processFile: false, + preset: '', + container: '.mp4', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: '', + addInfo(status, info) { + this.infoLog += (status ? "☑" : "☒") + " " + info + "\n"; + } + } + + // Check the file is a video + if (file.fileMedium !== "video") { + console.log("File is not video"); + response.addInfo(BAD, `File is not video`); + response.processFile = false; + return response; + } + + // Get and check the preset + let preset = getPreset(inputs.FFmpeg_preset); + + if (preset === null) { + response.addInfo(BAD, `Invalid Preset, \"${inputs.FFmpeg_preset}\" please select from (slow,medium,fast,veryfast)`); + + throw `Error: Invalid Preset, \"${inputs.FFmpeg_preset}\" please select from (slow,medium,fast,veryfast) \n` + } + + var jsonString = JSON.stringify(file) + + var hasSubs = false; + var hasBadSubs = false; + var subType = "-c:s mov_text"; + var subMap = ""; + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + let streamData = file.ffProbeData.streams[i]; + if (streamData.codec_type.toLowerCase() == "subtitle") { + if (streamData.codec_name === "hdmv_pgs_subtitle" || streamData.codec_name === "dvd_subtitle") { + hasBadSubs = true; + // Drop incompatible subs + subMap += " -map -0:" + streamData.index + " "; + } else if (streamData.codec_name != "mov_text") { + hasSubs = true + // Keep compatible subs + subMap += " -map 0:" + streamData.index + " "; + } + } + } catch (err) { + console.log("Error reading stream: " + JSON.stringify(err)); + } + } + + if (hasBadSubs) + response.addInfo(BAD, "File contains unsupported sub(s), dropping these!"); + + if (file.ffProbeData.streams[0].codec_name != 'h264') { + response.addInfo(BAD, "File is not in h264!"); + response.preset = ', -map_metadata -1 -map 0:v ' + subMap + ' -map 0:a -c:v libx264 -preset medium -c:a aac ' + subType; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } else { + response.addInfo(GOOD, "File is already in h264!"); + } + + if ((file.meta.Title != undefined) && !jsonString.includes("aac") && hasSubs) { + response.addInfo(BAD, "File has title metadata and no aac and subs"); + response.preset = ', -map_metadata -1 -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a aac ' + subType; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response + } + + if (!jsonString.includes("aac") && hasSubs) { + response.addInfo(BAD, "File has no aac track and has subs"); + response.preset = ', -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a aac ' + subType; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + + if (file.meta.Title != undefined && hasSubs) { + response.addInfo(BAD, "File has title and has subs"); + response.preset = ', -map_metadata -1 -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a copy ' + subType; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + + if (file.meta.Title != undefined) { + response.addInfo(BAD, "File has title metadata"); + response.preset = ', -map_metadata -1 -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a copy ' + subType; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } else { + response.addInfo(GOOD, "File has no title metadata"); + } + + if (!jsonString.includes("aac")) { + response.addInfo(BAD, "File has no aac track"); + response.preset = ', -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a aac ' + subType; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } else { + response.addInfo(GOOD, "File has aac track"); + } + + if (hasSubs) { + if (hasBadSubs) { + response.addInfo(BAD, "File has incompatible subs, dropping these..."); + } else { + response.addInfo(BAD, "File has compatible subs, copying..."); + } + response.preset = ', -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a copy ' + subType; + response.processFile = true; + response.FFmpegMode = true + return response + } else { + response.addInfo(GOOD, "File has no/compatible subs"); + } + + response.addInfo(GOOD, "File meets conditions!"); + return response +} + +module.exports.details = details; +module.exports.plugin = plugin; From 85306184022b19da6ee0417a38ed0e1b4a9944f0 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 13 Feb 2020 00:20:30 +0000 Subject: [PATCH 19/51] tags --- Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js | 3 ++- Community/Tdarr_Plugin_075a_Transcode_Customisable.js | 1 + .../Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js | 3 ++- ..._Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js | 3 ++- ...gin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js | 3 ++- Community/Tdarr_Plugin_076a_re_order_audio_streams.js | 1 + Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js | 1 + Community/Tdarr_Plugin_43az_add_to_radarr.js | 1 + Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 3 ++- Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js | 3 ++- Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js | 1 + Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js | 1 + Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js | 1 + Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js | 3 ++- Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js | 3 ++- ..._Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js | 3 ++- ...darr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js | 3 ++- ...ugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js | 1 + Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js | 3 ++- Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js | 3 ++- .../Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 3 ++- .../Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js | 1 + ...ugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta.js | 3 ++- ...ugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta.js | 3 ++- ...gin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta.js | 3 ++- Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 1 + Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js | 1 + Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js | 4 ++-- ...rr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle.js | 3 ++- Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js | 3 ++- Community/Tdarr_Plugin_lmg1_Reorder_Streams.js | 3 ++- Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js | 3 ++- Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js | 3 ++- Community/Tdarr_Plugin_s7x8_winsome_h265.js | 3 ++- Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js | 3 ++- Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js | 3 ++- Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js | 3 ++- .../Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js | 3 ++- Community/Tdarr_Plugin_x7ab_Remove_Subs.js | 3 ++- Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js | 3 ++- ...Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js | 3 ++- Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js | 1 + .../Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js | 3 ++- .../Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js | 3 ++- ...arr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js | 3 ++- 45 files changed, 78 insertions(+), 34 deletions(-) diff --git a/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js b/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js index f1a24fe..6fbb4cc 100644 --- a/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js +++ b/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js @@ -11,7 +11,8 @@ function details() { Operation:"Transcode", Description: `[Contains built-in filter] This plugin transcodes non h265 files into h265 mkv using default settings. Audio/subtitles not affected. \n\n`, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js", + Tags:'pre-processing,ffmpeg,h265,video,video only' } } diff --git a/Community/Tdarr_Plugin_075a_Transcode_Customisable.js b/Community/Tdarr_Plugin_075a_Transcode_Customisable.js index 1bfa927..1d8b7f8 100644 --- a/Community/Tdarr_Plugin_075a_Transcode_Customisable.js +++ b/Community/Tdarr_Plugin_075a_Transcode_Customisable.js @@ -12,6 +12,7 @@ module.exports.details = function details() { Description: `[TESTING][Contains built-in filter] Specify codec filter and transcode arguments for HandBrake or FFmpeg \n\n`, Version: "1.00", Link: "", + Tags:'pre-processing,handbrake,ffmpeg,configurable', Inputs: [ { name: 'codecs_to_exclude', diff --git a/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js b/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js index 9b3a52c..4a5d236 100644 --- a/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js +++ b/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js @@ -11,7 +11,8 @@ function details() { Operation:"Transcode", Description: `[Contains built-in filter] This plugin transcodes non h265 files into h265 mkv using default settings. Only video and audio streams are kept. Useful for if you're getting errors because of certain containers not being able to handle certain subtitle/data streams. \n\n`, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js", + Tags:'pre-processing,video only,ffmpeg,h265', } } diff --git a/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js b/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js index 26d79e5..955645f 100644 --- a/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js +++ b/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js @@ -10,7 +10,8 @@ function details() { Operation:"Transcode", Description: `[Contains built-in filter] This plugin transcodes non h265 files into h265 mkv using default settings. Only video and audio streams are kept. Useful for if you're getting errors because of certain containers not being able to handle certain subtitle/data streams. A CRF value of 20 is used. \n\n`, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js", + Tags:'pre-processing,video only,ffmpeg,h265', } } diff --git a/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js b/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js index 7b34fa4..2b5a8d6 100644 --- a/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js +++ b/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js @@ -10,7 +10,8 @@ function details() { Operation:"Transcode", Description: `[Contains built-in filter] This plugin transcodes non h265 files into h265 mkv using the graphics card and a CRF value of 20. Only video and audio streams are kept. Useful for if you're getting errors because of certain containers not being able to handle certain subtitle/data streams. A CRF value of 20 is used. The GPU (graphics card) is used. \n\n`, Version: "1.00", - Link: "https://github.com/moodiest/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js" + Link: "https://github.com/moodiest/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js", + Tags:'pre-processing,video only,ffmpeg,h265', } } diff --git a/Community/Tdarr_Plugin_076a_re_order_audio_streams.js b/Community/Tdarr_Plugin_076a_re_order_audio_streams.js index e1fdf39..93cdc17 100644 --- a/Community/Tdarr_Plugin_076a_re_order_audio_streams.js +++ b/Community/Tdarr_Plugin_076a_re_order_audio_streams.js @@ -12,6 +12,7 @@ module.exports.details = function details() { Description: `[TESTING][Contains built-in filter] Specify a language tag for Tdarr to try and put as 1st audio track \n\n`, Version: "1.00", Link: "", + Tags:'pre-processing,audio only,ffmpeg,configurable', Inputs: [ { name: 'preferred_language', diff --git a/Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js b/Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js index 91904e6..8212212 100644 --- a/Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js +++ b/Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js @@ -12,6 +12,7 @@ module.exports.details = function details() { Description: `[TESTING][Contains built-in filter] Specify a language tag for Tdarr to try and put as 1st subtitle track \n\n`, Version: "1.00", Link: "", + Tags:'pre-processing,subtitle only,ffmpeg,configurable', Inputs: [ { name: 'preferred_language', diff --git a/Community/Tdarr_Plugin_43az_add_to_radarr.js b/Community/Tdarr_Plugin_43az_add_to_radarr.js index 18e28e4..6fd1c33 100644 --- a/Community/Tdarr_Plugin_43az_add_to_radarr.js +++ b/Community/Tdarr_Plugin_43az_add_to_radarr.js @@ -12,6 +12,7 @@ module.exports.details = function details() { Description: `[TESTING]Add movie to Radarr after processing \n\n`, Version: "1.00", Link: "", + Tags:"radarr,post-processing,configurable", Inputs: [ { diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index 381d69c..67c3dc8 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -7,7 +7,8 @@ function details() { Operation:"Transcode", Description: `[TESTING]Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`, Version: "2.00", - Link: "", + Link: "", + Tags:'pre-processing,ffmpeg,video only,h265,nvenc h265,configurable', Inputs: [ { name: 'container', diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js index 0b84ce1..3c86feb 100644 --- a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -7,7 +7,8 @@ function details() { Operation: "Clean", Description: `[TESTING]This plugin removes video title metadata if it exists. \n\n`, Version: "1.10", - Link: "" + Link: "", + Tags:'pre-processing,ffmpeg,video only', } } diff --git a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js index 2482387..8d22042 100644 --- a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js @@ -8,6 +8,7 @@ function details() { Description: `[TESTING]This plugin keeps only specified language audio tracks & can tags those that have an unknown language. \n\n`, Version: "2.00", Link: "", + Tags:'pre-processing,ffmpeg,audio only,configurable', Inputs: [ { name: 'language', diff --git a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js index 355a580..2ef66a3 100644 --- a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js +++ b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js @@ -8,6 +8,7 @@ function details() { Description: `[TESTING] This plugin keeps only specified language subtitle tracks & can tag those that have an unknown language. \n\n`, Version: "2.00", Link: "", + Tags:'pre-processing,ffmpeg,subtitle only,configurable', Inputs: [ { name: 'language', diff --git a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js index f5fb2b8..b1e6b16 100644 --- a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js @@ -8,6 +8,7 @@ function details() { Description: `[TESTING]This plugin can convert any 2.0 audio track/s to AAC and can create downmixed audio tracks. \n\n`, Version: "2.00", Link: "", + Tags:'pre-processing,ffmpeg,audio only,configurable', Inputs: [ { name: 'aac_stereo', diff --git a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js index 609e98a..829d4ae 100644 --- a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js +++ b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js @@ -7,7 +7,8 @@ function details() { Operation: "Organize", Description: `[TESTING]Organizes streams into Video first, then Audio (2ch, 6ch, 8ch) and finally Subtitles. \n\n`, Version: "1.00", - Link: "" + Link: "", + Tags:'pre-processing,ffmpeg,' } } diff --git a/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js b/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js index 25b6ac6..18cf629 100644 --- a/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin removes metadata (if a title exists). The output container is mp4. \n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js", + Tags:'pre-processing,ffmpeg', } } diff --git a/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js b/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js index 9eb959a..6cc48f6 100644 --- a/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js +++ b/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin transcodes into H264 using HandBrake's 'Very Fast 1080p30' preset if the file is not in H264 already. It removes subs, metadata (if a title exists) and adds a stereo 192kbit AAC track if an AAC track (any) doesn't exist. The output container is MP4. \n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js", + Tags:'pre-processing,handbrake,ffmpeg,h264', } } diff --git a/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js b/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js index a1d539f..03e7920 100644 --- a/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js +++ b/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin transcodes into H264 using HandBrake's 'Fast 1080p30' preset if the file is not in H264 already. It removes subs, metadata (if a title exists) and adds a stereo 192kbit AAC track if an AAC track (any) doesn't exist. The output container is MP4. \n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js", + Tags:'pre-processing,handbrake,ffmpeg,h264', } } diff --git a/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js b/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js index b663619..87a35b4 100644 --- a/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js +++ b/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js @@ -12,6 +12,7 @@ module.exports.details = function details() { Description: `[TESTING][Contains built-in filter] Transcode audio streams with specific codecs into another codec. \n\n`, Version: "1.00", Link: "", + Tags:'pre-processing,audio only,ffmpeg,configurable', Inputs: [ { name: 'codecs_to_transcode', diff --git a/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js b/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js index 68bd332..4fc0d2f 100644 --- a/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js +++ b/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] If the file is not in h265 it will be trancoded into h265 with FFmpeg using the following command '-e x265 -q 22 --encoder-preset slow --all-audio --all-subtitles copy:aac -E fdk_aac -Q 4 -x aq-mode=3'. If no aac, aac track will be added. Subtitles are kept. Metadata is removed.\n\n `, Version: "1.01", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js", + Tags:'pre-processing,ffmpeg,h265,', } } diff --git a/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js b/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js index 92fdc80..5379f59 100644 --- a/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js +++ b/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] If the file has surround sound tracks not in ac3, they will be converted to ac3. \n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js", + Tags:'pre-processing,ffmpeg,audio only,', } } diff --git a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js index e991507..e681f0d 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -7,7 +7,8 @@ function details() { Operation:"Transcode", Description: `[Contains built-in filter] This plugin uses different FFMPEG NVENC transcoding settings for 480p,576p,720p,1080p and 4KUHD. If files are not in hevc they will be transcoded. The output container is mkv. \n\n`, Version: "1.08", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js", + Tags:'pre-processing,ffmpeg,video only,h265,nvenc h265', } } diff --git a/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js b/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js index 53af256..f226984 100644 --- a/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js +++ b/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js @@ -7,6 +7,7 @@ function details() { Operation:"", Description: `Checks if file is not a video file due to Mjpeg stream. Removes Mjpeg Stream \n\n`, Version: "1.00", + Tags:'pre-processing,ffmpeg,' } } diff --git a/Community/Tdarr_Plugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta.js b/Community/Tdarr_Plugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta.js index 66ba7f1..0b25aa9 100644 --- a/Community/Tdarr_Plugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin removes subs, metadata (if a title exists) and makes sure the video is h264 480p mkv. \n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta.js", + Tags:'pre-processing,handbrake,ffmpeg,h264' } } diff --git a/Community/Tdarr_Plugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta.js b/Community/Tdarr_Plugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta.js index e58745a..6ad4c5f 100644 --- a/Community/Tdarr_Plugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin removes subs, metadata (if a title exists) and makes sure the video is h264 720p mkv. \n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta.js", + Tags:'pre-processing,handbrake,ffmpeg,h264' } } diff --git a/Community/Tdarr_Plugin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta.js b/Community/Tdarr_Plugin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta.js index 98584e9..956b23b 100644 --- a/Community/Tdarr_Plugin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin removes subs, metadata (if a title exists) and makes sure the video is h264 1080p mkv. \n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta.js", + Tags:'pre-processing,handbrake,ffmpeg,h264' } } diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index 4624fbf..290ae9a 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -10,6 +10,7 @@ function details() { Description: `This plugin will check for subtitles, they should be named according to the ISO 639-2 language code.\nA subtitle could look like this: eng.srt\n If there are subtitles found they will be added with FFMPEG, if there are no subs of that language found.\n On first run node module iso-639-2 will be installed in the documents folder.\n Created by @control#0405`, Version: "1.3", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js", + Tags:'pre-processing,ffmpeg,subtitle only,configurable', Inputs: [ { name: 'install_packages', diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js index b96ccb3..eff4e85 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js @@ -10,6 +10,7 @@ function details() { Description: "Plugin that checks for unwanted audio, per 1.104 beta you can change the languages yourself from within Tdarr!\nUntill you enter a value it keep english tracks by default.\nUndefined languages are kept to prevent videos without sound.\nIf you would like to keep track of the languages you have for each file you can use the 'special' option.\nCreated by @control#0405", Version: "1.1", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Remove_non_English_Audio.js", + Tags:'pre-processing,ffmpeg,audio only,configurable', Inputs: [ { name: 'languages', diff --git a/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js b/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js index 03757ab..5315170 100644 --- a/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js +++ b/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js @@ -8,8 +8,8 @@ function details() { Stage: "Pre-processing", Name: "Sparticus 4K +AC3 No Subs Original container", Type: "Video", - Description: `[Contains built-in filter] This plugin for 4K video removes subs. If no AC3 track exists, it adds one (max 5.1 channels). If only an AC3 commentary track exists, it adds a new AC3 main track (max 5.1 channels). The output container is the same as the original file. \n\n -`, + Description: `[Contains built-in filter] This plugin for 4K video removes subs. If no AC3 track exists, it adds one (max 5.1 channels). If only an AC3 commentary track exists, it adds a new AC3 main track (max 5.1 channels). The output container is the same as the original file. \n\n`, + Tags:'pre-processing,ffmpeg', Version: "1.04", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js" } diff --git a/Community/Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle.js b/Community/Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle.js index c769c95..6f0e636 100644 --- a/Community/Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle.js +++ b/Community/Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin removes subs, metadata (if a title exists) and adds a stereo 192kbit AAC track if an AAC track (English or any) doesn't exist. The output container is mp4. \n\n `, Version: "1.07", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle.js", + Tags:'pre-processing,ffmpeg', } } diff --git a/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js b/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js index 7978322..b542b26 100644 --- a/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js +++ b/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin removes metadata (if a title exists) and adds a stereo 192kbit AAC track if an AAC track (any) doesn't exist. The output container is mp4. \n\n `, Version: "1.01", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js", + Tags:'pre-processing,ffmpeg', } } diff --git a/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js b/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js index 848b682..c338f73 100644 --- a/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js +++ b/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js @@ -7,7 +7,8 @@ function details() { Type: "Video", Description: `[Contains built-in filter] This plugin will move the video stream to the front so Tdarr will recognize the codec correctly.\n\n`, Version: "1.00", - Link: "https://github.com/luigi311/Tdarr_Plugin_lmg1_Reorder_Streams" + Link: "https://github.com/luigi311/Tdarr_Plugin_lmg1_Reorder_Streams", + Tags:'pre-processing,ffmpeg', } } diff --git a/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js b/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js index ae1e453..f27fbea 100644 --- a/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin removes metadata (if a title exists). The output container is the same as the original. \n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js", + Tags:'pre-processing,ffmpeg', } } diff --git a/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js b/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js index f365746..6aa470c 100644 --- a/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js +++ b/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin transcodes all 4K videos to h265 using nvenc (if not in h265 already). For 4K and files in other resolutions: If not in mkv the file is remuxed into mkv. If the English language track is not in AC3,EAC3 or DTS then an AC3 track is added.\n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js", + Tags:'pre-processing,ffmpeg,h265,nvenc h265', } } diff --git a/Community/Tdarr_Plugin_s7x8_winsome_h265.js b/Community/Tdarr_Plugin_s7x8_winsome_h265.js index 5f39300..2187522 100644 --- a/Community/Tdarr_Plugin_s7x8_winsome_h265.js +++ b/Community/Tdarr_Plugin_s7x8_winsome_h265.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin transcodes all videos to h265 (if not in h265 already) and remuxes if not in mkv. If the English language track is not in AC3,EAC3 or DTS then an AC3 track is added.\n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s7x8_winsome_h265.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s7x8_winsome_h265.js", + Tags:'pre-processing,ffmpeg,h265', } } diff --git a/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js b/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js index 45a79ba..2225c68 100644 --- a/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js +++ b/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin transcodes all videos to h265 10 bit (if not in h265 already) and remuxes if not in mkv. If the English language track is not in AC3,EAC3 or DTS then an AC3 track is added.\n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js", + Tags:'pre-processing,ffmpeg,h265', } } diff --git a/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js b/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js index 44699bc..f745e64 100644 --- a/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js +++ b/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin transcodes all videos to h265 using nvenc (if not in h265 already) and remuxes if not in mkv. If the English language track is not in AC3,EAC3 or DTS then an AC3 track is added.\n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js", + Tags:'pre-processing,ffmpeg,h265,nvenc h265', } } diff --git a/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js b/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js index 94b0cc9..95c2061 100644 --- a/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js +++ b/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js @@ -11,7 +11,8 @@ function details() { Operation: "Remux", Description: `[Contains built-in filter] If commentary tracks are detected, they will be removed. \n\n`, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js", + Tags:'pre-processing,ffmpeg,audio only', } } diff --git a/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js b/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js index 32a6ae3..b662055 100644 --- a/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js +++ b/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin removes audio tracks which are not English or are not undefined. It ensures at least 1 audio track is left in any language. \n\n `, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js", + Tags:'pre-processing,ffmpeg,audio only', } } diff --git a/Community/Tdarr_Plugin_x7ab_Remove_Subs.js b/Community/Tdarr_Plugin_x7ab_Remove_Subs.js index ac0827b..876f4d0 100644 --- a/Community/Tdarr_Plugin_x7ab_Remove_Subs.js +++ b/Community/Tdarr_Plugin_x7ab_Remove_Subs.js @@ -10,7 +10,8 @@ function details() { Type: "Video", Description: `[Contains built-in filter] This plugin removes subtitles if detected. The output container is the same as the original. \n\n`, Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_x7ab_Remove_Subs.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_x7ab_Remove_Subs.js", + Tags:'pre-processing,ffmpeg,subtitle only', } } diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index f2d95ea..a326a7b 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -10,7 +10,8 @@ function details() { Operation: "Remux", Description: "[Contains built-in filter] If detected, closed captions (XDS,608,708) will be removed.", Version: "1.00", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js", + Tags:'pre-processing,ffmpeg,subtitle only', } diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js index 073b382..2bda67c 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Medium' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n `, Version: "1.00", - Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js" + Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js", + Tags:'pre-processing,ffmpeg,h264', } } diff --git a/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js b/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js index 43ad46d..032dc9a 100644 --- a/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js +++ b/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js @@ -12,6 +12,7 @@ module.exports.details = function details() { Description: `[TESTING][Contains built-in filter]This plugin renames 264 files to 265 or vice versa depending on codec. \n\n`, Version: "1.00", Link: "", + Tags:"post-processing", } diff --git a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js index 7802655..2f9b6d6 100644 --- a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Fast' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n `, Version: "1.00", - Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js" + Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js", + Tags:'pre-processing,ffmpeg,h264', } } diff --git a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js index 9d2476c..45ed83e 100644 --- a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Slow' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n `, Version: "1.00", - Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js" + Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js", + Tags:'pre-processing,ffmpeg,h264', } } diff --git a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js index 1449ec5..b02b45a 100644 --- a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -11,7 +11,8 @@ function details() { Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'VeryFast' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n `, Version: "1.00", - Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_Veryfast.js" + Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_Veryfast.js", + Tags:'pre-processing,ffmpeg,h264', } } From 99d9584699507fc9ccfdbbd8eb14711272f92275 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 13 Feb 2020 00:24:43 +0000 Subject: [PATCH 20/51] tags --- Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js | 1 + Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js b/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js index 12f64d8..5665356 100644 --- a/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js +++ b/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js @@ -7,6 +7,7 @@ function details() { Description: `This plugin transcodes into H264 with an MP4 container using the FFmpeg preset you select (slow,medium,fast,veryfast). It maintains all compatible subtitles and audio tracks. \n\n`, Version: "1.00", Link: "https://github.com/JackDallas/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js", + Tags:'pre-processing,ffmpeg,h264,video only,configurable', Inputs: [ { name: 'FFmpeg_preset', diff --git a/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js b/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js index 5315170..d0167c9 100644 --- a/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js +++ b/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js @@ -9,9 +9,9 @@ function details() { Name: "Sparticus 4K +AC3 No Subs Original container", Type: "Video", Description: `[Contains built-in filter] This plugin for 4K video removes subs. If no AC3 track exists, it adds one (max 5.1 channels). If only an AC3 commentary track exists, it adds a new AC3 main track (max 5.1 channels). The output container is the same as the original file. \n\n`, - Tags:'pre-processing,ffmpeg', Version: "1.04", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js", + Tags:'pre-processing,ffmpeg', } } From a3c71e79c5a00a3a85b01341d371b25fecaa3425 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 13 Feb 2020 01:07:03 +0000 Subject: [PATCH 21/51] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9083939..769676a 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,11 @@ There are two types of plugin: Steps for creating a community or local plugin. -1.Download Tdarr_Plugin_nc7x_Example.js from the following repository: +1. Copy the following pre and post-processing plugin examples: -https://github.com/HaveAGitGat/Tdarr_Plugin_nc7x_Example +https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Tdarr_Plugin_zzzz_Post_Proc_Example.js +https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Tdarr_Plugin_zzzz_Post_Proc_Example.js 2.Determine an id for your plugin. Every id must start with 'Tdarr_Plugin_xxxx' where xxxx is a random mini id containing the following: Numeric digits (0-9) From 3849ebfc8f080234d55262581e738225489ddd87 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 13 Feb 2020 01:11:02 +0000 Subject: [PATCH 22/51] tag examples --- Tdarr_Plugin_aaaa_Pre_Proc_Example.js | 1 + Tdarr_Plugin_zzzz_Post_Proc_Example.js | 1 + 2 files changed, 2 insertions(+) diff --git a/Tdarr_Plugin_aaaa_Pre_Proc_Example.js b/Tdarr_Plugin_aaaa_Pre_Proc_Example.js index e0eed10..a1c3d63 100644 --- a/Tdarr_Plugin_aaaa_Pre_Proc_Example.js +++ b/Tdarr_Plugin_aaaa_Pre_Proc_Example.js @@ -12,6 +12,7 @@ module.exports.details = function details() { Description: `This plugin removes metadata (if a title exists). The output container is the same as the original. \n\n`, Version: "1.00", Link: "https://github.com/HaveAGitGat/Tdarr_Plugin_aaaa_Pre_Proc_Example", + Tags:"ffmpeg,h265", //Provide tags to categorise your plugin in the plugin browser.Tag options: h265,hevc,h264,nvenc h265,nvenc h264,video only,audio only,subtitle only,handbrake,ffmpeg,radarr,sonarr,pre-processing,post-processing,configurable Inputs: [ //(Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI { diff --git a/Tdarr_Plugin_zzzz_Post_Proc_Example.js b/Tdarr_Plugin_zzzz_Post_Proc_Example.js index 37627b9..4bd2d34 100644 --- a/Tdarr_Plugin_zzzz_Post_Proc_Example.js +++ b/Tdarr_Plugin_zzzz_Post_Proc_Example.js @@ -12,6 +12,7 @@ module.exports.details = function details() { Description: `This plugin does some stuff after all plugins have been executed. \n\n`, Version: "1.00", Link: "https://github.com/HaveAGitGat/Tdarr_Plugin_aaaa_Post_Proc_Example", + Tags:"ffmpeg,h265", //Provide tags to categorise your plugin in the plugin browser.Tag options: h265,hevc,h264,nvenc h265,nvenc h264,video only,audio only,subtitle only,handbrake,ffmpeg,radarr,sonarr,pre-processing,post-processing,configurable Inputs: [ //(Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI { From 607df7fa636b4ba36c10d0ff959b0c4ce4dc27e7 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 13 Feb 2020 01:16:02 +0000 Subject: [PATCH 23/51] Clear up tags --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 2 +- .../Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 2 +- Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js | 2 +- Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index 02646f3..36903ce 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -8,7 +8,7 @@ function details() { Description: `[TESTING]Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`, Version: "2.00", Link: "", - Tags:'pre-processing,ffmpeg,video only,h265,nvenc h265,configurable', + Tags:'pre-processing,ffmpeg,video only,nvenc h265,configurable', Inputs: [ { name: 'container', diff --git a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js index e681f0d..d7ea4d4 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -8,7 +8,7 @@ function details() { Description: `[Contains built-in filter] This plugin uses different FFMPEG NVENC transcoding settings for 480p,576p,720p,1080p and 4KUHD. If files are not in hevc they will be transcoded. The output container is mkv. \n\n`, Version: "1.08", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js", - Tags:'pre-processing,ffmpeg,video only,h265,nvenc h265', + Tags:'pre-processing,ffmpeg,video only,nvenc h265', } } diff --git a/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js b/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js index 6aa470c..c66e845 100644 --- a/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js +++ b/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js @@ -12,7 +12,7 @@ function details() { `, Version: "1.00", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js", - Tags:'pre-processing,ffmpeg,h265,nvenc h265', + Tags:'pre-processing,ffmpeg,nvenc h265', } } diff --git a/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js b/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js index f745e64..a687883 100644 --- a/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js +++ b/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js @@ -12,7 +12,7 @@ function details() { `, Version: "1.00", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js", - Tags:'pre-processing,ffmpeg,h265,nvenc h265', + Tags:'pre-processing,ffmpeg,nvenc h265', } } From 8ac2e2f165aea1a8543916c6ecdcd0827a128100 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Fri, 14 Feb 2020 21:03:17 +0000 Subject: [PATCH 24/51] Update Tdarr_Plugin_z18s_rename_files_based_on_codec.js --- .../Tdarr_Plugin_z18s_rename_files_based_on_codec.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js b/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js index 032dc9a..4e9b3d0 100644 --- a/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js +++ b/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js @@ -22,7 +22,15 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) { try { - var fsextra = require('fs-extra') + var fs = require('fs'); + var path = require('path'); + if (fs.existsSync(path.join(process.cwd() , '/npm'))) { + var rootModules = path.join(process.cwd() , '/npm/node_modules/') + } else{ + var rootModules = '' + } + + var fsextra = require(rootModules+'fs-extra') var fileNameOld = file._id From cc1eb938381ba4f2aa4bb8129f3b9bd65ce140ea Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 18 Feb 2020 02:19:36 +0000 Subject: [PATCH 25/51] tag change --- Community/Tdarr_Plugin_43az_add_to_radarr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_43az_add_to_radarr.js b/Community/Tdarr_Plugin_43az_add_to_radarr.js index 6fd1c33..d0e184b 100644 --- a/Community/Tdarr_Plugin_43az_add_to_radarr.js +++ b/Community/Tdarr_Plugin_43az_add_to_radarr.js @@ -12,7 +12,7 @@ module.exports.details = function details() { Description: `[TESTING]Add movie to Radarr after processing \n\n`, Version: "1.00", Link: "", - Tags:"radarr,post-processing,configurable", + Tags:"3rd party,post-processing,configurable", Inputs: [ { From 3a1a4bfeb0916197742d032e4a25d6402fa9a1e3 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 20 Feb 2020 03:41:35 +0000 Subject: [PATCH 26/51] Update Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js --- Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js b/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js index 6fbb4cc..cc69448 100644 --- a/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js +++ b/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js @@ -12,7 +12,7 @@ function details() { Description: `[Contains built-in filter] This plugin transcodes non h265 files into h265 mkv using default settings. Audio/subtitles not affected. \n\n`, Version: "1.00", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js", - Tags:'pre-processing,ffmpeg,h265,video,video only' + Tags:'pre-processing,ffmpeg,h265,video only' } } From 831bf4e772edcaca31eeb334f23a3e567b701e0d Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 20 Feb 2020 08:25:22 +0000 Subject: [PATCH 27/51] handbrake --- Community/Tdarr_Plugin_s7x8_winsome_h265.js | 2 +- Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js | 2 +- Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Community/Tdarr_Plugin_s7x8_winsome_h265.js b/Community/Tdarr_Plugin_s7x8_winsome_h265.js index 2187522..379bbfc 100644 --- a/Community/Tdarr_Plugin_s7x8_winsome_h265.js +++ b/Community/Tdarr_Plugin_s7x8_winsome_h265.js @@ -12,7 +12,7 @@ function details() { `, Version: "1.00", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s7x8_winsome_h265.js", - Tags:'pre-processing,ffmpeg,h265', + Tags:'pre-processing,handbrake,ffmpeg,h265', } } diff --git a/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js b/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js index 2225c68..9216486 100644 --- a/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js +++ b/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js @@ -12,7 +12,7 @@ function details() { `, Version: "1.00", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js", - Tags:'pre-processing,ffmpeg,h265', + Tags:'pre-processing,handbrake,ffmpeg,h265', } } diff --git a/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js b/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js index a687883..cbf0bdc 100644 --- a/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js +++ b/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js @@ -12,7 +12,7 @@ function details() { `, Version: "1.00", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js", - Tags:'pre-processing,ffmpeg,nvenc h265', + Tags:'pre-processing,handbrake,ffmpeg,nvenc h265', } } From 2da08f3de59c169e1dec6f9f8891ab85b7fafc88 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Fri, 21 Feb 2020 14:02:02 +0000 Subject: [PATCH 28/51] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 769676a..3528183 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Steps for creating a community or local plugin. 1. Copy the following pre and post-processing plugin examples: -https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Tdarr_Plugin_zzzz_Post_Proc_Example.js +https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Tdarr_Plugin_aaaa_Pre_Proc_Example.js https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Tdarr_Plugin_zzzz_Post_Proc_Example.js From 367533cd375346f24225c364370b8c1d6070ea1e Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Fri, 21 Feb 2020 14:20:18 +0000 Subject: [PATCH 29/51] New --- ...n_077b_HandBrake_NVENC_264_Configurable.js | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 Community/Tdarr_Plugin_077b_HandBrake_NVENC_264_Configurable.js diff --git a/Community/Tdarr_Plugin_077b_HandBrake_NVENC_264_Configurable.js b/Community/Tdarr_Plugin_077b_HandBrake_NVENC_264_Configurable.js new file mode 100644 index 0000000..9359bfe --- /dev/null +++ b/Community/Tdarr_Plugin_077b_HandBrake_NVENC_264_Configurable.js @@ -0,0 +1,112 @@ + + + +module.exports.details = function details() { + + return { + id: "Tdarr_Plugin_077b_HandBrake_NVENC_264_Configurable", + Stage: "Pre-processing", + Name: "HandBrake NVENC 264 Configurable", + Type: "Video", + Operation: "Transcode", + Description: `[Contains built-in filter] If files are not in H264, they will be transcoded into H264 using HandBrake NVENC H264. All audio and subtitles are kept. \n\n`, + Version: "1.00", + Link: "", + Tags: 'pre-processing,handbrake,nvenc h264,configurable', + Inputs: [ + { + name: 'handbrake_preset', + tooltip: `\\nEnter the name of a HandBrake preset. + + + \\nYou can learn more about HandBrake presets here: + + \\nhttps://handbrake.fr/docs/en/latest/technical/official-presets.html + + + \\nExample:\\n + Very Fast 1080p30 + + \\nExample:\\n + Fast 1080p30 + + ` + }, + { + name: 'output_container', + tooltip: ` + \\nEnter the output container of the new file + + \\nExample:\\n + .mp4 + + \\nExample:\\n + .mkv + + ` + }, + ] + } + +} + +module.exports.plugin = function plugin(file, librarySettings, inputs) { + + + + //Must return this object + + var response = { + + processFile: false, + preset: '', + container: '.mp4', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: '', + + } + + if (inputs.handbrake_preset === undefined + || inputs.output_container === undefined) { + + response.processFile = false + response.infoLog += "☒ Inputs not entered! \n" + return response + + } + + if (file.ffProbeData.streams[0].codec_name == 'h264') { + + + response.processFile = false + response.infoLog += "☑ File is already in h264, no need to transcode! \n" + return response + + + } else { + + var container = inputs.output_container + + if (container.charAt(0) != '.') { + container = '.' + container + } + + var response = { + + processFile: true, + preset: `-Z "${inputs.handbrake_preset}" -e nvenc_h264 --all-audio --all-subtitles`, + container: container, + handBrakeMode: true, + FFmpegMode: false, + reQueueAfter: true, + infoLog: '☒ File is not in h264, transcoding! \n' + } + + return response + + } + +} + From 4ecbf50c5243aa4c844e7d2e9e6b730ca82e39d0 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 22 Feb 2020 08:44:05 +0000 Subject: [PATCH 30/51] new --- ...in_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js diff --git a/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js b/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js new file mode 100644 index 0000000..e7e5ad2 --- /dev/null +++ b/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js @@ -0,0 +1,170 @@ +function details() { + return { + id: "Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV", + Name: "FFmpeg Tiered HEVC MKV", + Type: "Video", + Operation:"Transcode", + Description: `[Contains built-in filter] This plugin uses different Handbrake transcoding settings for 480p,576p,720p and 1080p. If files are not in hevc they will be transcoded. The output container is mkv. \n\n`, + Version: "1.01", + Link: "", + Tags:"pre-processing,h265,video only," + } +} + +function plugin(file) { + var transcode = 0; //if this var changes to 1 the file will be transcoded + +//default values that will be returned + var response = { + processFile: false, + preset: '', + container: '.mkv', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: '' + } + +//check if the file is a video, if not the function will be stopped immediately + if (file.fileMedium !== "video") { + response.processFile = false + response.infoLog += "☒File is not a video! \n" + return response + } else { + response.infoLog += "☑File is a video! \n" + } + +//check if the file is already hevc, it will not be transcoded if true and the function will be stopped immediately + if (file.ffProbeData.streams[0].codec_name == 'hevc') { + response.processFile = false + response.infoLog += "☑File is already in hevc! \n" + return response + } + +//file will be encoded if the resolution is 480p or 576p +//codec will be checked so it can be transcoded correctly + if(file.video_resolution === "480p" || file.video_resolution === "576p" ) { + if (file.video_codec_name == 'h263') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 27' + } + else if (file.video_codec_name == 'h264') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 27' + } + else if (file.video_codec_name == 'mjpeg') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 27' + } + else if (file.video_codec_name == 'mpeg1') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 27' + } + else if (file.video_codec_name == 'mpeg2') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 27' + } + else if (file.video_codec_name == 'mpeg4') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 27' + } + else if (file.video_codec_name == 'vc1') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 27' + } + else if (file.video_codec_name == 'vp8') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 27' + } + else if (file.video_codec_name == 'vp9') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 27' + } + else { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 27' + } + + transcode = 1; + } + +//file will be encoded if the resolution is 720p +//codec will be checked so it can be transcoded correctly + if(file.video_resolution === "720p") { + if (file.video_codec_name == 'h263') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 25' + } + else if (file.video_codec_name == 'h264') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 25' + } + else if (file.video_codec_name == 'mjpeg') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 25' + } + else if (file.video_codec_name == 'mpeg1') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 25' + } + else if (file.video_codec_name == 'mpeg2') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 25' + } + else if (file.video_codec_name == 'mpeg4') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 25' + } + else if (file.video_codec_name == 'vc1') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 25' + } + else if (file.video_codec_name == 'vp8') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 25' + } + else if (file.video_codec_name == 'vp9') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 25' + } + else { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 25' + } + + transcode = 1; + } + +//file will be encoded if the resolution is 1080p +//codec will be checked so it can be transcoded correctly + if(file.video_resolution === "1080p") { + if (file.video_codec_name == 'h263') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 23' + } + else if (file.video_codec_name == 'h264') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 23' + } + else if (file.video_codec_name == 'mjpeg') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 23' + } + else if (file.video_codec_name == 'mpeg1') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 23' + } + else if (file.video_codec_name == 'mpeg2') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 23' + } + else if (file.video_codec_name == 'mpeg4') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 23' + } + else if (file.video_codec_name == 'vc1') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 23' + } + else if (file.video_codec_name == 'vp8') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 23' + } + else if (file.video_codec_name == 'vp9') { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 23' + } + else { + response.preset = ',-map 0:v -map 0:s? -c:s srt -map 0:a -c copy -c:v:0 libx265 -preset fast -crf 23' + } + + transcode = 1; + } + +//check if the file is eligible for transcoding +//if true the neccessary response values will be changed + if (transcode == 1) { + response.processFile = true; + response.FFmpegMode = true + response.reQueueAfter = true; + response.infoLog += `☒File is ${file.video_resolution} but is not hevc!\n` + response.infoLog += `☒File will be transcoded!\n` + } + + return response +} + +module.exports.details = details; + +module.exports.plugin = plugin; \ No newline at end of file From 043c73fb0aeb10fa57aa21cd2d2a99553e558c0c Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 22 Feb 2020 08:48:17 +0000 Subject: [PATCH 31/51] stage --- Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js b/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js index e7e5ad2..bfee69e 100644 --- a/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js +++ b/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js @@ -1,13 +1,14 @@ function details() { return { id: "Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV", + Stage: "Pre-processing", Name: "FFmpeg Tiered HEVC MKV", Type: "Video", Operation:"Transcode", Description: `[Contains built-in filter] This plugin uses different Handbrake transcoding settings for 480p,576p,720p and 1080p. If files are not in hevc they will be transcoded. The output container is mkv. \n\n`, Version: "1.01", Link: "", - Tags:"pre-processing,h265,video only," + Tags:"pre-processing,ffmpeg,h265,video only," } } From d09aeaf68d3e354e30fc97d9e5447fc2515babc8 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 22 Feb 2020 08:53:20 +0000 Subject: [PATCH 32/51] Mode --- Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js b/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js index bfee69e..edbc270 100644 --- a/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js +++ b/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js @@ -5,7 +5,7 @@ function details() { Name: "FFmpeg Tiered HEVC MKV", Type: "Video", Operation:"Transcode", - Description: `[Contains built-in filter] This plugin uses different Handbrake transcoding settings for 480p,576p,720p and 1080p. If files are not in hevc they will be transcoded. The output container is mkv. \n\n`, + Description: `[Contains built-in filter] This plugin uses different FFmpeg transcoding settings for 480p,576p,720p and 1080p. If files are not in hevc they will be transcoded. The output container is mkv. \n\n`, Version: "1.01", Link: "", Tags:"pre-processing,ffmpeg,h265,video only," From 71c119fe562f5c74d8c5aef08c06c39d07a750a8 Mon Sep 17 00:00:00 2001 From: Jack Dallas <3620144+JackDallas@users.noreply.github.com> Date: Mon, 24 Feb 2020 15:42:48 +0000 Subject: [PATCH 33/51] Allow experimental conversion of FLAC to MP3 --- .../Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js b/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js index 5665356..ce21fad 100644 --- a/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js +++ b/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js @@ -114,7 +114,7 @@ function plugin(file, librarySettings, inputs) { if (file.ffProbeData.streams[0].codec_name != 'h264') { response.addInfo(BAD, "File is not in h264!"); - response.preset = ', -map_metadata -1 -map 0:v ' + subMap + ' -map 0:a -c:v libx264 -preset medium -c:a aac ' + subType; + response.preset = ', -map_metadata -1 -map 0:v ' + subMap + ' -map 0:a -c:v libx264 -preset medium -c:a aac -strict -2 ' + subType; response.reQueueAfter = true; response.processFile = true; response.FFmpegMode = true; @@ -125,7 +125,7 @@ function plugin(file, librarySettings, inputs) { if ((file.meta.Title != undefined) && !jsonString.includes("aac") && hasSubs) { response.addInfo(BAD, "File has title metadata and no aac and subs"); - response.preset = ', -map_metadata -1 -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a aac ' + subType; + response.preset = ', -map_metadata -1 -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a aac -strict -2 ' + subType; response.reQueueAfter = true; response.processFile = true; response.FFmpegMode = true; @@ -134,7 +134,7 @@ function plugin(file, librarySettings, inputs) { if (!jsonString.includes("aac") && hasSubs) { response.addInfo(BAD, "File has no aac track and has subs"); - response.preset = ', -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a aac ' + subType; + response.preset = ', -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a aac -strict -2 ' + subType; response.reQueueAfter = true; response.processFile = true; response.FFmpegMode = true; @@ -163,7 +163,7 @@ function plugin(file, librarySettings, inputs) { if (!jsonString.includes("aac")) { response.addInfo(BAD, "File has no aac track"); - response.preset = ', -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a aac ' + subType; + response.preset = ', -map 0:v ' + subMap + ' -map 0:a -c:v copy -c:a aac -strict -2 ' + subType; response.reQueueAfter = true; response.processFile = true; response.FFmpegMode = true; From 450ca18c1c7509abe78c41f028250bec4ab61fa1 Mon Sep 17 00:00:00 2001 From: Miasma <33153516+miasmaejuices@users.noreply.github.com> Date: Wed, 26 Feb 2020 00:53:17 +1300 Subject: [PATCH 34/51] Initial submit Specifically tuned for use with Animation, primarily Anime with English subtitles. Preserves Subtitles; Metadata; Attachments; Fonts and Styling. CRF 18 to keep as much quality as reasonable, while keeping file sizes low. Audio converted to AAC 512K for compatibility. Have used `x265-params`, as it seems the source script I used failed to do so, and the variables were not being read properly. Medium preset, need a reasonably fast CPU/Server. 10-Bit video output to help curb banding. --- ...2_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js diff --git a/Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js b/Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js new file mode 100644 index 0000000..a5cc813 --- /dev/null +++ b/Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js @@ -0,0 +1,66 @@ +function details() { + return { + id: "Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation", + Stage: "Pre-processing", + Name: "FFMPEG HQ 10-bit HEVC MKV for Animation", + Type: "Video", + Operation:"Transcode", + Description: `High Quality FFMPEG transcoding settings for Animation. Converts all audio to AAC 512K. Preserves track names, metadata and attachments/fonts. Proper use of x265-params. CRF 18. Preset medium. 10-Bit Video encoding. Skips h.265 encoded videos. The output container is mkv. \n\n`, + Version: "1.1", + Link: "", + Tags:"pre-processing,ffmpeg,h265,aac,10bit," + } +} + +function plugin(file) { + var transcode = 0; //if this var changes to 1 the file will be transcoded + +//default values that will be returned + var response = { + processFile: false, + preset: '', + container: '.mkv', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: '' + } + +//check if the file is a video, if not the function will be stopped immediately + if (file.fileMedium !== "video") { + response.processFile = false + response.infoLog += "☒File is not a video! \n" + return response + } else { + response.infoLog += "☑File is a video! \n" + } + +//check if the file is already hevc, it will not be transcoded if true and the function will be stopped immediately + if (file.ffProbeData.streams[0].codec_name == 'hevc') { + response.processFile = false + response.infoLog += "☑File is already in hevc! \n" + return response + } + +//Transcoding options + { + response.preset = ',-map 0 -c:s copy -movflags use_metadata_tags -c:a aac -b:a 512k -c:v:0 libx265 -preset medium -x265-params crf=18:tune=animation:qcomp=0.7:aq-strength=1.1 -pix_fmt yuv420p10le -f matroska' + transcode = 1; + } + +//check if the file is eligible for transcoding +//if true the neccessary response values will be changed + if (transcode == 1) { + response.processFile = true; + response.FFmpegMode = true + response.reQueueAfter = true; + response.infoLog += `☒File is ${file.video_resolution} but is not hevc!\n` + response.infoLog += `☒File will be transcoded!\n` + } + + return response +} + +module.exports.details = details; + +module.exports.plugin = plugin; From 150211916ce8b6a45ecde838061ea852b638603e Mon Sep 17 00:00:00 2001 From: Miasma <33153516+miasmaejuices@users.noreply.github.com> Date: Wed, 26 Feb 2020 01:14:54 +1300 Subject: [PATCH 35/51] Update Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js Forget to add `[Contains built-in filter]` and tag `anime` --- ...Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js b/Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js index a5cc813..cbc49a5 100644 --- a/Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js +++ b/Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js @@ -5,10 +5,10 @@ function details() { Name: "FFMPEG HQ 10-bit HEVC MKV for Animation", Type: "Video", Operation:"Transcode", - Description: `High Quality FFMPEG transcoding settings for Animation. Converts all audio to AAC 512K. Preserves track names, metadata and attachments/fonts. Proper use of x265-params. CRF 18. Preset medium. 10-Bit Video encoding. Skips h.265 encoded videos. The output container is mkv. \n\n`, + Description: `[Contains built-in filter] High Quality FFMPEG transcoding settings for Animation. Converts all audio to AAC 512K. Preserves track names, metadata and attachments/fonts. Proper use of x265-params. CRF 18. Preset medium. 10-Bit Video encoding. Skips h.265 encoded videos. The output container is mkv. \n\n`, Version: "1.1", Link: "", - Tags:"pre-processing,ffmpeg,h265,aac,10bit," + Tags:"pre-processing,ffmpeg,h265,aac,10bit,anime," } } From 73af4d9a94dcdf0898c572544e7b676683f0c39c Mon Sep 17 00:00:00 2001 From: robejo9 Date: Tue, 3 Mar 2020 00:00:49 -0600 Subject: [PATCH 36/51] Update Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js Corrected Logic to remove mjpeg streams due to error when they are processed. Corrected Logic to add mux queue size on specific audio formats due to ffmpeg bug. Changed how the Map is created in corrolation with Mjpeg fix. --- ..._d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 68 ++++++++++--------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js index d7ea4d4..fb7e986 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -6,7 +6,7 @@ function details() { Type: "Video", Operation:"Transcode", Description: `[Contains built-in filter] This plugin uses different FFMPEG NVENC transcoding settings for 480p,576p,720p,1080p and 4KUHD. If files are not in hevc they will be transcoded. The output container is mkv. \n\n`, - Version: "1.08", + Version: "1.09", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js", Tags:'pre-processing,ffmpeg,video only,nvenc h265', } @@ -18,7 +18,9 @@ function plugin(file) { var bitratetarget = 0; var bitratemax = 0; var bitratecheck = 0; - var subcli = `-c:s copy` + var subcli = `-c:s copy`; + var maxmux = ''; + var map = '-map 0' //default values that will be returned var response = { processFile: false, @@ -27,7 +29,8 @@ function plugin(file) { handBrakeMode: false, FFmpegMode: false, reQueueAfter: true, - infoLog: '' + infoLog: '', + maxmux: false, } //check if the file is a video, if not the function will be stopped immediately @@ -79,7 +82,30 @@ function plugin(file) { else if (file.video_codec_name == 'vp9') { response.preset = `-c:v vp9_cuvid` } - + +//Set Subtitle Var before adding encode cli + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + try { + if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "mov_text" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" ) { + subcli = `-c:s srt` + } + } + catch (err) { } + //mitigate TrueHD audio causing Too many packets error + try { + if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "truehd" || (file.ffProbeData.streams[i].codec_name.toLowerCase() == "dts" && file.ffProbeData.streams[i].profile.toLowerCase() == "dts-hd ma") || file.ffProbeData.streams[i].codec_name.toLowerCase() == "aac" && file.ffProbeData.streams[i].sample_rate.toLowerCase() == "44100" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" ) { + maxmux = ` -max_muxing_queue_size 9999` + } + } + catch (err) { } +//mitigate errors due to embeded pictures + try { + if ((file.ffProbeData.streams[i].codec_name.toLowerCase() == "png" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "bmp" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "mjpeg") && file.ffProbeData.streams[i].codec_type.toLowerCase() == "video" ) { + map = `-map 0:v:0 -map 0:a -map 0:s` + } + } + catch (err) { } + } //file will be encoded if the resolution is 480p or 576p //codec will be checked so it can be transcoded correctly if (file.video_resolution === "480p" || file.video_resolution === "576p" ) { @@ -92,18 +118,10 @@ function plugin(file) { bitratetarget = 1000; bitratemax = 1500; } - response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v ${bitratetarget}k -maxrate:v 1500k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy ${subcli} -dn`; + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v ${bitratetarget}k -maxrate:v 1500k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy ${subcli}${maxmux}`; transcode = 1; } -//Set Subtitle Var before adding encode cli - for (var i = 0; i < file.ffProbeData.streams.length; i++) { - try { - if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "mov_text" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" ) { - subcli = `-c:s srt` - } - } - catch (err) { } - } + //file will be encoded if the resolution is 720p //codec will be checked so it can be transcoded correctly if(file.video_resolution === "720p") { @@ -116,7 +134,7 @@ function plugin(file) { bitratetarget = 2000; bitratemax = 4000; } - response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v ${bitratetarget}k -maxrate:v ${bitratemax}k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy ${subcli} -dn`; + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v ${bitratetarget}k -maxrate:v ${bitratemax}k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy ${subcli}${maxmux}`; transcode = 1; } //file will be encoded if the resolution is 1080p @@ -131,7 +149,7 @@ function plugin(file) { bitratetarget = 2500; bitratemax = 5000; } - response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v ${bitratetarget}k -maxrate:v ${bitratemax}k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy ${subcli} -dn`; + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:V 31 -b:v ${bitratetarget}k -maxrate:v ${bitratemax}k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy ${subcli}${maxmux}`; transcode = 1; } //file will be encoded if the resolution is 4K @@ -146,25 +164,9 @@ function plugin(file) { bitratetarget = 14000; bitratemax = 20000; } - response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v ${bitratetarget}k -maxrate:v ${bitratemax}k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy -c:s copy -dn`; + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v ${bitratetarget}k -maxrate:v ${bitratemax}k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy ${subcli}${maxmux}`; transcode = 1; } - for (var i = 0; i < file.ffProbeData.streams.length; i++) { - try { - //mitigate TrueHD audio causing Too many packets error - if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "truehd" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" ) { - response.preset += ` -max_muxing_queue_size 1024` - } - } - catch (err) { } -//mitigate errors due to embeded pictures - try { - if ((file.ffProbeData.streams[i].codec_name.toLowerCase() == "png" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "bmp" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "mjpeg") && file.ffProbeData.streams[i].codec_type.toLowerCase() == "video" ) { - response.preset += ` -map -0:v:1` - } - } - catch (err) { } - } //check if the file is eligible for transcoding //if true the neccessary response values will be changed if (transcode == 1) { From c0d2c1d85b67bdef4899635c05ceb2019696c482 Mon Sep 17 00:00:00 2001 From: Jack Dallas <3620144+JackDallas@users.noreply.github.com> Date: Tue, 3 Mar 2020 17:14:38 +0000 Subject: [PATCH 37/51] Drop picture streams (mpjeg) --- Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js b/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js index ce21fad..b4b8b6e 100644 --- a/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js +++ b/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js @@ -4,7 +4,7 @@ function details() { Stage: "Pre-processing", Name: "Dallas FFmpeg h264 mp4. Video: h264/mp4, Subs: Convert to mov_text or drop, Audio: aac", Type: "Video", - Description: `This plugin transcodes into H264 with an MP4 container using the FFmpeg preset you select (slow,medium,fast,veryfast). It maintains all compatible subtitles and audio tracks. \n\n`, + Description: `This plugin transcodes into H264 with an MP4 container using the FFmpeg preset you select (slow,medium,fast,veryfast). It maintains all compatible subtitles and audio tracks. Drops picture tracks such as mjpeg\n\n`, Version: "1.00", Link: "https://github.com/JackDallas/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js", Tags:'pre-processing,ffmpeg,h264,video only,configurable', @@ -114,7 +114,7 @@ function plugin(file, librarySettings, inputs) { if (file.ffProbeData.streams[0].codec_name != 'h264') { response.addInfo(BAD, "File is not in h264!"); - response.preset = ', -map_metadata -1 -map 0:v ' + subMap + ' -map 0:a -c:v libx264 -preset medium -c:a aac -strict -2 ' + subType; + response.preset = ', -map_metadata -1 -map 0:V ' + subMap + ' -map 0:a -c:v libx264 -preset medium -c:a aac -strict -2 ' + subType; response.reQueueAfter = true; response.processFile = true; response.FFmpegMode = true; From 5735ae6759fc268eff62477a1cc59c8e74c4afd2 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Sat, 14 Mar 2020 01:00:16 +0000 Subject: [PATCH 38/51] Various Updates 1) New plugin that uses CPU to convert to H265. 2) Change to FFMPEG NVidia plugin to specifiy bitrate cutoff. 3) Fix random infolog "2" in CleanTitle 4) Update descriptive audio check in CleanAudio and CleanSubs to look for "sdh" 5) Correct OrderStreams mentioning that "Audio not first" when audio should be second. --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 59 +++++--- .../Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js | 126 ++++++++++++++++++ .../Tdarr_Plugin_MC93_Migz2CleanTitle.js | 3 +- .../Tdarr_Plugin_MC93_Migz3CleanAudio.js | 5 +- Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js | 4 +- .../Tdarr_Plugin_MC93_Migz5ConvertAudio.js | 2 +- .../Tdarr_Plugin_MC93_Migz6OrderStreams.js | 4 +- 7 files changed, 179 insertions(+), 24 deletions(-) create mode 100644 Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index 36903ce..5f056e5 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -5,9 +5,9 @@ function details() { Name: "Migz-Transcode Using Nvidia GPU & FFMPEG", Type: "Video", Operation:"Transcode", - Description: `[TESTING]Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`, - Version: "2.00", - Link: "", + Description: `Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`, + Version: "2.10", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js", Tags:'pre-processing,ffmpeg,video only,nvenc h265,configurable', Inputs: [ { @@ -20,6 +20,17 @@ function details() { mp4` + }, + { + name: 'bitrate_cutoff', + tooltip: `Specify bitrate cutoff, files with a current bitrate lower then this will not be transcoded. Rate is in kbps. Leave empty to disable. + \\nExample:\\n + 6000 + + \\nExample:\\n + 4000` + + }, ] } @@ -57,6 +68,7 @@ function plugin(file, librarySettings, inputs) { var bitrateSettings = "" var filesize = (file.file_size / 1000) + var currentBitrate = ~~(file.file_size / (duration * 0.0075)) var targetBitrate = ~~((file.file_size / (duration * 0.0075)) / 2) var minimumBitrate = ~~(targetBitrate * 0.7) var maximumBitrate = ~~(targetBitrate * 1.3) @@ -67,19 +79,36 @@ function plugin(file, librarySettings, inputs) { return response } - if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container == inputs.container) { - response.processFile = false - response.infoLog += `☑File is already in ${inputs.container} & hevc. \n` - return response + if (inputs.bitrate_cutoff != "") { + if (currentBitrate <= inputs.bitrate_cutoff) { + if (file.container == inputs.container) { + response.processFile = false + response.infoLog += `☑Current bitrate is below configured bitrate cutoff of ${inputs.bitrate_cutoff} & file container is already ${inputs.container}. Nothing to do, skipping. \n` + return response + } else { + response.processFile = true + response.preset += `, -c copy` + response.infoLog += `☒Current bitrate is below configured bitrate cutoff of ${inputs.bitrate_cutoff} but is not in correct container. Remuxing to ${inputs.container} but not transcoding. \n` + return response + } } - - if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container != '${inputs.container}') { - response.infoLog += `☒File is hevc but is not in ${inputs.container} container. Remuxing. \n` - response.preset = ', -map 0 -c copy' - response.processFile = true; - return response - } - + } + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") { + if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container == inputs.container) { + response.processFile = false + response.infoLog += `☑File is already in ${inputs.container} & hevc. \n` + return response + } + if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container != '${inputs.container}') { + response.infoLog += `☒File is hevc but is not in ${inputs.container} container. Remuxing. \n` + response.preset = ', -map 0 -c copy' + response.processFile = true; + return response + } + } + } + bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k` response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n` diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js new file mode 100644 index 0000000..eacbe10 --- /dev/null +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -0,0 +1,126 @@ +function details() { + return { + id: "Tdarr_Plugin_MC93_Migz1FFMPEG_CPU", + Stage: "Pre-processing", + Name: "Migz-Transcode Using CPU & FFMPEG", + Type: "Video", + Operation:"Transcode", + Description: `[TESTING]Files will be transcoded using CPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. \n\n`, + Version: "1.0", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js", + Tags:'pre-processing,ffmpeg,video only,configurable', + Inputs: [ + { + name: 'container', + tooltip: `Specify output container of file, ensure that all stream types you may have are supported by your chosen container. mkv is recommended. + \\nExample:\\n + mkv + + \\nExample:\\n + mp4` + + + }, + { + name: 'bitrate_cutoff', + tooltip: `Specify bitrate cutoff, files with a current bitrate lower then this will not be transcoded. Rate is in kbps. Leave empty to disable. + \\nExample:\\n + 6000 + + \\nExample:\\n + 4000` + + + }, + ] + } +} + +function plugin(file, librarySettings, inputs) { + var response = { + processFile: false, + preset: '', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: '' + } + + if (inputs.container == "") { + response.infoLog += "☒Container has not been configured within plugin settings, please configure required options. Skipping this plugin. \n" + response.processFile = false + return response + } else { + response.container = '.' + inputs.container + } + + if (file.fileMedium !== "video") { + response.processFile = false + response.infoLog += "☒File is not a video. \n" + return response + } + + if (typeof file.meta.Duration != 'undefined') { + var duration = (file.meta.Duration * 0.0166667) + } else { + var duration = (file.ffProbeData.streams[0].duration * 0.0166667) + } + + var bitrateSettings = "" + var filesize = (file.file_size / 1000) + var currentBitrate = ~~(file.file_size / (duration * 0.0075)) + var targetBitrate = ~~((file.file_size / (duration * 0.0075)) / 2) + var minimumBitrate = ~~(targetBitrate * 0.7) + var maximumBitrate = ~~(targetBitrate * 1.3) + + if (targetBitrate == "0") { + response.processFile = false + response.infoLog += "☒Target bitrate could not be calculated. Skipping this plugin. \n" + return response + } + + if (inputs.bitrate_cutoff != "") { + if (currentBitrate <= inputs.bitrate_cutoff) { + if (file.container == inputs.container) { + response.processFile = false + response.infoLog += `☑Current bitrate is below configured bitrate cutoff of ${inputs.bitrate_cutoff} & file container is already ${inputs.container}. Nothing to do, skipping. \n` + return response + } else { + response.processFile = true + response.preset += `, -c copy` + response.infoLog += `☒Current bitrate is below configured bitrate cutoff of ${inputs.bitrate_cutoff} but is not in correct container. Remuxing to ${inputs.container} but not transcoding. \n` + return response + } + } + } + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") { + if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container == inputs.container) { + response.processFile = false + response.infoLog += `☑File is already in ${inputs.container} & hevc. \n` + return response + } + if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container != '${inputs.container}') { + response.infoLog += `☒File is hevc but is not in ${inputs.container} container. Remuxing. \n` + response.preset = ', -map 0 -c copy' + response.processFile = true; + return response + } + } + } + + bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k` + response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n` + + if (inputs.container == "mkv") { + extraArguments = "-map -0:d " + } + + response.preset += `,-map 0 -c:v libx265 ${bitrateSettings} -bufsize 2M -spatial_aq:v 1 -c:a copy -c:s copy -max_muxing_queue_size 4096 ${extraArguments}` + response.processFile = true + response.infoLog += `☒File is not hevc. Transcoding. \n` + return response +} + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js index 3c86feb..8152c82 100644 --- a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -7,7 +7,7 @@ function details() { Operation: "Clean", Description: `[TESTING]This plugin removes video title metadata if it exists. \n\n`, Version: "1.10", - Link: "", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js", Tags:'pre-processing,ffmpeg,video only', } } @@ -48,7 +48,6 @@ function plugin(file) { try { if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') { ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" ` - response.infoLog += "2" convert = true } } catch (err) { } diff --git a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js index 8d22042..2c2c0b4 100644 --- a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js @@ -7,7 +7,7 @@ function details() { Operation: "Clean", Description: `[TESTING]This plugin keeps only specified language audio tracks & can tags those that have an unknown language. \n\n`, Version: "2.00", - Link: "", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js", Tags:'pre-processing,ffmpeg,audio only,configurable', Inputs: [ { @@ -38,6 +38,7 @@ function details() { eng \\nExample:\\n + por ` }, { @@ -104,7 +105,7 @@ function plugin(file, librarySettings, inputs) { } catch (err) { } try { - if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description'))) { + if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('sdh'))) { audioStreamsRemoved++ ffmpegCommandInsert += `-map -0:a:${audioIdx} ` response.infoLog += `☒Audio stream detected as being Commentary or Description, removing. Audio stream 0:a:${audioIdx} - ${file.ffProbeData.streams[i].tags.title}. \n` diff --git a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js index 2ef66a3..1a92f97 100644 --- a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js +++ b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js @@ -7,7 +7,7 @@ function details() { Operation: "Clean", Description: `[TESTING] This plugin keeps only specified language subtitle tracks & can tag those that have an unknown language. \n\n`, Version: "2.00", - Link: "", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js", Tags:'pre-processing,ffmpeg,subtitle only,configurable', Inputs: [ { @@ -86,7 +86,7 @@ function plugin(file, librarySettings, inputs) { } catch (err) { } try { - if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description'))) { + if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('sdh'))) { ffmpegCommandInsert += `-map -0:s:${subtitleIdx} ` response.infoLog += `☒Subtitle stream detected as being Commentary or Description, removing. Subtitle stream 0:s:${SubtitleIdx} - ${file.ffProbeData.streams[i].tags.title}. \n` convert = true diff --git a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js index b1e6b16..89d8552 100644 --- a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js @@ -117,4 +117,4 @@ function plugin(file, librarySettings, inputs) { } module.exports.details = details; -module.exports.plugin = plugin; +module.exports.plugin = plugin; \ No newline at end of file diff --git a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js index 829d4ae..4ae880c 100644 --- a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js +++ b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js @@ -7,7 +7,7 @@ function details() { Operation: "Organize", Description: `[TESTING]Organizes streams into Video first, then Audio (2ch, 6ch, 8ch) and finally Subtitles. \n\n`, Version: "1.00", - Link: "", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js", Tags:'pre-processing,ffmpeg,' } } @@ -44,7 +44,7 @@ function plugin(file) { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { if (subtitleIdx != "0") { convert = true - response.infoLog += "☒ Audio not first. \n" + response.infoLog += "☒ Audio not second. \n" } audioIdx++ if (file.ffProbeData.streams[i].channels == "2") { From a05d856fe257ddfcca852b35619b19d4bcf0ea7c Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Thu, 19 Mar 2020 19:00:47 +0000 Subject: [PATCH 39/51] Update Tag Updated "Tag" to specify H265 --- .../Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js index eacbe10..8d65edc 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -8,34 +8,34 @@ function details() { Description: `[TESTING]Files will be transcoded using CPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. \n\n`, Version: "1.0", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js", - Tags:'pre-processing,ffmpeg,video only,configurable', + Tags:'pre-processing,ffmpeg,video only,configurable,h265', Inputs: [ { name: 'container', tooltip: `Specify output container of file, ensure that all stream types you may have are supported by your chosen container. mkv is recommended. \\nExample:\\n mkv - + \\nExample:\\n mp4` - - + + }, { name: 'bitrate_cutoff', tooltip: `Specify bitrate cutoff, files with a current bitrate lower then this will not be transcoded. Rate is in kbps. Leave empty to disable. \\nExample:\\n 6000 - + \\nExample:\\n 4000` - - + + }, ] } } - + function plugin(file, librarySettings, inputs) { var response = { processFile: false, @@ -53,7 +53,7 @@ function plugin(file, librarySettings, inputs) { } else { response.container = '.' + inputs.container } - + if (file.fileMedium !== "video") { response.processFile = false response.infoLog += "☒File is not a video. \n" @@ -72,7 +72,7 @@ function plugin(file, librarySettings, inputs) { var targetBitrate = ~~((file.file_size / (duration * 0.0075)) / 2) var minimumBitrate = ~~(targetBitrate * 0.7) var maximumBitrate = ~~(targetBitrate * 1.3) - + if (targetBitrate == "0") { response.processFile = false response.infoLog += "☒Target bitrate could not be calculated. Skipping this plugin. \n" @@ -111,16 +111,16 @@ function plugin(file, librarySettings, inputs) { bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k` response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n` - + if (inputs.container == "mkv") { extraArguments = "-map -0:d " } - + response.preset += `,-map 0 -c:v libx265 ${bitrateSettings} -bufsize 2M -spatial_aq:v 1 -c:a copy -c:s copy -max_muxing_queue_size 4096 ${extraArguments}` response.processFile = true response.infoLog += `☒File is not hevc. Transcoding. \n` return response } - + module.exports.details = details; module.exports.plugin = plugin; From ccd4c79228ecba11d568f4784ea38ede1cd94f05 Mon Sep 17 00:00:00 2001 From: Guillaume Taquet Gasperini Date: Fri, 20 Mar 2020 17:09:15 +0100 Subject: [PATCH 40/51] Fix #54 --- Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js b/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js index 5379f59..2c79048 100644 --- a/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js +++ b/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js @@ -62,7 +62,7 @@ function plugin(file) { try { - if ( file.ffProbeData.streams[1].channels >= 6 && file.ffProbeData.streams[i].codec_name !== 'ac3' && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" ) { + if ( file.ffProbeData.streams[i].channels >= 6 && file.ffProbeData.streams[i].codec_name !== 'ac3' && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" ) { ffmpegCommandInsert += ` -c:a:${audioIdx} ac3 ` hasnonAC3SurroundTrack = true From d07d8811f838a5a0f33fc9adcfff60f48b312380 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Sun, 22 Mar 2020 11:46:36 +0000 Subject: [PATCH 41/51] Update: Migz2CleanTitle Updated to also look for title metadata in audio/subtitles and remove if applicable. --- .../Tdarr_Plugin_MC93_Migz2CleanTitle.js | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js index 8152c82..86834e4 100644 --- a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -5,10 +5,10 @@ function details() { Name: "Migz-Clean title metadata", Type: "Video", Operation: "Clean", - Description: `[TESTING]This plugin removes video title metadata if it exists. \n\n`, + Description: `[TESTING]This plugin removes title metadata from video/audio/subtitles, if it exists. \n\n`, Version: "1.10", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js", - Tags:'pre-processing,ffmpeg,video only', + Tags:'pre-processing,ffmpeg', } } @@ -26,6 +26,8 @@ function plugin(file) { var ffmpegCommandInsert = '' var videoIdx = 0 + var audioIdx = 0 + var subtitleIdx = 0 var convert = false if (file.fileMedium !== "video") { @@ -53,14 +55,32 @@ function plugin(file) { } catch (err) { } videoIdx++ } + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { + try { + if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') { + ffmpegCommandInsert += ` -metadata:s:a:${audioIdx} title="" ` + convert = true + } + } catch (err) { } + audioIdx++ + } + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") { + try { + if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') { + ffmpegCommandInsert += ` -metadata:s:s:${subtitleIdx} title="" ` + convert = true + } + } catch (err) { } + subtitleIdx++ + } } - if(convert == true){ + if (convert == true){ response.infoLog += "☒File has title metadata \n" response.preset = `,${ffmpegCommandInsert} -c copy` response.reQueueAfter = true; response.processFile = true; - }else{ + } else { response.infoLog += "☑File has no title metadata \n" } return response From 1ea2ebc2fe426722144ea6d54a6a1af51f7c2540 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Sun, 22 Mar 2020 12:20:30 +0000 Subject: [PATCH 42/51] Update: Migz Plugins Update all plugins to remove "Testing" as they've now been in use for a while with no issues noticed. --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js | 2 +- Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js | 2 +- Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js | 2 +- Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js | 2 +- Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js | 2 +- Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js index 8d65edc..c4f4fda 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -5,7 +5,7 @@ function details() { Name: "Migz-Transcode Using CPU & FFMPEG", Type: "Video", Operation:"Transcode", - Description: `[TESTING]Files will be transcoded using CPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. \n\n`, + Description: `Files will be transcoded using CPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. \n\n`, Version: "1.0", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js", Tags:'pre-processing,ffmpeg,video only,configurable,h265', diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js index 86834e4..98388e7 100644 --- a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -5,7 +5,7 @@ function details() { Name: "Migz-Clean title metadata", Type: "Video", Operation: "Clean", - Description: `[TESTING]This plugin removes title metadata from video/audio/subtitles, if it exists. \n\n`, + Description: `This plugin removes title metadata from video/audio/subtitles, if it exists. \n\n`, Version: "1.10", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js", Tags:'pre-processing,ffmpeg', diff --git a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js index 2c2c0b4..b869a85 100644 --- a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js @@ -5,7 +5,7 @@ function details() { Name: "Migz-Clean audio streams", Type: "Audio", Operation: "Clean", - Description: `[TESTING]This plugin keeps only specified language audio tracks & can tags those that have an unknown language. \n\n`, + Description: `This plugin keeps only specified language audio tracks & can tags those that have an unknown language. \n\n`, Version: "2.00", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js", Tags:'pre-processing,ffmpeg,audio only,configurable', diff --git a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js index 1a92f97..7fa687d 100644 --- a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js +++ b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js @@ -5,7 +5,7 @@ function details() { Name: "Migz-Clean subtitle streams", Type: "subtitless", Operation: "Clean", - Description: `[TESTING] This plugin keeps only specified language subtitle tracks & can tag those that have an unknown language. \n\n`, + Description: `This plugin keeps only specified language subtitle tracks & can tag those that have an unknown language. \n\n`, Version: "2.00", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js", Tags:'pre-processing,ffmpeg,subtitle only,configurable', diff --git a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js index 89d8552..f204ec7 100644 --- a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js @@ -5,7 +5,7 @@ function details() { Name: "Migz-Convert audio streams", Type: "Audio", Operation: "Transcode", - Description: `[TESTING]This plugin can convert any 2.0 audio track/s to AAC and can create downmixed audio tracks. \n\n`, + Description: `This plugin can convert any 2.0 audio track/s to AAC and can create downmixed audio tracks. \n\n`, Version: "2.00", Link: "", Tags:'pre-processing,ffmpeg,audio only,configurable', diff --git a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js index 4ae880c..98441cb 100644 --- a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js +++ b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js @@ -5,7 +5,7 @@ function details() { Name: "Migz-Organize Streams", Type: "Streams", Operation: "Organize", - Description: `[TESTING]Organizes streams into Video first, then Audio (2ch, 6ch, 8ch) and finally Subtitles. \n\n`, + Description: `Organizes streams into Video first, then Audio (2ch, 6ch, 8ch) and finally Subtitles. \n\n`, Version: "1.00", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js", Tags:'pre-processing,ffmpeg,' From 2e37ed84bf0a471990cbdf88d3828dd3739b2f42 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Mon, 23 Mar 2020 10:56:26 +0000 Subject: [PATCH 43/51] Update: Migz2CleanTitle Updated the way that audio/subtitles decide if the title is junk or not. Fixes issue with conversion loop when used with my CleanAudio plugin. --- .../Tdarr_Plugin_MC93_Migz2CleanTitle.js | 92 +++++++++++-------- 1 file changed, 54 insertions(+), 38 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js index 98388e7..07fc898 100644 --- a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -5,14 +5,34 @@ function details() { Name: "Migz-Clean title metadata", Type: "Video", Operation: "Clean", - Description: `This plugin removes title metadata from video/audio/subtitles, if it exists. \n\n`, - Version: "1.10", + Description: `This plugin removes title metadata from video/audio/subtitles, if it exists. Video checking is mandatory, audio and subtitles are optional.\n\n`, + Version: "1.20", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js", - Tags:'pre-processing,ffmpeg', + Tags:'pre-processing,ffmpeg,configurable', + Inputs: [ + { + name: 'clean_audio', + tooltip: `Specify if audio titles should be checked & cleaned. Optional. + \\nExample:\\n + true + + \\nExample:\\n + false` + }, + { + name: 'clean_subtitles', + tooltip: `Specify if subtitle titles should be checked & cleaned. Optional. + \\nExample:\\n + true + + \\nExample:\\n + false` + }, + ] } } -function plugin(file) { +function plugin(file, librarySettings, inputs) { var response = { processFile : false, preset : '', @@ -23,7 +43,7 @@ function plugin(file) { infoLog : '', } - + var ffmpegCommandInsert = '' var videoIdx = 0 var audioIdx = 0 @@ -36,47 +56,43 @@ function plugin(file) { response.processFile = false; return response } - - try { - if (typeof file.meta.Title != 'undefined' ){ + + if (typeof file.meta.Title != 'undefined') try { ffmpegCommandInsert += ` -metadata title="" ` - response.infoLog += "1" convert = true - } - } catch (err) { } - - for (var i = 0; i < file.ffProbeData.streams.length; i++) { + } catch (err) { } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) try { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") { - try { - if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') { - ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" ` - convert = true - } - } catch (err) { } + if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') { + response.infoLog += `☒Video stream title is not empty, most likely junk metadata. Removing title from stream ${i} \n` + ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" ` + convert = true + } videoIdx++ } - if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { - try { - if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') { - ffmpegCommandInsert += ` -metadata:s:a:${audioIdx} title="" ` - convert = true - } - } catch (err) { } + + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && inputs.clean_audio.toLowerCase() == "true") { + if (file.ffProbeData.streams[i].tags.title.split('.').length-1 > 3) { + response.infoLog += `☒More then 3 full stops detected in subtitle title, likely to be junk metadata. Removing title from stream ${i} \n` + ffmpegCommandInsert += ` -metadata:s:a:${audioIdx} title="" ` + convert = true + } audioIdx++ } - if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") { - try { - if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') { - ffmpegCommandInsert += ` -metadata:s:s:${subtitleIdx} title="" ` - convert = true - } - } catch (err) { } + + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && inputs.clean_subtitles.toLowerCase() == "true") { + if (file.ffProbeData.streams[i].tags.title.split('.').length-1 > 3) { + response.infoLog += `☒More then 3 full stops detected in subtitle title, likely to be junk metadata. Removing title from stream ${i} \n` + ffmpegCommandInsert += ` -metadata:s:s:${subtitleIdx} title="" ` + convert = true + } subtitleIdx++ } - } - - if (convert == true){ - response.infoLog += "☒File has title metadata \n" + } catch (err) { } + + if (convert == true) { + response.infoLog += "☒File has title metadata. Removing \n" response.preset = `,${ffmpegCommandInsert} -c copy` response.reQueueAfter = true; response.processFile = true; @@ -87,4 +103,4 @@ function plugin(file) { } module.exports.details = details; -module.exports.plugin = plugin; \ No newline at end of file +module.exports.plugin = plugin; From f9124c2368b1f1023f49b61fb38de2cdfa168677 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Mon, 23 Mar 2020 12:40:16 +0000 Subject: [PATCH 44/51] Update: MigzPlugins Update to both FFMPEG plugins to fix issue with data streams not being dropped for mkv in certain circumstances. Would cause plugin to fail. --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 12 +++++++----- Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js | 11 ++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index 5f056e5..e4a24e7 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -53,6 +53,10 @@ function plugin(file, librarySettings, inputs) { } else { response.container = '.' + inputs.container } + + if (inputs.container == "mkv") { + extraArguments = "-map -0:d " + } if (file.fileMedium !== "video") { response.processFile = false @@ -73,6 +77,7 @@ function plugin(file, librarySettings, inputs) { var minimumBitrate = ~~(targetBitrate * 0.7) var maximumBitrate = ~~(targetBitrate * 1.3) + if (targetBitrate == "0") { response.processFile = false response.infoLog += "☒Target bitrate could not be calculated. Skipping this plugin. \n" @@ -87,7 +92,7 @@ function plugin(file, librarySettings, inputs) { return response } else { response.processFile = true - response.preset += `, -c copy` + response.preset += `, -c copy ${extraArguments}` response.infoLog += `☒Current bitrate is below configured bitrate cutoff of ${inputs.bitrate_cutoff} but is not in correct container. Remuxing to ${inputs.container} but not transcoding. \n` return response } @@ -102,7 +107,7 @@ function plugin(file, librarySettings, inputs) { } if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container != '${inputs.container}') { response.infoLog += `☒File is hevc but is not in ${inputs.container} container. Remuxing. \n` - response.preset = ', -map 0 -c copy' + response.preset = `, -map 0 -c copy ${extraArguments}` response.processFile = true; return response } @@ -140,9 +145,6 @@ function plugin(file, librarySettings, inputs) { response.preset = `-c:v vp9_cuvid` } - if (inputs.container == "mkv") { - extraArguments = "-map -0:d " - } response.preset += `,-map 0 -c:v hevc_nvenc -rc:v vbr_hq ${bitrateSettings} -bufsize 2M -spatial_aq:v 1 -c:a copy -c:s copy -max_muxing_queue_size 4096 ${extraArguments}` response.processFile = true diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js index c4f4fda..fad9d24 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -53,6 +53,10 @@ function plugin(file, librarySettings, inputs) { } else { response.container = '.' + inputs.container } + + if (inputs.container == "mkv") { + extraArguments = "-map -0:d " + } if (file.fileMedium !== "video") { response.processFile = false @@ -87,7 +91,7 @@ function plugin(file, librarySettings, inputs) { return response } else { response.processFile = true - response.preset += `, -c copy` + response.preset += `, -c copy ${extraArguments}` response.infoLog += `☒Current bitrate is below configured bitrate cutoff of ${inputs.bitrate_cutoff} but is not in correct container. Remuxing to ${inputs.container} but not transcoding. \n` return response } @@ -102,7 +106,7 @@ function plugin(file, librarySettings, inputs) { } if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container != '${inputs.container}') { response.infoLog += `☒File is hevc but is not in ${inputs.container} container. Remuxing. \n` - response.preset = ', -map 0 -c copy' + response.preset = `, -map 0 -c copy ${extraArguments}` response.processFile = true; return response } @@ -112,9 +116,6 @@ function plugin(file, librarySettings, inputs) { bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k` response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n` - if (inputs.container == "mkv") { - extraArguments = "-map -0:d " - } response.preset += `,-map 0 -c:v libx265 ${bitrateSettings} -bufsize 2M -spatial_aq:v 1 -c:a copy -c:s copy -max_muxing_queue_size 4096 ${extraArguments}` response.processFile = true From 37246dd506490ba92a28dfc7d180949660c2f2d6 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Wed, 25 Mar 2020 22:10:28 +0000 Subject: [PATCH 45/51] Update: MigzPlguin Update to Migz1FFMPEG plugins to deal with mjpeg streams. Detect and drop from being mapped. --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 10 ++++++++-- Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index e4a24e7..05aac9b 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -6,7 +6,7 @@ function details() { Type: "Video", Operation:"Transcode", Description: `Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`, - Version: "2.10", + Version: "2.20", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js", Tags:'pre-processing,ffmpeg,video only,nvenc h265,configurable', Inputs: [ @@ -55,7 +55,7 @@ function plugin(file, librarySettings, inputs) { } if (inputs.container == "mkv") { - extraArguments = "-map -0:d " + extraArguments += "-map -0:d " } if (file.fileMedium !== "video") { @@ -70,6 +70,8 @@ function plugin(file, librarySettings, inputs) { var duration = (file.ffProbeData.streams[0].duration * 0.0166667) } + var videoIdx = 0 + var extraArguments = "" var bitrateSettings = "" var filesize = (file.file_size / 1000) var currentBitrate = ~~(file.file_size / (duration * 0.0075)) @@ -100,6 +102,9 @@ function plugin(file, librarySettings, inputs) { } for (var i = 0; i < file.ffProbeData.streams.length; i++) { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") { + if (file.ffProbeData.streams[i].codec_name == 'mjpeg') { + extraArguments += `-map -v:${videoIdx} ` + } if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container == inputs.container) { response.processFile = false response.infoLog += `☑File is already in ${inputs.container} & hevc. \n` @@ -111,6 +116,7 @@ function plugin(file, librarySettings, inputs) { response.processFile = true; return response } + videoIdx++ } } diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js index fad9d24..012825a 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -6,7 +6,7 @@ function details() { Type: "Video", Operation:"Transcode", Description: `Files will be transcoded using CPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. \n\n`, - Version: "1.0", + Version: "1.1", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js", Tags:'pre-processing,ffmpeg,video only,configurable,h265', Inputs: [ @@ -55,7 +55,7 @@ function plugin(file, librarySettings, inputs) { } if (inputs.container == "mkv") { - extraArguments = "-map -0:d " + extraArguments += "-map -0:d " } if (file.fileMedium !== "video") { @@ -70,6 +70,8 @@ function plugin(file, librarySettings, inputs) { var duration = (file.ffProbeData.streams[0].duration * 0.0166667) } + var videoIdx = 0 + var extraArguments = "" var bitrateSettings = "" var filesize = (file.file_size / 1000) var currentBitrate = ~~(file.file_size / (duration * 0.0075)) @@ -99,6 +101,9 @@ function plugin(file, librarySettings, inputs) { } for (var i = 0; i < file.ffProbeData.streams.length; i++) { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") { + if (file.ffProbeData.streams[i].codec_name == 'mjpeg') { + extraArguments += `-map -v:${videoIdx} ` + } if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container == inputs.container) { response.processFile = false response.infoLog += `☑File is already in ${inputs.container} & hevc. \n` @@ -110,6 +115,7 @@ function plugin(file, librarySettings, inputs) { response.processFile = true; return response } + videoIdx++ } } From 86835f6682b717c14bcbd275a464cf1ab7ff36df Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 28 Mar 2020 11:57:45 +0000 Subject: [PATCH 46/51] Update transcodeKeepOneAudioStream.js --- methods/library/actions/transcodeKeepOneAudioStream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/methods/library/actions/transcodeKeepOneAudioStream.js b/methods/library/actions/transcodeKeepOneAudioStream.js index 8e17882..4feece5 100644 --- a/methods/library/actions/transcodeKeepOneAudioStream.js +++ b/methods/library/actions/transcodeKeepOneAudioStream.js @@ -60,7 +60,7 @@ module.exports = function transcodeKeepOneAudioStream(file, audioEncoder, langTa try { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && i !== audioStreamToKeep) { - ffmpegCommandInsert += ` -map -0:a:${i}` + ffmpegCommandInsert += ` -map -0:${i}` } } catch (err) { } From b22c576c84b2082d524a2d177515a9e83d948e50 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Sun, 29 Mar 2020 17:28:20 +0100 Subject: [PATCH 47/51] Update: MigzPlugins Updated all plugins to include "-max_muxing_queue_size 4096" --- .../Tdarr_Plugin_MC93_Migz2CleanTitle.js | 6 ++--- .../Tdarr_Plugin_MC93_Migz3CleanAudio.js | 26 +++++++++---------- Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js | 18 ++++++------- .../Tdarr_Plugin_MC93_Migz5ConvertAudio.js | 26 +++++++++---------- .../Tdarr_Plugin_MC93_Migz6OrderStreams.js | 22 ++++++++-------- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js index 07fc898..12a7aa6 100644 --- a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -71,7 +71,7 @@ function plugin(file, librarySettings, inputs) { } videoIdx++ } - + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && inputs.clean_audio.toLowerCase() == "true") { if (file.ffProbeData.streams[i].tags.title.split('.').length-1 > 3) { response.infoLog += `☒More then 3 full stops detected in subtitle title, likely to be junk metadata. Removing title from stream ${i} \n` @@ -80,7 +80,7 @@ function plugin(file, librarySettings, inputs) { } audioIdx++ } - + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && inputs.clean_subtitles.toLowerCase() == "true") { if (file.ffProbeData.streams[i].tags.title.split('.').length-1 > 3) { response.infoLog += `☒More then 3 full stops detected in subtitle title, likely to be junk metadata. Removing title from stream ${i} \n` @@ -93,7 +93,7 @@ function plugin(file, librarySettings, inputs) { if (convert == true) { response.infoLog += "☒File has title metadata. Removing \n" - response.preset = `,${ffmpegCommandInsert} -c copy` + response.preset = `,${ffmpegCommandInsert} -c copy -max_muxing_queue_size 4096` response.reQueueAfter = true; response.processFile = true; } else { diff --git a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js index b869a85..41bcfc3 100644 --- a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js @@ -15,10 +15,10 @@ function details() { tooltip: `Specify language tag/s here for the audio tracks you'd like to keep, recommended to keep "und" as this stands for undertermined, some files may not have the language specified. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes \\nExample:\\n eng - + \\nExample:\\n eng,und - + \\nExample:\\n eng,und,jap` }, @@ -27,7 +27,7 @@ function details() { tooltip: `Specify if audio tracks that contain commentary/description should be removed. \\nExample:\\n true - + \\nExample:\\n false` }, @@ -36,7 +36,7 @@ function details() { tooltip: `Specify a single language for audio tracks with no language or unknown language to be tagged with, leave empty to disable, you must have "und" in your list of languages to keep for this to function. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes \\nExample:\\n eng - + \\nExample:\\n por ` @@ -46,7 +46,7 @@ function details() { tooltip: `Specify audio tracks with no title to be tagged with the number of channels they contain. Do NOT use this with mp4, as mp4 does not support title tags. \\nExample:\\n true - + \\nExample:\\n false` }, @@ -70,14 +70,14 @@ function plugin(file, librarySettings, inputs) { response.infoLog += "☒File is not video \n" response.processFile = false; return response - } - + } + if (inputs.language == "") { response.infoLog += "☒Language/s keep have not been configured within plugin settings, please configure required options. Skipping this plugin. \n" response.processFile = false; return response - } - + } + var language = inputs.language.split(",") var ffmpegCommandInsert = '' var convert = false @@ -106,7 +106,7 @@ function plugin(file, librarySettings, inputs) { try { if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('sdh'))) { - audioStreamsRemoved++ + audioStreamsRemoved++ ffmpegCommandInsert += `-map -0:a:${audioIdx} ` response.infoLog += `☒Audio stream detected as being Commentary or Description, removing. Audio stream 0:a:${audioIdx} - ${file.ffProbeData.streams[i].tags.title}. \n` convert = true @@ -120,7 +120,7 @@ function plugin(file, librarySettings, inputs) { response.infoLog += `☒Audio stream detected as having unknown language tagged, tagging as ${inputs.tag_language}. \n` convert = true } - + if (typeof file.ffProbeData.streams[i].tags.language === 'undefined' && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { ffmpegCommandInsert += `-metadata:s:a:${audioIdx} language=${inputs.tag_language} ` response.infoLog += `☒Audio stream detected as having no language tagged, tagging as ${inputs.tag_language}. \n` @@ -148,7 +148,7 @@ function plugin(file, librarySettings, inputs) { } } } catch (err) { } - + } if (audioStreamsRemoved == audioStreamCount) { @@ -159,7 +159,7 @@ function plugin(file, librarySettings, inputs) { if (convert === true && (audioStreamsRemoved != audioStreamCount)) { response.processFile = true - response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy` + response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy -max_muxing_queue_size 4096` response.container = '.' + file.container response.reQueueAfter = true } else { diff --git a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js index 7fa687d..3183e49 100644 --- a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js +++ b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js @@ -15,7 +15,7 @@ function details() { tooltip: `Specify language tag/s here for the subtitle tracks you'd like to keep. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes \\nExample:\\n eng - + \\nExample:\\n eng,jap` }, @@ -24,7 +24,7 @@ function details() { tooltip: `Specify if subtitle tracks that contain commentary/description should be removed. \\nExample:\\n true - + \\nExample:\\n false` }, @@ -33,7 +33,7 @@ function details() { tooltip: `Specify a single language for subtitle tracks with no language or unknown language to be tagged with, leave empty to disable. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes \\nExample:\\n eng - + \\nExample:\\n por` }, @@ -58,13 +58,13 @@ function plugin(file, librarySettings, inputs) { response.processFile = false; return response } - + if (inputs.language == "") { response.infoLog += "☒Language/s keep have not been configured within plugin settings, please configure required options. Skipping this plugin. \n" response.processFile = false; return response - } - + } + var language = inputs.language.split(",") var ffmpegCommandInsert = '' var subtitleIdx = -1 @@ -84,7 +84,7 @@ function plugin(file, librarySettings, inputs) { convert = true } } catch (err) { } - + try { if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('sdh'))) { ffmpegCommandInsert += `-map -0:s:${subtitleIdx} ` @@ -102,7 +102,7 @@ function plugin(file, librarySettings, inputs) { } } } catch (err) { } - + try { if (typeof file.ffProbeData.streams[i].tags.language == 'undefined' && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") { ffmpegCommandInsert += `-metadata:s:s:${subtitleIdx} language=${inputs.tag_title} ` @@ -113,7 +113,7 @@ function plugin(file, librarySettings, inputs) { } if (convert === true ) { response.processFile = true; - response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy` + response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy -max_muxing_queue_size 4096` response.container = '.' + file.container response.reQueueAfter = true; } else { diff --git a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js index f204ec7..4950a49 100644 --- a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js @@ -15,7 +15,7 @@ function details() { tooltip: `Specify if any 2.0 audio tracks should be converted to aac for maximum compatability with devices. \\nExample:\\n true - + \\nExample:\\n false` }, @@ -24,7 +24,7 @@ function details() { tooltip: `Specify if downmixing should be used to create extra audio tracks. I.e if you have an 8ch but no 2ch or 6ch, create the missing audio tracks from the 8 ch. Likewise if you only have 6ch, create the missing 2ch from it. \\nExample:\\n true - + \\nExample:\\n false` }, @@ -48,8 +48,8 @@ function plugin(file, librarySettings, inputs) { response.infoLog += "☒File is not video. \n" response.processFile = false; return response - } - + } + if (inputs.aac_stereo == "" && inputs.downmix == "") { response.infoLog += "☒Neither aac_stereo or downmix options have been configured within plugin settings, please configure required options. Skipping this plugin. \n" response.processFile = false @@ -68,22 +68,22 @@ function plugin(file, librarySettings, inputs) { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { if (file.ffProbeData.streams[i].channels == "2") { has2Channel = true - } + } if (file.ffProbeData.streams[i].channels == "6") { has6Channel = true - } + } if (file.ffProbeData.streams[i].channels == "8") { has8Channel = true - } + } } } catch (err) { } } - + for (var i = 0; i < file.ffProbeData.streams.length; i++) { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { if (inputs.downmix.toLowerCase() == "true") { if (has8Channel == true && has6Channel == false && file.ffProbeData.streams[i].channels == "8") { - ffmpegCommandInsert += `-map 0:${i} -c:a:${audioIdx} ac3 -ac 6 -metadata:s:a:${audioIdx} title="5.1 " ` + ffmpegCommandInsert += `-map 0:${i} -c:a:${audioIdx} ac3 -ac 6 -metadata:s:a:${audioIdx} title="5.1 " ` response.infoLog += "☒Audio track is 8 channel, no 6 channel exists. Creating 2 channel from 6 channel. \n" convert = true } @@ -102,19 +102,19 @@ function plugin(file, librarySettings, inputs) { } audioIdx++ } - + } if (convert == true) { response.processFile = true; - response.preset = `, -map 0 -c:v copy -c:a copy ${ffmpegCommandInsert} -strict -2 -c:s copy ` + response.preset = `, -map 0 -c:v copy -c:a copy ${ffmpegCommandInsert} -strict -2 -c:s copy -max_muxing_queue_size 4096 ` } else { response.infoLog += "☑File contains all required audio formats. \n" response.processFile = false; } return response - + } module.exports.details = details; -module.exports.plugin = plugin; \ No newline at end of file +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js index 98441cb..1ee5d4a 100644 --- a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js +++ b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js @@ -40,7 +40,7 @@ function plugin(file) { } videoIdx++ } - + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { if (subtitleIdx != "0") { convert = true @@ -66,13 +66,13 @@ function plugin(file) { response.infoLog += "☒ Audio 8ch not last. \n" } } - + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") { subtitleIdx++ } } catch (err) { } } - + for (var i = 0; i < file.ffProbeData.streams.length; i++) { try { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video" && file.ffProbeData.streams[i].codec_name.toLowerCase() != "mjpeg") { @@ -80,7 +80,7 @@ function plugin(file) { } } catch (err) { } } - + for (var i = 0; i < file.ffProbeData.streams.length; i++) { try { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels == "2") { @@ -88,7 +88,7 @@ function plugin(file) { } } catch (err) { } } - + for (var i = 0; i < file.ffProbeData.streams.length; i++) { try { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels == "6") { @@ -96,7 +96,7 @@ function plugin(file) { } } catch (err) { } } - + for (var i = 0; i < file.ffProbeData.streams.length; i++) { try { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels == "8") { @@ -104,7 +104,7 @@ function plugin(file) { } } catch (err) { } } - + for (var i = 0; i < file.ffProbeData.streams.length; i++) { try { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels != "2" && file.ffProbeData.streams[i].channels != "6" && file.ffProbeData.streams[i].channels != "8") { @@ -112,7 +112,7 @@ function plugin(file) { } } catch (err) { } } - + for (var i = 0; i < file.ffProbeData.streams.length; i++) { try { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") { @@ -123,7 +123,7 @@ function plugin(file) { if (convert == true) { response.processFile = true; - response.preset = `,${ffmpegCommandInsert} -c copy` + response.preset = `,${ffmpegCommandInsert} -c copy -max_muxing_queue_size 4096` response.reQueueAfter = true; response.infoLog += "☒ Streams are out of order, reorganizing streams. Video, Audio, Subtitles. \n" } else { @@ -131,7 +131,7 @@ function plugin(file) { response.processFile = false; } return response - + } module.exports.details = details; -module.exports.plugin = plugin; \ No newline at end of file +module.exports.plugin = plugin; From 46667bee2f176277391e74cbdf31b9fdcff6a3eb Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Tue, 31 Mar 2020 17:38:42 +0100 Subject: [PATCH 48/51] Update: MJPEG Plugins Remove iiDrakeii_Not_A_Video_Mjpeg_Fix plugin as this was resolved in Tdarr. Create new plugin to strip out image format tracks, currently mjpeg & png. --- .../Tdarr_Plugin_MC93_MigzImageRemoval.js | 60 ++++++++++++++ ...in_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js | 78 ------------------- 2 files changed, 60 insertions(+), 78 deletions(-) create mode 100644 Community/Tdarr_Plugin_MC93_MigzImageRemoval.js delete mode 100644 Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js diff --git a/Community/Tdarr_Plugin_MC93_MigzImageRemoval.js b/Community/Tdarr_Plugin_MC93_MigzImageRemoval.js new file mode 100644 index 0000000..2fd4094 --- /dev/null +++ b/Community/Tdarr_Plugin_MC93_MigzImageRemoval.js @@ -0,0 +1,60 @@ +function details() { + return { + id: "Tdarr_Plugin_MC93_MigzImageRemoval", + Stage: "Pre-processing", + Name: "Migz-Remove image formats from file", + Type: "Video", + Operation:"Clean", + Description: `Identify any unwanted image formats in the file and remove those streams. MJPEG & PNG \n\n`, + Version: "1.0", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_MigzImageRemoval.js", + Tags:'pre-processing,ffmpeg,video only' + } +} + +function plugin(file, librarySettings, inputs) { + var response = { + processFile: false, + preset: '', + handBrakeMode: false, + container: '.' + file.container, + FFmpegMode: true, + reQueueAfter: true, + infoLog: '' + } + + if (file.fileMedium !== "video") { + response.processFile = false + response.infoLog += "☒File is not a video. \n" + return response + } + + var videoIdx = 0 + var extraArguments = "" + var convert = false + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") { + if (file.ffProbeData.streams[i].codec_name == 'mjpeg' || file.ffProbeData.streams[i].codec_name == 'png') { + convert = true + extraArguments += `-map -v:${videoIdx} ` + } + videoIdx++ + } + } + + if (convert === true ) { + response.preset += `,-map 0 -c copy -max_muxing_queue_size 4096 ${extraArguments}` + response.infoLog += `☒File has image format stream, removing. \n` + response.processFile = true; + } else { + response.processFile = false; + response.infoLog += "☑File doesn't contain any unwanted image format streams.\n" + } + return response +} + + + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js b/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js deleted file mode 100644 index f226984..0000000 --- a/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js +++ /dev/null @@ -1,78 +0,0 @@ -function details() { - return { - id: "Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix", - Stage: "Pre-processing", - Name: "Mjpeg Stream False Not A Video Fixer", - Type: "Video", - Operation:"", - Description: `Checks if file is not a video file due to Mjpeg stream. Removes Mjpeg Stream \n\n`, - Version: "1.00", - Tags:'pre-processing,ffmpeg,' - } -} - -function plugin(file) { - var transcode = 0; //if this var changes to 1 the file will be transcoded -//default values that will be returned - var response = { - processFile: false, - preset: '', - container: '.mp4', - handBrakeMode: false, - FFmpegMode: false, - reQueueAfter: true, - infoLog: '' - } - response.container = '.' + file.container - - for (var i = 0; i < file.ffProbeData.streams.length; i++) { -//check for mjpeg streams and set the preset if mjpeg streams are found - try { - if ((file.ffProbeData.streams[i].codec_name.toLowerCase() == "mjpeg") && file.ffProbeData.streams[i].codec_type.toLowerCase() == "video" ) { - response.preset = `,-map 0 -map -0:v:1 -c:v copy -c:a copy -c:s copy` - response.infoLog = "☒File is not a video but has Mjpeg Stream! \n" - } - } - catch (err) { } - } - //If preset is not set check if file is video and stop (reque if it is a video) - if (response.preset != `,-map 0 -map -0:v:1 -c:v copy -c:a copy -c:s copy`) { - if (file.fileMedium !== "video") { - console.log("File is not video!") - response.infoLog += " File is not video\n" - response.processFile = false; - - return response - } - else { - response.infoLog += "☑File is a video Without Mjpeg! \n" - response.processFile = false - response.reQueueAfter = true - return response - } - } - //Process mjpeg removal if video found to not be a video and have mjpeg stream - else { - if (file.fileMedium !== "video") { - transcode = 1 - } - else { - response.infoLog += "☑File is a video With Mjpeg! \n" - response.processFile = false - response.reQueueAfter = true - return response - } - } -//check if the file is eligible for transcoding -//if true the neccessary response values will be changed - if (transcode == 1) { - response.processFile = true; - response.FFmpegMode = true - response.reQueueAfter = true; - response.infoLog += `Mjpeg Stream is being removed!\n` - } - - return response -} -module.exports.details = details; -module.exports.plugin = plugin; From a0f39aa9476d6d7624cfe9c52d8fbebd3870e3c8 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Wed, 1 Apr 2020 10:49:14 +0100 Subject: [PATCH 49/51] Reinclude iiDrakeii plugin Reinclude iiDrakeii_Not_A_Video_Mjpeg_Fix, warning needs to be given in a future update before removing plugin due to the fact people may still be using this plugin. --- ...in_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js diff --git a/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js b/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js new file mode 100644 index 0000000..f226984 --- /dev/null +++ b/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js @@ -0,0 +1,78 @@ +function details() { + return { + id: "Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix", + Stage: "Pre-processing", + Name: "Mjpeg Stream False Not A Video Fixer", + Type: "Video", + Operation:"", + Description: `Checks if file is not a video file due to Mjpeg stream. Removes Mjpeg Stream \n\n`, + Version: "1.00", + Tags:'pre-processing,ffmpeg,' + } +} + +function plugin(file) { + var transcode = 0; //if this var changes to 1 the file will be transcoded +//default values that will be returned + var response = { + processFile: false, + preset: '', + container: '.mp4', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: true, + infoLog: '' + } + response.container = '.' + file.container + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { +//check for mjpeg streams and set the preset if mjpeg streams are found + try { + if ((file.ffProbeData.streams[i].codec_name.toLowerCase() == "mjpeg") && file.ffProbeData.streams[i].codec_type.toLowerCase() == "video" ) { + response.preset = `,-map 0 -map -0:v:1 -c:v copy -c:a copy -c:s copy` + response.infoLog = "☒File is not a video but has Mjpeg Stream! \n" + } + } + catch (err) { } + } + //If preset is not set check if file is video and stop (reque if it is a video) + if (response.preset != `,-map 0 -map -0:v:1 -c:v copy -c:a copy -c:s copy`) { + if (file.fileMedium !== "video") { + console.log("File is not video!") + response.infoLog += " File is not video\n" + response.processFile = false; + + return response + } + else { + response.infoLog += "☑File is a video Without Mjpeg! \n" + response.processFile = false + response.reQueueAfter = true + return response + } + } + //Process mjpeg removal if video found to not be a video and have mjpeg stream + else { + if (file.fileMedium !== "video") { + transcode = 1 + } + else { + response.infoLog += "☑File is a video With Mjpeg! \n" + response.processFile = false + response.reQueueAfter = true + return response + } + } +//check if the file is eligible for transcoding +//if true the neccessary response values will be changed + if (transcode == 1) { + response.processFile = true; + response.FFmpegMode = true + response.reQueueAfter = true; + response.infoLog += `Mjpeg Stream is being removed!\n` + } + + return response +} +module.exports.details = details; +module.exports.plugin = plugin; From 06e28fa832b6fb8dc50e5701ae2cdc40669bbb22 Mon Sep 17 00:00:00 2001 From: Miasma <33153516+miasmaejuices@users.noreply.github.com> Date: Thu, 2 Apr 2020 17:45:51 +1300 Subject: [PATCH 50/51] Subtitle Fix Added fix for subtitles per https://discordapp.com/channels/623392507828371476/626268797472604160/695001638628360212 Fixes error: ` Stream map '0:s' matches no streams. To ignore this, add a trailing '?' to the map. ` --- .../Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js index fb7e986..3771a39 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -101,7 +101,7 @@ function plugin(file) { //mitigate errors due to embeded pictures try { if ((file.ffProbeData.streams[i].codec_name.toLowerCase() == "png" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "bmp" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "mjpeg") && file.ffProbeData.streams[i].codec_type.toLowerCase() == "video" ) { - map = `-map 0:v:0 -map 0:a -map 0:s` + map = `-map 0:v:0 -map 0:a -map 0:s?` } } catch (err) { } From be6c28b0ba0296ea491575a37420c6809a8adee1 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Thu, 2 Apr 2020 21:34:23 +0100 Subject: [PATCH 51/51] Update: MigzPlex_Autoscan Add plugin to notify plex_autoscan to scan file. --- .../Tdarr_Plugin_MC93_MigzPlex_Autoscan.js | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js diff --git a/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js b/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js new file mode 100644 index 0000000..150bf63 --- /dev/null +++ b/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js @@ -0,0 +1,77 @@ +module.exports.details = function details() { + + return { + id: "Tdarr_Plugin_MC93_MigzPlex_Autoscan", + Stage: "Post-processing", + Name: "Send request for file to be scanned by plex_autoscan.", + Type: "Video", + Operation: "", + Description: `Send request for file to be scanned by plex_autoscan. https://github.com/l3uddz/plex_autoscan \n\n`, + Version: "1.00", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js", + Tags:"3rd party,post-processing,configurable", + + Inputs: [ + { + name: 'autoscan_address', + tooltip: ` + Enter the IP address/URL for autoscan. Must include http(s):// + + \\nExample:\\n + http://192.168.0.10 + + \\nExample:\\n + https://subdomain.domain.tld + ` + }, + { + name: 'autoscan_port', + tooltip: ` + Enter the port Autoscan is using, default is 3468 + + \\nExample:\\n + 3468 + ` + }, + { + name: 'autoscan_passkey', + tooltip: ` + + Enter the autoscan passkey. + + \\nExample:\\n + 9c4b81fe234e4d6eb9011cefe514d915 + ` + }, + ] + } +} + +module.exports.plugin = function plugin(file, librarySettings, inputs) { + + const request = require('request') + const ADDRESS = inputs.autoscan_address + const PORT = inputs.autoscan_port + const PASSKEY = inputs.autoscan_passkey + + var response = "" + filepath = `${file.file}` + + + request.post({ + headers: {'content-type': 'application/json'}, + url: `${ADDRESS}:${PORT}/${PASSKEY}`, + form: { "eventType" : "Manual", "filepath" : `${filepath}` } + }, (error, res, body) => { + if (error) { + console.error(error) + } + console.log(`statusCode: ${res.statusCode}`) + console.log(body) + }) + + console.log("request next") + console.log(request.post) + +} +