From a378ce5aef98d61a784961e8e05b319a9241246c Mon Sep 17 00:00:00 2001 From: robejo9 Date: Mon, 9 Dec 2019 15:59:17 -0600 Subject: [PATCH 001/104] Final Update of the Day Update to Layout to remove Redundancy (Thanks to Control) Update bitrate set for different resolutions. --- ..._d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 157 +++++------------- 1 file changed, 44 insertions(+), 113 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 d24789d..ad72662 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -1,4 +1,3 @@ - function details() { return { id: "Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV", @@ -6,11 +5,11 @@ function details() { Type: "Video", Operation:"Transcode", Description: `[Contains built-in filter] This plugin uses different FFMPEG NVENC 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.05", + Version: "1.06", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js" } } - + function plugin(file) { var transcode = 0; //if this var changes to 1 the file will be transcoded @@ -24,7 +23,7 @@ function plugin(file) { 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 @@ -33,7 +32,7 @@ function plugin(file) { } 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 @@ -41,126 +40,59 @@ function plugin(file) { 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 = `-c:v h263_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'h264') { - if (file.ffProbeData.streams[0].profile == 'High 10') {response.preset = `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else {response.preset = `-c:v h264_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - } - else if (file.video_codec_name == 'mjpeg') { - response.preset = `-c:v mjpeg_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'mpeg1') { - response.preset = `-c:v mpeg1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'mpeg2') { - response.preset = `-c:v mpeg2_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'mpeg4') { - response.preset = `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'vc1') { - response.preset = `-c:v vc1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'vp8') { - response.preset = `-c:v vp8_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'vp9') { - response.preset = `-c:v vp9_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else { - response.preset = `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` + 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` + } +// skipping this one because it's empty +// else if (file.video_codec_name == 'mpeg4') { +// response.preset = `` +// } + 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` + } + +//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" ) { + response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 500k -maxrate:v 1500k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` 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 = `-c:v h263_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'h264') { - if (file.ffProbeData.streams[0].profile == 'High 10') {response.preset = `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else {response.preset = `-c:v h264_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - } - else if (file.video_codec_name == 'mjpeg') { - response.preset = `-c:v mjpeg_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'mpeg1') { - response.preset = `-c:v mpeg1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'mpeg2') { - response.preset = `-c:v mpeg2_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'mpeg4') { - response.preset = `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'vc1') { - response.preset = `-c:v vc1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'vp8') { - response.preset = `-c:v vp8_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'vp9') { - response.preset = `-c:v vp9_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else { - response.preset = `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - + response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2000k -maxrate:v 4000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` 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 = `-c:v h263_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'h264') { - if (file.ffProbeData.streams[0].profile == 'High 10') {response.preset = `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else {response.preset = `-c:v h264_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - } - else if (file.video_codec_name == 'mjpeg') { - response.preset = `-c:v mjpeg_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'mpeg1') { - response.preset = `-c:v mpeg1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'mpeg2') { - response.preset = `-c:v mpeg2_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'mpeg4') { - response.preset = `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'vc1') { - response.preset = `-c:v vc1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'vp8') { - response.preset = `-c:v vp8_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else if (file.video_codec_name == 'vp9') { - response.preset = `-c:v vp9_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - else { - response.preset = `, -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - } - + response.preset += `, -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` transcode = 1; } - + //check if the file is eligible for transcoding //if true the neccessary response values will be changed if (transcode == 1) { @@ -173,7 +105,6 @@ function plugin(file) { return response } - + module.exports.details = details; - module.exports.plugin = plugin; From 7c3136c36ed77ff4351133631e2195facc813576 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 10 Dec 2019 14:36:06 +0000 Subject: [PATCH 002/104] Update Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js --- ..._HaveAGitGat_HandBrake_H264_Fast1080p30.js | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js b/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js index 9314ee1..9bd316c 100644 --- a/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js +++ b/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js @@ -85,6 +85,19 @@ function plugin(file) { /// +if(hasSubs){ + + response.infoLog += "☒File has subs \n" + response.preset = ',-sn -map 0 -c copy' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + + }else{ + response.infoLog += "☑File has no subs \n" + } + if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){ response.infoLog += "☒File has title metadata and no aac and subs \n" @@ -144,18 +157,6 @@ function plugin(file) { response.infoLog += "☑File has aac track \n" } - if(hasSubs){ - - response.infoLog += "☒File has subs \n" - response.preset = ',-sn -map 0 -c copy' - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true - return response - - }else{ - response.infoLog += "☑File has no subs \n" - } response.infoLog += "☑File meets conditions! \n" From f42bfa5826d264337eb91c59d04988a4f7743581 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 10 Dec 2019 14:37:33 +0000 Subject: [PATCH 003/104] Update Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js --- ...eAGitGat_HandBrake_H264_VeryFast1080p30.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js b/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js index df76687..58b4813 100644 --- a/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js +++ b/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js @@ -85,6 +85,19 @@ function plugin(file) { /// +if(hasSubs){ + + response.infoLog += "☒File has subs \n" + response.preset = ',-sn -map 0 -c copy' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + + }else{ + response.infoLog += "☑File has no subs \n" + } + if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){ response.infoLog += "☒File has title metadata and no aac and subs \n" @@ -144,19 +157,6 @@ function plugin(file) { response.infoLog += "☑File has aac track \n" } - if(hasSubs){ - - response.infoLog += "☒File has subs \n" - response.preset = ',-sn -map 0 -c copy' - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true - return response - - }else{ - response.infoLog += "☑File has no subs \n" - } - response.infoLog += "☑File meets conditions! \n" return response From 2ce15344dc3df029d56dd250688a1b68cadc88e0 Mon Sep 17 00:00:00 2001 From: robejo9 Date: Tue, 10 Dec 2019 21:12:18 -0600 Subject: [PATCH 004/104] map 0 error fixed map 0 on 1080p --- .../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 ad72662..1e560f3 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -89,7 +89,7 @@ function plugin(file) { //file will be encoded if the resolution is 1080p //codec will be checked so it can be transcoded correctly if(file.video_resolution === "1080p") { - response.preset += `, -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` + response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` transcode = 1; } From 6750ff2764f332535d9e28886d6674b654bdb996 Mon Sep 17 00:00:00 2001 From: robejo9 Date: Thu, 12 Dec 2019 09:14:46 -0600 Subject: [PATCH 005/104] 4KUHD Support Added Support for 4KUHD. Updated Description with 4KUHD Bitrate for 4k UHD set at 14000k and max of 20000k --- ..._Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 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 1e560f3..4e9ea84 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -4,8 +4,8 @@ function details() { Name: "Tiered FFMPEG NVENC settings depending on resolution", Type: "Video", Operation:"Transcode", - Description: `[Contains built-in filter] This plugin uses different FFMPEG NVENC 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.06", + 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.07", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js" } } @@ -45,7 +45,7 @@ function plugin(file) { 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 + if (file.ffProbeData.streams[0].profile != 'High 10') { //Remove HW Decoding for High 10 Profile response.preset = `-c:v h264_cuvid` } } @@ -92,6 +92,12 @@ function plugin(file) { response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` transcode = 1; } + //file will be encoded if the resolution is 4K +//codec will be checked so it can be transcoded correctly + if(file.video_resolution === "4KUHD") { + response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 14000k -maxrate:v 20000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` + transcode = 1; + } //check if the file is eligible for transcoding //if true the neccessary response values will be changed From 3bcdef7966ea19e82538a32aae73ef91e1b3ab3e Mon Sep 17 00:00:00 2001 From: robejo9 Date: Fri, 13 Dec 2019 12:59:32 -0600 Subject: [PATCH 006/104] Update Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js Files now check if bitrate is lower then default set bitrate. If lower decreases bitrate by percentage and converts. Added -a53cc 0 to remove Closed Captioning Issues (closed captioning no longer kept) --- ..._d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 70 ++++++++++++++++--- 1 file changed, 59 insertions(+), 11 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 4e9ea84..0ec049c 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -5,14 +5,17 @@ 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.07", + Version: "1.08", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js" } } function plugin(file) { var transcode = 0; //if this var changes to 1 the file will be transcoded - + var bitrateprobe = 0; //bitrate from ffprobe + var bitratetarget = 0; + var bitratemax = 0; + var bitratecheck = 0; //default values that will be returned var response = { processFile: false, @@ -29,7 +32,9 @@ function plugin(file) { response.processFile = false response.infoLog += "☒File is not a video! \n" return response - } else { + } + else { + bitrateprobe = file.ffProbeData.streams[0].bit_rate response.infoLog += "☑File is a video! \n" } @@ -75,28 +80,65 @@ function plugin(file) { //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" ) { - response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 29 -b:v 500k -maxrate:v 1500k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` + bitratecheck = 1000000; + if(bitrateprobe < bitratecheck) { + bitratetarget = parseInt((bitrateprobe * .8) / 1024); // Lower Bitrate to 60% of original and convert to KB + bitratemax = bitratetarget + 500; // Set max bitrate to 6MB Higher + } + else { + 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 -c:s copy`; 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") { - response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -b:v 2000k -maxrate:v 4000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` + bitratecheck = 2000000; + if(bitrateprobe < bitratecheck) { + bitratetarget = parseInt((bitrateprobe * .8) / 1024); // Lower Bitrate to 60% of original and convert to KB + bitratemax = bitratetarget + 2000; // Set max bitrate to 6MB Higher + } + else { + 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 -c:s copy`; 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") { - response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` + bitratecheck = 2500000; + if(bitrateprobe < bitratecheck) { + bitratetarget = parseInt((bitrateprobe * .8) / 1024); // Lower Bitrate to 60% of original and convert to KB + bitratemax = bitratetarget + 2500; // Set max bitrate to 6MB Higher + } + else { + 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 -c:s copy`; transcode = 1; } - //file will be encoded if the resolution is 4K + + //file will be encoded if the resolution is 4K //codec will be checked so it can be transcoded correctly if(file.video_resolution === "4KUHD") { - response.preset += `,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -b:v 14000k -maxrate:v 20000k -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -c:a copy -c:s copy` - transcode = 1; + bitratecheck = 14000000; + if(bitrateprobe < bitratecheck) { + bitratetarget = parseInt((bitrateprobe * .7) / 1024); // Lower Bitrate to 60% of original and convert to KB + bitratemax = bitratetarget + 6000; // Set max bitrate to 6MB Higher + } + else { + 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`; + transcode = 1; } //check if the file is eligible for transcoding @@ -106,7 +148,13 @@ function plugin(file) { response.FFmpegMode = true response.reQueueAfter = true; response.infoLog += `☒File is ${file.video_resolution} but is not hevc!\n` - response.infoLog += `File is being transcoded!\n` + if(bitrateprobe < bitratecheck) { + response.infoLog += `File bitrate is LOWER than the Default Target Bitrate!\n` + } + else { + response.infoLog += `File bitrate is HIGHER than the Default Target Bitrate!\n` + } + response.infoLog += `File is being transcoded!\n` } return response From 5b9409bf532936acd656081a42a68d2b41f9a164 Mon Sep 17 00:00:00 2001 From: robejo9 Date: Sat, 14 Dec 2019 00:49:23 -0600 Subject: [PATCH 007/104] Bitrate Modifer of Null added Created modifier for null value to avoid 0 input for bitrate target. --- ...Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 0ec049c..19b277a 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -81,7 +81,7 @@ function plugin(file) { //codec will be checked so it can be transcoded correctly if (file.video_resolution === "480p" || file.video_resolution === "576p" ) { bitratecheck = 1000000; - if(bitrateprobe < bitratecheck) { + if(bitrateprobe != null && bitrateprobe < bitratecheck) { bitratetarget = parseInt((bitrateprobe * .8) / 1024); // Lower Bitrate to 60% of original and convert to KB bitratemax = bitratetarget + 500; // Set max bitrate to 6MB Higher } @@ -97,7 +97,7 @@ function plugin(file) { //codec will be checked so it can be transcoded correctly if(file.video_resolution === "720p") { bitratecheck = 2000000; - if(bitrateprobe < bitratecheck) { + if(bitrateprobe != null && bitrateprobe < bitratecheck) { bitratetarget = parseInt((bitrateprobe * .8) / 1024); // Lower Bitrate to 60% of original and convert to KB bitratemax = bitratetarget + 2000; // Set max bitrate to 6MB Higher } @@ -113,7 +113,7 @@ function plugin(file) { //codec will be checked so it can be transcoded correctly if(file.video_resolution === "1080p") { bitratecheck = 2500000; - if(bitrateprobe < bitratecheck) { + if(bitrateprobe != null && bitrateprobe < bitratecheck) { bitratetarget = parseInt((bitrateprobe * .8) / 1024); // Lower Bitrate to 60% of original and convert to KB bitratemax = bitratetarget + 2500; // Set max bitrate to 6MB Higher } @@ -129,7 +129,7 @@ function plugin(file) { //codec will be checked so it can be transcoded correctly if(file.video_resolution === "4KUHD") { bitratecheck = 14000000; - if(bitrateprobe < bitratecheck) { + if(bitrateprobe != null && bitrateprobe < bitratecheck) { bitratetarget = parseInt((bitrateprobe * .7) / 1024); // Lower Bitrate to 60% of original and convert to KB bitratemax = bitratetarget + 6000; // Set max bitrate to 6MB Higher } From 47ae074771a3f7a3cd41027eab382a0f0f25409e Mon Sep 17 00:00:00 2001 From: robejo9 Date: Sat, 14 Dec 2019 22:31:26 -0600 Subject: [PATCH 008/104] Update Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js "Segmentation Fault" error when truehd audio caused by truehd stream Added search for truehd stream -max_muxing_queue_size 1024 added to encode cli code to account for error Changed conversion of bytes to KB from 1024 to 1000 Added infolog for bitrate --- ..._d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 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 19b277a..44e0121 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -16,6 +16,7 @@ function plugin(file) { var bitratetarget = 0; var bitratemax = 0; var bitratecheck = 0; + var audioIdx = -1; //default values that will be returned var response = { processFile: false, @@ -82,7 +83,7 @@ function plugin(file) { if (file.video_resolution === "480p" || file.video_resolution === "576p" ) { bitratecheck = 1000000; if(bitrateprobe != null && bitrateprobe < bitratecheck) { - bitratetarget = parseInt((bitrateprobe * .8) / 1024); // Lower Bitrate to 60% of original and convert to KB + bitratetarget = parseInt((bitrateprobe * .8) / 1000); // Lower Bitrate to 60% of original and convert to KB bitratemax = bitratetarget + 500; // Set max bitrate to 6MB Higher } else { @@ -98,7 +99,7 @@ function plugin(file) { if(file.video_resolution === "720p") { bitratecheck = 2000000; if(bitrateprobe != null && bitrateprobe < bitratecheck) { - bitratetarget = parseInt((bitrateprobe * .8) / 1024); // Lower Bitrate to 60% of original and convert to KB + bitratetarget = parseInt((bitrateprobe * .8) / 1000); // Lower Bitrate to 60% of original and convert to KB bitratemax = bitratetarget + 2000; // Set max bitrate to 6MB Higher } else { @@ -114,7 +115,7 @@ function plugin(file) { if(file.video_resolution === "1080p") { bitratecheck = 2500000; if(bitrateprobe != null && bitrateprobe < bitratecheck) { - bitratetarget = parseInt((bitrateprobe * .8) / 1024); // Lower Bitrate to 60% of original and convert to KB + bitratetarget = parseInt((bitrateprobe * .8) / 1000); // Lower Bitrate to 60% of original and convert to KB bitratemax = bitratetarget + 2500; // Set max bitrate to 6MB Higher } else { @@ -130,7 +131,7 @@ function plugin(file) { if(file.video_resolution === "4KUHD") { bitratecheck = 14000000; if(bitrateprobe != null && bitrateprobe < bitratecheck) { - bitratetarget = parseInt((bitrateprobe * .7) / 1024); // Lower Bitrate to 60% of original and convert to KB + bitratetarget = parseInt((bitrateprobe * .7) / 1000); // Lower Bitrate to 60% of original and convert to KB bitratemax = bitratetarget + 6000; // Set max bitrate to 6MB Higher } else { @@ -140,21 +141,37 @@ function plugin(file) { 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`; transcode = 1; } - + //mitigate TrueHD audio causing Too many packets error + 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_name.toLowerCase() == "truehd" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" ) { + response.preset += ` -max_muxing_queue_size 1024` + } + } + catch (err) { } + } //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 is ${file.video_resolution}!\n` + response.infoLog += `☒File is not hevc!\n` + response.infoLog += `☒File bitrate is${parseInt(bitrateprobe / 1000)}kb!\n` if(bitrateprobe < bitratecheck) { response.infoLog += `File bitrate is LOWER than the Default Target Bitrate!\n` } else { response.infoLog += `File bitrate is HIGHER than the Default Target Bitrate!\n` } - response.infoLog += `File is being transcoded!\n` + response.infoLog += `☒Target Bitrate set to ${bitratetarget}kb!\n` + response.infoLog += `File is being transcoded!\n` } return response From 0ff050bc91d8146e2d5ae904b7d67677bfadae9e Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Mon, 16 Dec 2019 03:50:04 +0000 Subject: [PATCH 009/104] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 10 ++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..0858de1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,10 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +2019-12-16: Please note I'm on a 2 week break. Sorry for the inconvenience. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..2f4ae36 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,10 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +2019-12-16: Please note I'm on a 2 week break. Sorry for the inconvenience. From 04d261f2f844a726a1bf51e7f0939797cbf87c1a Mon Sep 17 00:00:00 2001 From: robejo9 Date: Thu, 19 Dec 2019 22:22:29 -0600 Subject: [PATCH 010/104] Remove data stream Data streams are not compatible with ffmpeg as far as my testing has given me. added -dn to reduce errors / canceled conversions due to data streams. --- ...rr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 44e0121..3ed87f5 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -90,7 +90,7 @@ 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 -c:s copy`; + 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 -c:s copy -dn`; transcode = 1; } @@ -106,7 +106,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 -c:s copy`; + 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 -c:s copy -dn`; transcode = 1; } @@ -122,7 +122,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 -c:s copy`; + 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`; transcode = 1; } @@ -138,7 +138,7 @@ 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`; + 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`; transcode = 1; } //mitigate TrueHD audio causing Too many packets error @@ -163,7 +163,7 @@ function plugin(file) { response.reQueueAfter = true; response.infoLog += `☒File is ${file.video_resolution}!\n` response.infoLog += `☒File is not hevc!\n` - response.infoLog += `☒File bitrate is${parseInt(bitrateprobe / 1000)}kb!\n` + response.infoLog += `☒File bitrate is ${parseInt(bitrateprobe / 1000)}kb!\n` if(bitrateprobe < bitratecheck) { response.infoLog += `File bitrate is LOWER than the Default Target Bitrate!\n` } From ae6ced57bc8b82f641409a3d9e00cb66494c0dd8 Mon Sep 17 00:00:00 2001 From: robejo9 Date: Mon, 23 Dec 2019 09:06:19 -0600 Subject: [PATCH 011/104] Remove errors due to embeded pictures -Added mitigation for embeded pictures to avoid errors during transcode. -added mitigation for mkv unsupported subtitle codec. (codec mov_text converts to srt) -Cleaned up unnecessary code. --- ..._d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 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 3ed87f5..428852f 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -16,7 +16,7 @@ function plugin(file) { var bitratetarget = 0; var bitratemax = 0; var bitratecheck = 0; - var audioIdx = -1; + var subcli = `-c:s copy` //default values that will be returned var response = { processFile: false, @@ -90,10 +90,18 @@ 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 -c:s copy -dn`; + 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`; 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") { @@ -106,10 +114,9 @@ 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 -c:s copy -dn`; + 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`; 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") { @@ -122,11 +129,10 @@ 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 -c:s copy -dn`; + 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`; transcode = 1; } - - //file will be encoded if the resolution is 4K +//file will be encoded if the resolution is 4K //codec will be checked so it can be transcoded correctly if(file.video_resolution === "4KUHD") { bitratecheck = 14000000; @@ -141,20 +147,22 @@ function plugin(file) { 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`; transcode = 1; } - //mitigate TrueHD audio causing Too many packets error for (var i = 0; i < file.ffProbeData.streams.length; i++) { - try { - if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { - audioIdx++ - } - } catch (err) { } 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) { @@ -175,7 +183,6 @@ function plugin(file) { } return response -} - + } module.exports.details = details; module.exports.plugin = plugin; From d91fff8328f40f4f183a9ef7aba0ce95a7c5bd86 Mon Sep 17 00:00:00 2001 From: robejo9 Date: Mon, 13 Jan 2020 15:03:21 -0600 Subject: [PATCH 012/104] Create Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js This plugin corrects files with MJPEG streams by removing the MJPEG stream. This allows Tdarr to correctly identify the file as a video. --- ...in_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js | 76 +++++++++++++++++++ 1 file changed, 76 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..cde7642 --- /dev/null +++ b/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js @@ -0,0 +1,76 @@ +function details() { + return { + id: "Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix", + 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", + } +} + +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 c07d07cab9e92d0b69bc438d3d4df37f236b63e0 Mon Sep 17 00:00:00 2001 From: Jack Dallas <3620144+JackDallas@users.noreply.github.com> Date: Mon, 13 Jan 2020 10:57:17 +0000 Subject: [PATCH 013/104] Fix id's of TheRealShadoh plugins --- .../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 85ab199..940f154 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -4,7 +4,7 @@ function details() { return { - id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js", + id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium", Name: "TheRealShadoh FFmpeg Subs Medium, video MP4, audio AAC, keep subs. ", Type: "Video", 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 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 a5bbdc0..ea42d6c 100644 --- a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -4,7 +4,7 @@ function details() { return { - id: "Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js", + id: "Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast", Name: "TheRealShadoh FFmpeg Subs Fast, video MP4, audio AAC, keep subs. ", Type: "Video", 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 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 f7f39ed..acb940d 100644 --- a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -4,7 +4,7 @@ function details() { return { - id: "Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js", + id: "Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow", Name: "TheRealShadoh FFmpeg Subs Slow, video MP4, audio AAC, keep subs. ", Type: "Video", 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 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 2211f6c..e954cf2 100644 --- a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -4,7 +4,7 @@ function details() { return { - id: "Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js", + id: "Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast", Name: "TheRealShadoh FFmpeg Subs VeryFast, video MP4, audio AAC, keep subs. ", Type: "Video", 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 From c0b7bbcecb90efc1d9d11f633b5722500ed2c7fb Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Fri, 17 Jan 2020 14:54:31 +0000 Subject: [PATCH 014/104] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 0858de1..1b182fe 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,4 +7,4 @@ assignees: '' --- -2019-12-16: Please note I'm on a 2 week break. Sorry for the inconvenience. + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 2f4ae36..e46a4c0 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,4 +7,4 @@ assignees: '' --- -2019-12-16: Please note I'm on a 2 week break. Sorry for the inconvenience. + From afb55588eb66711a6acbac021cefd4143f31b931 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Mon, 20 Jan 2020 17:20:26 +0000 Subject: [PATCH 015/104] Allow inclusion/exclusion of any codecs within any stream. Not just stream 0. --- methods/library/filters/filterByCodec.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/methods/library/filters/filterByCodec.js b/methods/library/filters/filterByCodec.js index 1930365..07a675f 100644 --- a/methods/library/filters/filterByCodec.js +++ b/methods/library/filters/filterByCodec.js @@ -5,11 +5,22 @@ function filterByCodec(file, mode, codecs) { try { - // console.log(file,mode,codecs) + // console.log(file,mode,codecs) + + var allCodecs = file.ffProbeData.streams.map(row => row.codec_name) + + var included = false + + for (var i = 0; i < allCodecs.length; i++) { + + if (codecs.toLowerCase().includes(allCodecs[i])) { + included = true + } + } if (mode === 'include') { - if (codecs.toLowerCase().includes(file.ffProbeData.streams[0].codec_name.toLowerCase())) { + if (included) { var response = { outcome: true, @@ -29,7 +40,7 @@ function filterByCodec(file, mode, codecs) { } else if (mode === 'exclude') { - if (codecs.toLowerCase().includes(file.ffProbeData.streams[0].codec_name.toLowerCase())) { + if (included) { var response = { outcome: false, @@ -50,10 +61,10 @@ function filterByCodec(file, mode, codecs) { var response = { outcome: false, - note: `library.filters.filterByCodec error: ${err} \n` + note: `library.filters.filterByCodec error: ${err} \n` } return response - + } catch (err) { From f41d245c0ffd78f4766b432eefa9eab8c3cb9ba9 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 23 Jan 2020 15:27:28 +0000 Subject: [PATCH 016/104] Bug fix --- Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js b/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js index 429cb3e..65e8d82 100644 --- a/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js +++ b/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js @@ -7,7 +7,7 @@ function details() { id: "Tdarr_Plugin_sdd3_Remove_Commentary_Tracks", Name: "Remove video commentary tracks", Type: "Video", - Operation:"Remux", + 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" @@ -44,6 +44,7 @@ function plugin(file) { var audioIdx = -1 var hasCommentaryTrack = false + var ffmpegCommandInsert = "" for (var i = 0; i < file.ffProbeData.streams.length; i++) { @@ -59,11 +60,14 @@ function plugin(file) { //check if commentary track and passing audio stream number try { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].tags.title.toLowerCase().includes("commentary")) { + + ffmpegCommandInsert += ` -map -0:a:${audioIdx}` hasCommentaryTrack = true } - } catch (err) { } + } catch (err) { + } } From 362de5938b9ba9513f2b76b9a6d2f88a07bd29de Mon Sep 17 00:00:00 2001 From: James Date: Fri, 24 Jan 2020 21:25:43 +0000 Subject: [PATCH 017/104] Create Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js An extension of 075b to use a CRF value of 20 for better quality transcodes. --- ...PEG_HEVC_Generic_Video_Audio_Only_CRF20.js | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js 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 new file mode 100644 index 0000000..26d79e5 --- /dev/null +++ b/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js @@ -0,0 +1,68 @@ + + + +function details() { + + return { + id: "Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20", + Name: "FFMPEG H265 Video + Audio Kept Only With CRF 20", + Type: "Video", + 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" + } + +} + +function plugin(file) { + + + //Must return this object + + var response = { + + processFile: false, + preset: '', + container: '.mp4', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: '', + + } + + 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" + } + + + if (file.ffProbeData.streams[0].codec_name == 'hevc') { + response.processFile = false + response.infoLog += "☑File is already in hevc! \n" + return response + } + + + + response.processFile = true; + response.preset = `,-map 0:v -map 0:a -c copy -c:v:0 libx265 -crf 20` + response.container = '.mkv' + response.handBrakeMode = false + response.FFmpegMode = true + response.reQueueAfter = true; + response.infoLog += `☒File is not hevc! \n` + return response + + + +} + +module.exports.details = details; + +module.exports.plugin = plugin; + From 3e5cc78d2d986272ab2292ebbcaa444bd9891857 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 25 Jan 2020 11:48:27 +0000 Subject: [PATCH 018/104] Create Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js GPU transcoding with FFMPEG and a CRF value of 20. --- ...HEVC_GPU_Generic_Video_Audio_Only_CRF20.js | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js 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 new file mode 100644 index 0000000..7b34fa4 --- /dev/null +++ b/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js @@ -0,0 +1,68 @@ + + + +function details() { + + return { + id: "Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20", + Name: "FFMPEG H265 Video + Audio Kept Only With CRF 20 On The GPU", + Type: "Video", + 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" + } + +} + +function plugin(file) { + + + //Must return this object + + var response = { + + processFile: false, + preset: '', + container: '.mp4', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: '', + + } + + 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" + } + + + if (file.ffProbeData.streams[0].codec_name == 'hevc') { + response.processFile = false + response.infoLog += "☑File is already in hevc! \n" + return response + } + + + + response.processFile = true; + response.preset = `,-map 0:v -map 0:a -c copy -c:v:0 hevc_nvenc -crf 20` + response.container = '.mkv' + response.handBrakeMode = false + response.FFmpegMode = true + response.reQueueAfter = true; + response.infoLog += `☒File is not hevc! \n` + return response + + + +} + +module.exports.details = details; + +module.exports.plugin = plugin; + From 6e7f8e5717294f3fd5c3de0bd226ced2e7661656 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 28 Jan 2020 23:50:59 +0000 Subject: [PATCH 019/104] Update Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js --- ...Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e954cf2..6b4bd0f 100644 --- a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -7,7 +7,7 @@ function details() { id: "Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast", Name: "TheRealShadoh FFmpeg Subs VeryFast, video MP4, audio AAC, keep subs. ", Type: "Video", - 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 + 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 `, Version: "1.00", Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_Veryfast.js" From 61746191bc936baa9fe9ad416f35220887ed1c06 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 28 Jan 2020 23:51:41 +0000 Subject: [PATCH 020/104] Update Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js --- .../Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 acb940d..b8ed5a7 100644 --- a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -7,7 +7,7 @@ function details() { id: "Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow", Name: "TheRealShadoh FFmpeg Subs Slow, video MP4, audio AAC, keep subs. ", Type: "Video", - 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 + 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 `, Version: "1.00", Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js" From 35fa4a1bbe4f1ec802b15d1e0d304801fee47dc0 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 28 Jan 2020 23:52:18 +0000 Subject: [PATCH 021/104] Update Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js --- .../Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ea42d6c..e79cddb 100644 --- a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -7,7 +7,7 @@ function details() { id: "Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast", Name: "TheRealShadoh FFmpeg Subs Fast, video MP4, audio AAC, keep subs. ", Type: "Video", - 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 + 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 `, Version: "1.00", Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js" From af5aa9cc269d3bc138fba867f08ca3e10024a843 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 28 Jan 2020 23:52:47 +0000 Subject: [PATCH 022/104] Update Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js --- .../Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 940f154..49a9d0f 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -7,7 +7,7 @@ function details() { id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium", Name: "TheRealShadoh FFmpeg Subs Medium, video MP4, audio AAC, keep subs. ", Type: "Video", - 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 + 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 `, Version: "1.00", Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js" From c0278f93a17841c3a87dcfdacd27a6c49810c2e4 Mon Sep 17 00:00:00 2001 From: Jack Dallas <3620144+JackDallas@users.noreply.github.com> Date: Wed, 29 Jan 2020 12:57:51 +0000 Subject: [PATCH 023/104] Add missing return --- .../Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 940f154..45239d5 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -122,7 +122,7 @@ function plugin(file) { response.FFmpegMode = true return response }else{ - response.infoLog += "☑File has no title metadata" + response.infoLog += "☑File has no title metadata \n" } if(!jsonString.includes("aac")){ From 9cd46d89c6da133d4b6d3c809b499aca10ff7028 Mon Sep 17 00:00:00 2001 From: Jack Dallas <3620144+JackDallas@users.noreply.github.com> Date: Wed, 29 Jan 2020 12:58:43 +0000 Subject: [PATCH 024/104] Only convert mp4 incompatible subs --- ...ugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 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 45239d5..0f18705 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -53,11 +53,9 @@ function plugin(file) { for (var i = 0; i < file.ffProbeData.streams.length; i++) { try { - - if(file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"){ - + let streamData = file.ffProbeData.streams[i]; + if(streamData.codec_type.toLowerCase() == "subtitle" && streamData.codec_name != "mov_text"){ hasSubs = true - } } catch (err) { } } @@ -140,15 +138,14 @@ function plugin(file) { if(hasSubs){ - response.infoLog += "☒File has subs \n" + response.infoLog += "☒File has incompatible subs \n" response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text' - response.reQueueAfter = true; response.processFile = true; response.FFmpegMode = true return response }else{ - response.infoLog += "☑File has no subs \n" + response.infoLog += "☑File has no/compatible subs \n" } response.infoLog += "☑File meets conditions! \n" From efd9dcaded6975a21dde123faac3540a5645a33a Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Wed, 29 Jan 2020 21:54:44 +0000 Subject: [PATCH 025/104] Update Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js --- Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 bd66b85..69048ad 100644 --- a/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js +++ b/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js @@ -7,7 +7,7 @@ function details() { id: "Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta", Name: "Nosirus h265, aac, no meta, subs kept", Type: "Video", - Description: `[Contains built-in filter] If the file is not in h265 it will be trancoded into h265 with HandBrake 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 + 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" From d636c967a24893d532473c185f16dde68549a30c Mon Sep 17 00:00:00 2001 From: Jack Dallas <3620144+JackDallas@users.noreply.github.com> Date: Thu, 30 Jan 2020 11:24:50 +0000 Subject: [PATCH 026/104] Fix remaining TheRealShadoh plugins --- ...1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js | 20 +++++++++---------- ...2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js | 18 ++++++++--------- ...TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js | 16 +++++++-------- 3 files changed, 24 insertions(+), 30 deletions(-) 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 ea42d6c..c4a2292 100644 --- a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -53,12 +53,10 @@ function plugin(file) { for (var i = 0; i < file.ffProbeData.streams.length; i++) { try { - - if(file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"){ - - hasSubs = true - - } + let streamData = file.ffProbeData.streams[i]; + if(streamData.codec_type.toLowerCase() == "subtitle" && streamData.codec_name != "mov_text"){ + hasSubs = true + } } catch (err) { } } @@ -121,7 +119,7 @@ function plugin(file) { response.FFmpegMode = true return response }else{ - response.infoLog += "☑File has no title metadata" + response.infoLog += "☑File has no title metadata \n" } if(!jsonString.includes("aac")){ @@ -138,16 +136,16 @@ function plugin(file) { } if(hasSubs){ - - response.infoLog += "☒File has subs \n" + + response.infoLog += "☒File has incompatible subs \n" response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text' response.reQueueAfter = true; response.processFile = true; response.FFmpegMode = true return response - }else{ - response.infoLog += "☑File has no subs \n" + }else{ + response.infoLog += "☑File has no/compatible subs \n" } response.infoLog += "☑File meets conditions! \n" 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 acb940d..5dba5ec 100644 --- a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -53,12 +53,10 @@ function plugin(file) { for (var i = 0; i < file.ffProbeData.streams.length; i++) { try { - - if(file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"){ - - hasSubs = true - - } + let streamData = file.ffProbeData.streams[i]; + if(streamData.codec_type.toLowerCase() == "subtitle" && streamData.codec_name != "mov_text"){ + hasSubs = true + } } catch (err) { } } @@ -122,7 +120,7 @@ function plugin(file) { response.FFmpegMode = true return response }else{ - response.infoLog += "☑File has no title metadata" + response.infoLog += "☑File has no title metadata \n" } if(!jsonString.includes("aac")){ @@ -140,15 +138,15 @@ function plugin(file) { if(hasSubs){ - response.infoLog += "☒File has subs \n" + response.infoLog += "☒File has incompatible subs \n" response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text' response.reQueueAfter = true; response.processFile = true; response.FFmpegMode = true return response - }else{ - response.infoLog += "☑File has no subs \n" + }else{ + response.infoLog += "☑File has no/compatible subs \n" } response.infoLog += "☑File meets conditions! \n" 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 e954cf2..68aed80 100644 --- a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -53,12 +53,10 @@ function plugin(file) { for (var i = 0; i < file.ffProbeData.streams.length; i++) { try { - - if(file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"){ - - hasSubs = true - - } + let streamData = file.ffProbeData.streams[i]; + if(streamData.codec_type.toLowerCase() == "subtitle" && streamData.codec_name != "mov_text"){ + hasSubs = true + } } catch (err) { } } @@ -122,7 +120,7 @@ function plugin(file) { response.FFmpegMode = true return response }else{ - response.infoLog += "☑File has no title metadata" + response.infoLog += "☑File has no title metadata \n" } if(!jsonString.includes("aac")){ @@ -140,7 +138,7 @@ function plugin(file) { if(hasSubs){ - response.infoLog += "☒File has subs \n" + response.infoLog += "☒File has incompatible subs \n" response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text' response.reQueueAfter = true; response.processFile = true; @@ -148,7 +146,7 @@ function plugin(file) { return response }else{ - response.infoLog += "☑File has no subs \n" + response.infoLog += "☑File has no/compatible subs \n" } response.infoLog += "☑File meets conditions! \n" From 55c35650b889af4d81e49c25d16efbc6e7e5eaad Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 2 Feb 2020 03:59:49 +0000 Subject: [PATCH 027/104] Moved package import location --- Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index a81d881..f214467 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -1,5 +1,4 @@ const fs = require('fs'); -const iso6392 = require('/home/Tdarr/Documents/node_modules/iso-639-2'); function details() { return { @@ -14,6 +13,9 @@ function details() { } function plugin(file) { + //Additional packages used here so details function above will still work if packages aren't installed + const iso6392 = require('/home/Tdarr/Documents/node_modules/iso-639-2'); + var i = 0; //int for counting lang[position] var sub = 0; //becomes first subtitle stream var lang = iso6392; //languages to check against From 4168f0bc1ab0084b4164c7a4fc81528f71cbc46c Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Wed, 5 Feb 2020 06:14:30 +0000 Subject: [PATCH 028/104] Stage: "Pre-processing" added --- .../Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js | 1 + ...5b_FFMPEG_HEVC_Generic_Video_Audio_Only.js | 1 + ...ugin_a37x_Drawmonster_MP4_No_Title_Meta.js | 1 + ...eAGitGat_HandBrake_H264_VeryFast1080p30.js | 1 + ..._HaveAGitGat_HandBrake_H264_Fast1080p30.js | 1 + ...rr_Plugin_b38x_Nosirus_h265_aac_no_meta.js | 1 + ...gin_b39x_the1poet_surround_sound_to_ac3.js | 1 + ..._d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 1 + ...in_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js | 1 + ..._H.264_MKV_480p30_No_Subs_No_Title_Meta.js | 1 + ..._H.264_MKV_720p30_No_Subs_No_Title_Meta.js | 1 + ...H.264_MKV_1080p30_No_Subs_No_Title_Meta.js | 1 + .../Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 1 + ...rr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js | 1 + ...rawmonster_MP4_AAC_No_Subs_No_metaTitle.js | 1 + ..._Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js | 1 + .../Tdarr_Plugin_lmg1_Reorder_Streams.js | 1 + ...r_Plugin_nc7x_Drawmonster_No_Title_Meta.js | 1 + .../Tdarr_Plugin_s710_nick_h265_nvenc_4K.js | 1 + Community/Tdarr_Plugin_s7x8_winsome_h265.js | 1 + .../Tdarr_Plugin_s7x9_winsome_h265_10bit.js | 1 + .../Tdarr_Plugin_s7x9_winsome_h265_nvenc.js | 1 + ...rr_Plugin_sdd3_Remove_Commentary_Tracks.js | 1 + ...df5_Thierrrrry_Remove_Non_English_Audio.js | 57 ++++++++++--------- Community/Tdarr_Plugin_x7ab_Remove_Subs.js | 1 + ...darr_Plugin_x7ac_Remove_Closed_Captions.js | 1 + ...b_TheRealShadoh_FFmpeg_Subs_H264_Medium.js | 1 + ...1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js | 1 + ...2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js | 1 + ...TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js | 1 + 30 files changed, 58 insertions(+), 28 deletions(-) diff --git a/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js b/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js index d50012c..f1a24fe 100644 --- a/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js +++ b/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_075a_FFMPEG_HEVC_Generic", + Stage: "Pre-processing", Name: "FFMPEG H265", Type: "Video", Operation:"Transcode", 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 5212367..9b3a52c 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 @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only", + Stage: "Pre-processing", Name: "FFMPEG H265 Video + Audio Kept Only", Type: "Video", Operation:"Transcode", 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 4b7ebab..25b6ac6 100644 --- a/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta", + Stage: "Pre-processing", Name: "Drawmonster MP4 No title meta data ", Type: "Video", Description: `[Contains built-in filter] This plugin removes metadata (if a title exists). The output container is mp4. \n\n diff --git a/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js b/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js index 58b4813..9eb959a 100644 --- a/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js +++ b/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30", + Stage: "Pre-processing", Name: "HaveAGitGat HandBrake VeryFast1080p30, No title meta, no subs, 192Kb AAC stereo,MP4 ", Type: "Video", 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 diff --git a/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js b/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js index 9bd316c..a1d539f 100644 --- a/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js +++ b/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30", + Stage: "Pre-processing", Name: "HaveAGitGat HandBrake Fast1080p30, No title meta, no subs, 192Kb AAC stereo,MP4 ", Type: "Video", 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 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 bd66b85..2d35279 100644 --- a/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js +++ b/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta", + Stage: "Pre-processing", Name: "Nosirus h265, aac, no meta, subs kept", Type: "Video", Description: `[Contains built-in filter] If the file is not in h265 it will be trancoded into h265 with HandBrake 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 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 348ba31..92fdc80 100644 --- a/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js +++ b/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3", + Stage: "Pre-processing", Name: "the1poet Video surround sound to ac3", Type: "Video", Description: `[Contains built-in filter] If the file has surround sound tracks not in ac3, they will be converted to ac3. \n\n 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 428852f..e991507 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -1,6 +1,7 @@ function details() { return { id: "Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV", + Stage: "Pre-processing", Name: "Tiered FFMPEG NVENC settings depending on resolution", Type: "Video", Operation:"Transcode", 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 cde7642..53af256 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 @@ -1,6 +1,7 @@ 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:"", 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 adff2b4..66ba7f1 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 @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta", + Stage: "Pre-processing", Name: "H.264 MKV 480p30, No Subs No, Title Meta", Type: "Video", 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 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 a45e88d..e58745a 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 @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta", + Stage: "Pre-processing", Name: "H.264 MKV 720p30, No Subs No, Title Meta", Type: "Video", 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 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 819202f..98584e9 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 @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta", + Stage: "Pre-processing", Name: "H.264 MKV 1080p30, No Subs No, Title Meta", Type: "Video", 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 diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index a81d881..dd3d0d9 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -4,6 +4,7 @@ const iso6392 = require('/home/Tdarr/Documents/node_modules/iso-639-2'); function details() { return { id: "Tdarr_Plugin_e5c3_CnT_Add_Subtitles", + Stage: "Pre-processing", Name: "Add subtitles to MKV files", Type: "Video", Operation:"Remux", 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 19df91b..03757ab 100644 --- a/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js +++ b/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs", + 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 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 e8f1d5d..c769c95 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 @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle", + Stage: "Pre-processing", Name: "Drawmonster MP4 Stereo AAC, No Subs, No title meta data ", Type: "Video", 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 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 0b01b8b..7978322 100644 --- a/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js +++ b/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle", + Stage: "Pre-processing", Name: "GilbN MP4 Stereo AAC, No title meta data ", Type: "Video", 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 diff --git a/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js b/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js index d81312a..848b682 100644 --- a/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js +++ b/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js @@ -2,6 +2,7 @@ function details() { return { id: "Tdarr_Plugin_lmg1_Reorder_Streams", + Stage: "Pre-processing", Name: "Tdarr_Plugin_lmg1_Reorder_Streams ", 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`, diff --git a/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js b/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js index 6c1c538..ae1e453 100644 --- a/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta", + Stage: "Pre-processing", Name: "Drawmonster No title meta data ", Type: "Video", Description: `[Contains built-in filter] This plugin removes metadata (if a title exists). The output container is the same as the original. \n\n diff --git a/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js b/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js index 2206769..f365746 100644 --- a/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js +++ b/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_s710_nick_h265_nvenc_4K", + Stage: "Pre-processing", Name: "Nick H265 NVENC 4K", Type: "Video", 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 diff --git a/Community/Tdarr_Plugin_s7x8_winsome_h265.js b/Community/Tdarr_Plugin_s7x8_winsome_h265.js index 2e6d7d1..5f39300 100644 --- a/Community/Tdarr_Plugin_s7x8_winsome_h265.js +++ b/Community/Tdarr_Plugin_s7x8_winsome_h265.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_s7x8_winsome_h265", + Stage: "Pre-processing", Name: "Winsome H265 ", Type: "Video", 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 diff --git a/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js b/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js index af34167..45a79ba 100644 --- a/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js +++ b/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_s7x9_winsome_h265_10bit", + Stage: "Pre-processing", Name: "Winsome H265 10 bit ", Type: "Video", 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 diff --git a/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js b/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js index 744a9ee..44699bc 100644 --- a/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js +++ b/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_s7x9_winsome_h265_nvenc", + Stage: "Pre-processing", Name: "Winsome H265 NVENC", Type: "Video", 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 diff --git a/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js b/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js index 65e8d82..94b0cc9 100644 --- a/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js +++ b/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_sdd3_Remove_Commentary_Tracks", + Stage: "Pre-processing", Name: "Remove video commentary tracks", Type: "Video", Operation: "Remux", 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 2ecaf1e..32a6ae3 100644 --- a/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js +++ b/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio", + Stage: "Pre-processing", Name: "Remove Non English Audio ", Type: "Video", 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 @@ -35,7 +36,7 @@ function plugin(file) { response.FFmpegMode = true - + //check if files is video if (file.fileMedium !== "video") { @@ -47,22 +48,25 @@ function plugin(file) { return response - } + } - var ffmpegCommandInsert = '' - var audioIdx = -1 - var hasNonEngTrack = false - var audioStreamsRemoved = 0 + var ffmpegCommandInsert = '' + var audioIdx = -1 + var hasNonEngTrack = false + var audioStreamsRemoved = 0 - var audioStreamCount = file.ffProbeData.streams.filter(row => (row.codec_type.toLowerCase() == "audio")).length; + //count number of audio streams + var audioStreamCount = file.ffProbeData.streams.filter(row => (row.codec_type.toLowerCase() == "audio")).length; - console.log("audioStreamCount:" + audioStreamCount) + console.log("audioStreamCount:" + audioStreamCount) for (var i = 0; i < file.ffProbeData.streams.length; i++) { + + //check if current stream is audio, update audioIdx if so try { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { audioIdx++ @@ -70,18 +74,15 @@ function plugin(file) { } catch (err) { } - - - try { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && !(file.ffProbeData.streams[i].tags.language.toLowerCase().includes('eng') || file.ffProbeData.streams[i].tags.language.toLowerCase().includes('und'))) { audioStreamsRemoved++ - if(audioStreamsRemoved == audioStreamCount){ + if (audioStreamsRemoved == audioStreamCount) { break; } - + ffmpegCommandInsert += ` -map -0:a:${audioIdx}` hasNonEngTrack = true @@ -93,27 +94,27 @@ function plugin(file) { - if (hasNonEngTrack === true) { + if (hasNonEngTrack === true) { - response.processFile = true; - response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy` - response.container = '.' + file.container - response.handBrakeMode = false - response.FFmpegMode = true - response.reQueueAfter = true; - response.infoLog += "☒File contains tracks which are not english or undefined. Removing! \n" - return response + response.processFile = true; + response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy` + response.container = '.' + file.container + response.handBrakeMode = false + response.FFmpegMode = true + response.reQueueAfter = true; + response.infoLog += "☒File contains tracks which are not english or undefined. Removing! \n" + return response - } else { + } else { - response.infoLog += "☑File doesn't contain tracks which are not english or undefined! \n" + response.infoLog += "☑File doesn't contain tracks which are not english or undefined! \n" - } + } + + response.processFile = false; + return response - response.processFile = false; - return response - } module.exports.details = details; diff --git a/Community/Tdarr_Plugin_x7ab_Remove_Subs.js b/Community/Tdarr_Plugin_x7ab_Remove_Subs.js index f1f39a0..ac0827b 100644 --- a/Community/Tdarr_Plugin_x7ab_Remove_Subs.js +++ b/Community/Tdarr_Plugin_x7ab_Remove_Subs.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_x7ab_Remove_Subs", + Stage: "Pre-processing", Name: "Remove subtitles ", Type: "Video", Description: `[Contains built-in filter] This plugin removes subtitles if detected. The output container is the same as the original. \n\n`, diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index da8f3e9..f2d95ea 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -4,6 +4,7 @@ function details() { return { id: "Tdarr_Plugin_x7ac_Remove_Closed_Captions", + Stage: "Pre-processing", Name: "Remove closed captions", Type: "Video", Operation: "Remux", 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 940f154..8517050 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium", + Stage: "Pre-processing", Name: "TheRealShadoh FFmpeg Subs Medium, video MP4, audio AAC, keep subs. ", Type: "Video", 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 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 ea42d6c..c7e2db0 100644 --- a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast", + Stage: "Pre-processing", Name: "TheRealShadoh FFmpeg Subs Fast, video MP4, audio AAC, keep subs. ", Type: "Video", 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 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 acb940d..72026c7 100644 --- a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow", + Stage: "Pre-processing", Name: "TheRealShadoh FFmpeg Subs Slow, video MP4, audio AAC, keep subs. ", Type: "Video", 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 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 e954cf2..d1592de 100644 --- a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -5,6 +5,7 @@ function details() { return { id: "Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast", + Stage: "Pre-processing", Name: "TheRealShadoh FFmpeg Subs VeryFast, video MP4, audio AAC, keep subs. ", Type: "Video", 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 From 407a778f75258cf6351f6a25b4181f6d0beca5fb Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Wed, 5 Feb 2020 06:16:02 +0000 Subject: [PATCH 029/104] BUG update --- .../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 3f8dc5c..ed699c7 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: `[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 `, 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 b6699a6..bdcbfa0 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: `[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 `, 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 ea1126a..9b98a58 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: `[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 `, 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 58cd52f..07852af 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: `[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 `, Version: "1.00", Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_Veryfast.js" From a812d9daa24c0aa32fe0465bf285c12897e5d79f Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Wed, 5 Feb 2020 22:03:08 +0000 Subject: [PATCH 030/104] New plugin guide --- ...s => Tdarr_Plugin_aaaa_Pre_Proc_Example.js | 96 ++++-- Tdarr_Plugin_zzzz_Post_Proc_Example.js | 289 ++++++++++++++++++ 2 files changed, 362 insertions(+), 23 deletions(-) rename Tdarr_Plugin_nc7x_Example.js => Tdarr_Plugin_aaaa_Pre_Proc_Example.js (80%) create mode 100644 Tdarr_Plugin_zzzz_Post_Proc_Example.js diff --git a/Tdarr_Plugin_nc7x_Example.js b/Tdarr_Plugin_aaaa_Pre_Proc_Example.js similarity index 80% rename from Tdarr_Plugin_nc7x_Example.js rename to Tdarr_Plugin_aaaa_Pre_Proc_Example.js index 411ac2d..c14b336 100644 --- a/Tdarr_Plugin_nc7x_Example.js +++ b/Tdarr_Plugin_aaaa_Pre_Proc_Example.js @@ -1,61 +1,79 @@ -function details() { +module.exports.details = function details() { return { - id: "Tdarr_Plugin_nc7x_Example", + id: "Tdarr_Plugin_aaaa_Pre_Proc_Example", + Stage: "Pre-processing", //Preprocessing or Post-processing. Determines when the plugin will be executed. Name: "No title meta data ", Type: "Video", + Operation: "Transcode", 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_nc7x_Example" + Link: "https://github.com/HaveAGitGat/Tdarr_Plugin_aaaa_Pre_Proc_Example", + + 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` + }, + { + name: 'channels', + tooltip: `Desired audio channel number. For example: 2` + }, + ] + } } -function plugin(file) { +module.exports.plugin = function plugin(file, librarySettings, inputs) { - //Must return this object + //Must return this object at some point in the function else plugin will fail. var response = { processFile: false, //If set to false, the file will be skipped. Set to true to have the file transcoded. preset: '', //HandBrake/FFmpeg CLI arguments you'd like to use. - //For FFmpeg, the input arguments come first followed by a comma, followed by the output argument. - // Examples - //HandBrake - // '-Z "Very Fast 1080p30"' - //FFmpeg - // '-sn,-map_metadata -1 -c:v copy -c:a copy' + //For FFmpeg, the input arguments come first followed by a comma, followed by the output argument. + // Examples + //HandBrake + // '-Z "Very Fast 1080p30"' + //FFmpeg + // '-sn,-map_metadata -1 -c:v copy -c:a copy' container: '.mp4', // The container of the transcoded output file. handBrakeMode: false, //Set whether to use HandBrake or FFmpeg for transcoding FFmpegMode: false, reQueueAfter: true, //Leave as true. File will be re-qeued afterwards and pass through the plugin filter again to make sure it meets conditions. infoLog: '', //This will be shown when the user clicks the 'i' (info) button on a file in the output queue if - //it has been skipped. - // Give reasons why it has been skipped ('File has no title metadata, File meets conditions!') + //it has been skipped. + // Give reasons why it has been skipped ('File has no title metadata, File meets conditions!') + //Optional (include together) + file, + removeFromDB: false, //Tell Tdarr to remove file from database if true + updateDB: false, //Change file object above and update database if true } - response.container = '.' + file.container - response.FFmpegMode = true + console.log(inputs.language) //eng if user entered 'eng' in input box in Tdarr plugin UI + console.log(inputs.channels) //2 if user entered '2' in input box in Tdarr plugin UI - if (file.fileMedium !== "video") { - console.log("File is not video") + //Here we specify that we want the output file container to be the same as the current container. + response.container = '.' + file.container - response.infoLog += " File is not video" - response.processFile = false + //We will use FFmpeg for this procedure. + response.FFmpegMode = true - return response - } else { + //Check if file has title metadata if (file.meta.Title != undefined) { + //if so, remove it response.infoLog += " File has title metadata" response.preset = ',-map_metadata -1 -c:v copy -c:a copy' @@ -68,12 +86,44 @@ function plugin(file) { response.infoLog += " File meets conditions!" return response +} + + +module.exports.onTranscodeSuccess = function onTranscodeSuccess(file, librarySettings, inputs) { + + console.log('Transcode success! Now do some stuff with the newly scanned file.') + + //Optional response if you need to modify database + var response = { + file, + removeFromDB: false, + updateDB: false, } + + return response } -module.exports.details = details; -module.exports.plugin = plugin; +module.exports.onTranscodeError = function onTranscodeError(file, librarySettings, inputs) { + + console.log('Transcode fail! Now do some stuff with the original file.') + + + //Optional response if you need to modify database + var response = { + file, + removeFromDB: false, + updateDB: false, + } + + return response +} + + + + + + //Example file object: // { diff --git a/Tdarr_Plugin_zzzz_Post_Proc_Example.js b/Tdarr_Plugin_zzzz_Post_Proc_Example.js new file mode 100644 index 0000000..3461cd6 --- /dev/null +++ b/Tdarr_Plugin_zzzz_Post_Proc_Example.js @@ -0,0 +1,289 @@ + + + +module.exports.details = function details() { + + return { + id: "Tdarr_Plugin_zzzz_Post_Proc_Example", + Stage: "Post-processing", //Preprocessing or Post-processing. Determines when the plugin will be executed. This plugin does some stuff after all plugins have been executed + Name: "Post proc ", + Type: "Video", + Operation: "", + 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", + + 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` + }, + { + name: 'channels', + tooltip: `Desired audio channel number. For example: 2` + }, + ] + + } + +} + +module.exports.plugin = function plugin(file, librarySettings, inputs) { + + console.log('Transcode success! Now do some stuff with the newly scanned file.') + + + //Optional response if you need to modify database + var response = { + file, + removeFromDB: false, + updateDB: false, + } + + return response + +} + + +//Example file object: + // { + // _id: 'C:/Users/H/Desktop/Test Input1/Sample.mp4', + // DB: 'ZRPDmnmpyuAEQi7nG', + // HealthCheck: 'Not attempted', + // TranscodeDecisionMaker: 'Not attempted', + // bit_rate: 1690430.4, + // container: 'mp4', + // createdAt: 2019-09-26T06:46:31.929Z, + // ffProbeData: + // { streams: + // [ { index: 0, + // codec_name: 'h264', + // codec_long_name: 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10', + // profile: 'Main', + // codec_type: 'video', + // codec_time_base: '1/50', + // codec_tag_string: 'avc1', + // codec_tag: '0x31637661', + // width: 1280, + // height: 720, + // coded_width: 1280, + // coded_height: 720, + // has_b_frames: 0, + // sample_aspect_ratio: '1:1', + // display_aspect_ratio: '16:9', + // pix_fmt: 'yuv420p', + // level: 31, + // chroma_location: 'left', + // refs: 1, + // is_avc: 'true', + // nal_length_size: '4', + // r_frame_rate: '25/1', + // avg_frame_rate: '25/1', + // time_base: '1/12800', + // start_pts: 0, + // start_time: '0.000000', + // duration_ts: 67584, + // duration: '5.280000', + // bit_rate: '1205959', + // bits_per_raw_sample: '8', + // nb_frames: '132', + // disposition: + // { default: 1, + // dub: 0, + // original: 0, + // comment: 0, + // lyrics: 0, + // karaoke: 0, + // forced: 0, + // hearing_impaired: 0, + // visual_impaired: 0, + // clean_effects: 0, + // attached_pic: 0, + // timed_thumbnails: 0 }, + // tags: + // { creation_time: '1970-01-01T00:00:00.000000Z', + // language: 'und', + // handler_name: 'VideoHandler' } }, + // { index: 1, + // codec_name: 'aac', + // codec_long_name: 'AAC (Advanced Audio Coding)', + // profile: 'LC', + // codec_type: 'audio', + // codec_time_base: '1/48000', + // codec_tag_string: 'mp4a', + // codec_tag: '0x6134706d', + // sample_fmt: 'fltp', + // sample_rate: '48000', + // channels: 6, + // channel_layout: '5.1', + // bits_per_sample: 0, + // r_frame_rate: '0/0', + // avg_frame_rate: '0/0', + // time_base: '1/48000', + // start_pts: 0, + // start_time: '0.000000', + // duration_ts: 254976, + // duration: '5.312000', + // bit_rate: '384828', + // max_bit_rate: '400392', + // nb_frames: '249', + // disposition: + // { default: 1, + // dub: 0, + // original: 0, + // comment: 0, + // lyrics: 0, + // karaoke: 0, + // forced: 0, + // hearing_impaired: 0, + // visual_impaired: 0, + // clean_effects: 0, + // attached_pic: 0, + // timed_thumbnails: 0 }, + // tags: + // { creation_time: '1970-01-01T00:00:00.000000Z', + // language: 'und', + // handler_name: 'SoundHandler' } } ] }, + // ffProbeRead: 'success', + // file: 'C:/Users/H/Desktop/Test Input1/Sample.mp4', + // fileMedium: 'video', + // file_size: 1.056519, + // meta: + // { SourceFile: 'C:/Users/H/Desktop/Test Input1/Sample.mp4', + // errors: [], + // Duration: 5.312, + // PreviewDuration: 0, + // SelectionDuration: 0, + // TrackDuration: 5.28, + // MediaDuration: 5.312, + // ExifToolVersion: 11.65, + // FileName: 'Sample.mp4', + // Directory: 'C:/Users/H/Desktop/Test Input1', + // FileSize: '1032 kB', + // FileModifyDate: + // { year: 2019, + // month: 9, + // day: 24, + // hour: 7, + // minute: 24, + // second: 22, + // millisecond: 0, + // tzoffsetMinutes: 60, + // rawValue: '2019:09:24 07:24:22+01:00' }, + // FileAccessDate: + // { year: 2019, + // month: 9, + // day: 26, + // hour: 7, + // minute: 44, + // second: 30, + // millisecond: 0, + // tzoffsetMinutes: 60, + // rawValue: '2019:09:26 07:44:30+01:00' }, + // FileCreateDate: + // { year: 2019, + // month: 9, + // day: 26, + // hour: 7, + // minute: 44, + // second: 30, + // millisecond: 0, + // tzoffsetMinutes: 60, + // rawValue: '2019:09:26 07:44:30+01:00' }, + // FilePermissions: 'rw-rw-rw-', + // FileType: 'MP4', + // FileTypeExtension: 'mp4', + // MIMEType: 'video/mp4', + // MajorBrand: 'MP4 Base Media v1 [IS0 14496-12:2003]', + // MinorVersion: '0.2.0', + // CompatibleBrands: [ 'isom', 'iso2', 'avc1', 'mp41' ], + // MovieDataSize: 0, + // MovieDataOffset: 1051515, + // MovieHeaderVersion: 0, + // CreateDate: + // { year: 1970, + // month: 1, + // day: 8, + // hour: 0, + // minute: 0, + // second: 0, + // millisecond: 0, + // rawValue: '1970:01:08 00:00:00' }, + // ModifyDate: + // { year: 2014, + // month: 7, + // day: 19, + // hour: 17, + // minute: 15, + // second: 29, + // millisecond: 0, + // rawValue: '2014:07:19 17:15:29' }, + // TimeScale: 1000, + // PreferredRate: 1, + // PreferredVolume: '100.00%', + // PreviewTime: '0 s', + // PosterTime: '0 s', + // SelectionTime: '0 s', + // CurrentTime: '0 s', + // NextTrackID: 3, + // TrackHeaderVersion: 0, + // TrackCreateDate: '0000:00:00 00:00:00', + // TrackModifyDate: '0000:00:00 00:00:00', + // TrackID: 1, + // TrackLayer: 0, + // TrackVolume: '0.00%', + // ImageWidth: 1280, + // ImageHeight: 720, + // GraphicsMode: 'srcCopy', + // OpColor: '0 0 0', + // CompressorID: 'avc1', + // SourceImageWidth: 1280, + // SourceImageHeight: 720, + // XResolution: 72, + // YResolution: 72, + // BitDepth: 24, + // VideoFrameRate: 25, + // MatrixStructure: '1 0 0 0 1 0 0 0 1', + // MediaHeaderVersion: 0, + // MediaCreateDate: '0000:00:00 00:00:00', + // MediaModifyDate: '0000:00:00 00:00:00', + // MediaTimeScale: 48000, + // MediaLanguageCode: 'und', + // HandlerDescription: 'SoundHandler', + // Balance: 0, + // AudioFormat: 'mp4a', + // AudioChannels: 2, + // AudioBitsPerSample: 16, + // AudioSampleRate: 48000, + // HandlerType: 'Metadata', + // HandlerVendorID: 'Apple', + // Encoder: 'Lavf53.24.2', + // Title: 'Sample title test', + // Composer: 'th', + // BeatsPerMinute: '', + // ContentCreateDate: 2018, + // Genre: 'this', + // Artist: 'hhj', + // Comment: 'hhk', + // Subtitle: 'jj', + // Mood: 'lik', + // ContentDistributor: 'cont', + // Conductor: 'jo', + // Writer: 'writ', + // InitialKey: 'ho', + // Producer: 'prod', + // ParentalRating: 'par', + // Director: 'dir', + // Period: 'pol', + // Publisher: 'pub', + // PromotionURL: 'prom', + // AuthorURL: 'auth', + // EncodedBy: 'enc', + // Category: 'h', + // ImageSize: '1280x720', + // Megapixels: 0.922, + // AvgBitrate: '1.58 Mbps', + // Rotation: 0 }, + // processingStatus: false, + // video_codec_name: 'h264', + // video_resolution: '720p' } From 07784116535cd44be102e9e5b03becfa59bd3fbb Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Thu, 6 Feb 2020 22:54:37 +0100 Subject: [PATCH 031/104] Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio Plugin that checks for unwanted audio, per 1.104 beta you can change the languages yourself from within Tdarr! Untill you enter a value it keep english tracks by default. Undefined languages are kept to prevent videos without sound. If you would like to keep track of the languages you have for each file you can use the 'special' option. --- ...Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio new file mode 100644 index 0000000..f9869be --- /dev/null +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio @@ -0,0 +1,119 @@ +const exec = require('child_process').exec; +const fs = require('fs'); + +function details() { + return { + id: "Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio", + Name: "Remove non-English audio", + Type: "Audio", + Operation:"Remove Audio", + 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", + 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"` + }, + { + 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".` + } + ] + } +} + +function plugin(file, librarySettings, inputs, otherArguments) { + if (inputs.languages == null) { + var languages = ["eng", "en"]; //these languages should be kept, named according to ISO 639-2 language scheme + } else { + var languages = inputs.languages.split(','); //these languages should be kept, named according to ISO 639-2 language scheme + } + if (inputs.special !== null) { + var special = inputs.special.split(','); + } + if (languages.length >= special.length) { + var length = languages.length; + } else { + var length = special.length; + } + var transcode = 0; //if this becomes '1' it will be transcoded + var sourcename = file.meta.FileName.substring(0, file.meta.FileName.lastIndexOf(".")); //filename without extension + var specialcheck = ``; //contains the txt string if special language was found + var wanted = 0; + var audio = 0; + + //default response + var response = { + processFile: false, + preset: `, -map 0:v`, + container: '.mkv', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: 'Removing unwanted audio...\n', + }; + + for (i = 0; i < file.ffProbeData.streams.length; i++) { + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { + //check for non-english tracks + if (file.ffProbeData.streams[i].tags.language) { + if (typeof file.ffProbeData.streams[i].tags.language !== 'undefined') { + for (l = 0; l < length; l++) { + if (file.ffProbeData.streams[i].tags.language == special[l]) { + if (!fs.existsSync(otherArguments.homePath + `/Tdarr/special_audio_${special[l]}.txt`)) { //create txt file if it doesn't exist yet + exec(`echo "${sourcename}" >> ${otherArguments.homePath}/Tdarr/special_audio_${special[l]}.txt`); //first file will be added and file is created + console.log(`added to txt: ` + sourcename); + } else { + specialcheck = fs.readFileSync(otherArguments.homePath + `/Tdarr/special_audio_${special[l]}.txt`).toString(); //create string from existing file + if (!specialcheck.includes(sourcename)) { //only add the filename if it wasn't added already + exec(`echo "${sourcename}" >> ${otherArguments.homePath}/Tdarr/special_audio_${special[l]}.txt`); + console.log(`added to txt: ` + sourcename); + } + } + + response.preset += ` -map 0:${i}`; + response.infoLog += `Found special ${special[l]}: ${i}\n`; + wanted++; + break; + } else if (file.ffProbeData.streams[i].tags.language == languages[l]) { + response.preset += ` -map 0:${i}`; + response.infoLog += `Found wanted ${languages[l]}: ${i}\n`; + wanted++; + break; + } + } + } else { + response.preset += ` -map 0:${i}`; + response.infoLog += `Added undefined: ${i}\n`; + wanted++; + } + } else { + response.preset += ` -map 0:${i}`; + response.infoLog += `Added undefined: ${i}\n`; + wanted++; + } + + audio++; + } + } + + if (audio > wanted && wanted > 1) { + transcode = 1; + } + + if (transcode == 1) { + response.infoLog += `Found unwanted audio\nIt will be removed\n`; + response.processFile = true; + response.FFmpegMode = true; + response.preset += ` -map 0:s? -c copy`; + response.reQueueAfter = true; + } else { + response.infoLog += `No unwanted audio found!\n`; + } + + return response +} + +module.exports.details = details; +module.exports.plugin = plugin; From f61b225095d7c4c88488a0e608145d154191d158 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Thu, 6 Feb 2020 23:08:29 +0100 Subject: [PATCH 032/104] Update Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio --- Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio index f9869be..033e5cb 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio @@ -4,7 +4,7 @@ const fs = require('fs'); function details() { return { id: "Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio", - Name: "Remove non-English audio", + Name: "Keep Preffered Audio", Type: "Audio", Operation:"Remove Audio", 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", @@ -24,7 +24,7 @@ function details() { } function plugin(file, librarySettings, inputs, otherArguments) { - if (inputs.languages == null) { + if (inputs.languages == "") { var languages = ["eng", "en"]; //these languages should be kept, named according to ISO 639-2 language scheme } else { var languages = inputs.languages.split(','); //these languages should be kept, named according to ISO 639-2 language scheme @@ -37,6 +37,7 @@ function plugin(file, librarySettings, inputs, otherArguments) { } else { var length = special.length; } + console.log(languages); var transcode = 0; //if this becomes '1' it will be transcoded var sourcename = file.meta.FileName.substring(0, file.meta.FileName.lastIndexOf(".")); //filename without extension var specialcheck = ``; //contains the txt string if special language was found From 3286e34d87217e3074b0342e88ea6517604e7d66 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Thu, 6 Feb 2020 23:10:04 +0100 Subject: [PATCH 033/104] Update Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio --- Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio index 033e5cb..2c80b8c 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio @@ -5,7 +5,7 @@ function details() { return { id: "Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio", Name: "Keep Preffered Audio", - Type: "Audio", + Type: "Video", Operation:"Remove Audio", 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", From 1abb17d809cb608133b073b0db628c6341179b14 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Thu, 6 Feb 2020 23:29:43 +0100 Subject: [PATCH 034/104] forgot .js extension --- ...ferred_Audio => Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Community/{Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio => Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js} (100%) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js similarity index 100% rename from Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio rename to Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js From 29f4785b69bbb921f28d4fde0f73026a47ac7f49 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Thu, 6 Feb 2020 23:52:57 +0100 Subject: [PATCH 035/104] Updated inputs, iso-639-2 auto install on any OS Updated for 1.104 beta to support inputs. change install_packages to yes to automatically install the node_module that is required for this plugin. ISO-639-2 node module can now be installed on any system automatically! Only tested on Linux but should hypothetically work on other OS too. --- .../Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 122 +++++++++++------- 1 file changed, 77 insertions(+), 45 deletions(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index 8b7a619..c4ba044 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -1,33 +1,25 @@ const fs = require('fs'); +const execSync = require('child_process').execSync; function details() { return { id: "Tdarr_Plugin_e5c3_CnT_Add_Subtitles", - Stage: "Pre-processing", Name: "Add subtitles to MKV files", Type: "Video", Operation:"Remux", - Description: `Add subtitles. READ THIS!! You must run "npm install iso-639-2" in the folder "/home/Tdarr/Documents" for this plugin to work. This is a plugin that will check for subtitles, they should be named according to the ISO 639-2 language code.`, - Version: "1.00", + 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", + Inputs: [ + { + name: 'install_packages', + tooltip: `Please change this to "yes", it allows the plugin to install the required nodemodule. (iso-639-2)` + }, + ] } } -function plugin(file) { - //Additional packages used here so details function above will still work if packages aren't installed - const iso6392 = require('/home/Tdarr/Documents/node_modules/iso-639-2'); - - var i = 0; //int for counting lang[position] - var sub = 0; //becomes first subtitle stream - var lang = iso6392; //languages to check against - var path = file.meta.Directory; //path of media folder - var exist = 0; //if the language exists should be added this becomes 1 - var new_subs = 0 //count the new subs - var added_subs = 0; //counts the amount of subs that have been mapped - var preset_import = ''; - var preset_meta = ''; - - +function plugin(file, librarySettings, inputs, otherArguments) { //default response var response = { processFile: false, @@ -36,50 +28,86 @@ function plugin(file) { handBrakeMode: false, FFmpegMode: false, reQueueAfter: false, - infoLog: `Testing for subtitles...\nPath: ${path}\n`, + infoLog: `Searching new subtitles...\n`, } - //find first subtitle stream - while (file.ffProbeData.streams[sub].codec_type.toLowerCase() != "subtitle") { - sub++ + if (inputs.install_packages == "yes") { + if (!fs.existsSync(`${otherArguments.homePath}/Tdarr/node_modules/iso-639-2`)) { + execSync(`cd ${otherArguments.homePath}/Tdarr \n npm install iso-639-2`); + } + } else { + response.infoLog = `Please take a look at the input options\n A extra nodemodule is required.` + return response; } - response.infoLog += `The first subtitle stream is ${sub}\n` + if (fs.existsSync(`/home/Tdarr/Documents/Tdarr/node_modules/iso-639-2`)) { + var iso6392 = require('/home/Tdarr/Documents/Tdarr/node_modules/iso-639-2'); + } else { + response.infoLog += `Nodemodule iso-639-2 isn't installed!\nTry Again` + return response; + } + + var i = 0; //int for counting lang[position] + var found_subtitle_stream = 0; + var sub = 0; //becomes first subtitle stream + var lang = iso6392; //languages to check against + var path = file.meta.Directory; //path of media folder + var exist = 0; //if the language exists should be added this becomes 1 + var new_subs = 0 //count the new subs + var added_subs = 0; //counts the amount of subs that have been mapped + var preset_import = ''; + var preset_meta = ''; + + //find first subtitle stream + while (found_subtitle_stream == 0 && sub < file.ffProbeData.streams.length) { + if (file.ffProbeData.streams[sub].codec_type.toLowerCase() == "subtitle") { + found_subtitle_stream = 1; + } else { + sub++; + } + } + + response.infoLog += `Path: ${path}\n`; for (i = 0; i < lang.length; i++) { - //check if srt exists in folder + //check if srt file exists in folder if (fs.existsSync(`${path}/${lang[i].iso6392B}.srt`)) { - response.infoLog += `Found subtitle ${lang[i].name}\n` + response.infoLog += `Found subtitle ${lang[i].name}.srt\n`; - //check if language already exists - for (sub_stream = sub; sub_stream < file.ffProbeData.streams.length; sub_stream++) { - response.infoLog += `does ${lang[i].name} exist in stream ${sub_stream}?\n` - if (file.ffProbeData.streams[sub_stream].tags.language.toLowerCase() == lang[i].iso6392B) { - response.infoLog += `YES\n` - exist = 1; - } else { - response.infoLog += `NO\n` + if (found_subtitle_stream == 1) { + //check if language already exists + for (sub_stream = sub; sub_stream < file.ffProbeData.streams.length; sub_stream++) { + //response.infoLog += `does ${lang[i].name} exist in stream ${sub_stream}?\n` + if (file.ffProbeData.streams[sub_stream].tags.language) { + if (file.ffProbeData.streams[sub_stream].tags.language.toLowerCase() == lang[i].iso6392B) { + //response.infoLog += `YES\n` + exist = 1; + response.infoLog += `Language already exists in stream ${sub_stream}\n It will not be added\n`; + } + } } + } else { + exist = 0; } //add if it hasn't found the language if (exist != 1) { - preset_import += ` -sub_charenc "UTF-8" -f srt -i "${path}/${lang[i].iso6392B}.srt"` - preset_meta += ` -metadata:s:s:${new_subs} language=${lang[i].iso6392B}` - new_subs++ + preset_import += ` -sub_charenc "UTF-8" -f srt -i "${path}/${lang[i].iso6392B}.srt"`; + preset_meta += ` -metadata:s:s:${new_subs} language=${lang[i].iso6392B}`; + new_subs++; } - } else { - response.infoLog += `did not find sub ${lang[i].iso6392B}.srt\n` - } + } + //else { + // response.infoLog += `did not find sub ${lang[i].iso6392B}.srt\n` + //} exist = 0; } - response.infoLog += `${new_subs} new subs will be added\n` response.preset += ` ${preset_import}${preset_meta} -map 0:v -map 0:a` //map new subs while (added_subs < new_subs) { - added_subs++ - response.preset += ` -map ${added_subs}:s` + added_subs++; + response.preset += ` -map ${added_subs}:s`; } //if new subs have been found they will be added @@ -87,12 +115,16 @@ function plugin(file) { response.FFmpegMode = true; response.processFile = true; response.reQueueAfter = true; - response.preset += ` -map 0:s -c copy` + if (found_subtitle_stream == 1) { + response.preset += ` -map 0:s `; + } + response.preset += ` -c copy`; + response.infoLog += `${new_subs} new subs will be added\n`; } else { - response.infoLog += `No new subtitle languages were found\n` + response.infoLog += `No new subtitle languages were found\n`; } - response.infoLog += `The ffmpeg string is: ${response.preset}\n` + //response.infoLog += `The ffmpeg string is: ${response.preset}\n` return response } From baa6d2fd5c1852531b1547488dcd4de22a15ec4d Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 7 Feb 2020 00:33:42 +0100 Subject: [PATCH 036/104] Stage: "Pre-processing" added --- Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index c4ba044..373d420 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -4,6 +4,7 @@ const execSync = require('child_process').execSync; function details() { return { id: "Tdarr_Plugin_e5c3_CnT_Add_Subtitles", + Stage: "Pre-processing", Name: "Add subtitles to MKV files", Type: "Video", Operation:"Remux", From 52f50ffc2c097f31603a219b87cc816cd0ba21c0 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 7 Feb 2020 00:35:53 +0100 Subject: [PATCH 037/104] Stage: "Pre-processing" added --- Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js index 2c80b8c..6e72d7d 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js @@ -4,6 +4,7 @@ const fs = require('fs'); function details() { return { id: "Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio", + Stage: "Pre-processing", Name: "Keep Preffered Audio", Type: "Video", Operation:"Remove Audio", From 8799c6ab5b75b071065ec5025a05ef0dd3acc84d Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 7 Feb 2020 00:38:13 +0100 Subject: [PATCH 038/104] Tdarr_Plugin_e5c3_CnT_Remove_Letterbox Uses iiDrakeii's filter, and crops video files when letterboxing is detected. This uses the FFMPEG NVENC transcoding(hw). If a file is 4K it will be scaled down to 1080p. Now with user definable bitrates!(since 1.104 beta) --- .../Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js | 394 ++++++++++++++++++ 1 file changed, 394 insertions(+) create mode 100644 Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js new file mode 100644 index 0000000..9657947 --- /dev/null +++ b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js @@ -0,0 +1,394 @@ +const fs = require('fs'); +const execSync = require('child_process').execSync; + +function details() { + return { + id: "Tdarr_Plugin_e5c3_CnT_Remove_Letterbox", + Stage: "Pre-processing", + Name: "Remove letterbox", + Type: "Video", + Operation:"Transcode", + Description: `Uses iiDrakeii's filter, and crops video files when letterboxing is detected.\nThis uses the FFMPEG NVENC transcoding(hw).\nIf a file is 4K it will be scaled down to 1080p.\nNow with user definable bitrates!(since 1.104 beta)\nCreated by @control#0405`, + Version: "1.2", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js", + Inputs: [ + { + name: 'bitrate', + tooltip: `Desired bitrate for a 1080p video, minimum transcode size is based of this too!\n 720p will be half of 1080p, 480p will be half of 720p.\nThe default is '3000', this value is based of movies.\nI would suggest 1500-2000 for series.` + }, + ] + } +} + +function plugin(file, librarySettings, inputs) { + console.log(inputs.bitrate); + if (inputs.bitrate == "") { + var min_bitrate = 6600; + var avg_rate = 3000; + var max_rate = 6000; + } else { + var min_bitrate = inputs.bitrate*2.2; + var avg_rate = inputs.bitrate; + var max_rate = inputs.bitrate*2; + } + + + var source = file.meta.SourceFile; //source file + var dir = file.meta.Directory; //source directory + var sourcename = file.meta.FileName.substring(0, file.meta.FileName.lastIndexOf(".")); //filename without extension + var cropfile = `${dir}/${sourcename}.txt`; //location and name of the crop file + var min_crop = parseInt(file.meta.ImageHeight*.98); //if the crop value is larger than this the file won't be cropped + var duration = file.meta.Duration; //duration of video in seconds + var stats = fs.statSync(source); + var size = stats["size"]/1000000000; + size = size.toFixed(2); + var decoder = decoder_string(file); //decoder, before the input + var encoder = encoder_string_full(file, highres(file), crop_decider(file, create_crop_values(file).crop_height).crop, avg_rate, max_rate); //encoder + var process = 0; //decides if it should be processed + + //default values that will be returned + var response = { + processFile: false, + preset: '', + container: '.mkv', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: true, + infoLog: '' + } + + var returns = { + create_crop: create_crop_values(file), + crop: crop_decider(file, create_crop_values(file).crop_height), + size: size_check(file, min_bitrate) + } + + var transcode = { + hevc: hevc(file), //if it's not hevc it will be processed, unless file size is too small + highres: highres(file) //changes to '1' if it's 4k, it should be transcoded to 1080p + } + + var log = { + size: returns.size.log, + hevc: ``, + resolution: ``, + crop: returns.crop.log, + createcrop: returns.create_crop.log + } + + //check if the file is a video + //if (file.fileMedium !== "video") { + // response.infoLog += `☒ - File is not a video \n` + // return response; + //} else { + // response.infoLog += `☑ - File is a video \n` + //} + + //filters + if (size_check(file, min_bitrate).size == 1) { + if (hevc(file) == 1) { + process = 1; + log.hevc = `☑ - Video is not HEVC \n`; + } else { + log.hevc += "☒ - File is already in HEVC \n" + } + + if (highres(file) == 1) { + process = 1; + log.resolution += `☑ - Resolution > 1080p.\n File will be transcoded to 1080p \n`; + } else { + log.resolution += `☒ - Resolution <= 1080p \n`; + } + + if (crop_decider(file, create_crop_values(file).crop_height).crop != "0") { + process = 1; + } + } + + response.infoLog += log.createcrop + + log.crop + + log.resolution + + log.size + + log.hevc; + + //change response + if (process == 1) { + response.processFile = true; + response.FFmpegMode = true; + response.infoLog += `File will be processed\n`; + response.preset = `${decoder}, -map 0:v:0 -map 0:a -map 0:s? ${encoder}` + response.reQueueAfter = true; + } else { + response.infoLog += `Processing not necessary\n`; + } + + return response; +} + +function highres(file) { + //if file is larger than 1080p it should be transcoded + if (file.meta.ImageWidth > 1920) { + return 1; + } else { + return 0; + } +} + +function create_crop_values(file) { + var source = file.meta.SourceFile; //source file + var dir = file.meta.Directory; //source directory + var sourcename = file.meta.FileName.substring(0, file.meta.FileName.lastIndexOf(".")); //filename without extension + var cropfile = `${dir}/${sourcename}.txt`; //location and name of the crop file + var returns = { + crop_height: 0, //return value for this function, required for crop_decider + log: `` + } + //delete old crop value if it exists + //if (fs.existsSync(`${cropfile}`)) { + // returns.log += `removing old cropvalues...\n`; + // fs.unlinkSync(`${cropfile}`); + //} + + //create crop value + if (!fs.existsSync(`${cropfile}`)) { + returns.log += `Creating crop values...\n`; + execSync(`ffmpeg -ss 300 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 > \"${cropfile}\"`); + execSync(`ffmpeg -ss 1200 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 >> \"${cropfile}\"`); + //get data from copvalue.txt + var data = fs.readFileSync(`${cropfile}`).toString().split("\n"); //full data from cropvalue.txt + //get height of the supposed cropped video + //var crop_height = parseInt(data[0].substring(10, 14)); + + for (var c = 0; c < data.length; c++) { + if (parseInt(data[c].substring(10, 14)) > returns.crop_height) { + returns.crop_height = parseInt(data[c].substring(10, 14)); + returns.log += `New cropheight: ${parseInt(data[c].substring(10, 14))}\n`; + } + } + } else { + returns.log += `Crop values already exist\n`; + + var data = fs.readFileSync(`${cropfile}`).toString().split("\n"); //full data from cropvalue.txt + //get height of the supposed cropped video + //var crop_height = parseInt(data[0].substring(10, 14)); + + for (var c = 0; c < data.length; c++) { + if (parseInt(data[c].substring(10, 14)) > returns.crop_height) { + returns.crop_height = parseInt(data[c].substring(10, 14)); + returns.log += `New cropheight: ${parseInt(data[c].substring(10, 14))}\n`; + } + } + } + + return returns; +} + +function hevc(file) { + //check if the file is already hevc, it will not be transcoded if true + if ("hevc".toLowerCase().includes(file.ffProbeData.streams[0].codec_name.toLowerCase())) { + return 0; + } else { + return 1; + } +} + +function decoder_string(file) { + var decoder = ``; //decoder, before the input + + //use the correct decoder + if (file.video_codec_name == 'h263') { + decoder = `-c:v h263_cuvid` + } + else if (file.video_codec_name == 'h264') { + if (file.ffProbeData.streams[0].profile != 'High 10') { //Remove HW Decoding for High 10 Profile + decoder = `-c:v h264_cuvid` + } + } + else if (file.video_codec_name == 'mjpeg') { + decoder = `c:v mjpeg_cuvid` + } + else if (file.video_codec_name == 'mpeg1') { + decoder = `-c:v mpeg1_cuvid` + } + else if (file.video_codec_name == 'mpeg2') { + decoder = `-c:v mpeg2_cuvid` + } + else if (file.video_codec_name == 'vc1') { + decoder = `-c:v vc1_cuvid` + } + else if (file.video_codec_name == 'vp8') { + decoder = `-c:v vp8_cuvid` + } + else if (file.video_codec_name == 'vp9') { + decoder = `-c:v vp9_cuvid` + } + + return decoder; +} + +function crop_decider(file, crop_height) { + var min_crop = parseInt(file.meta.ImageHeight*.98); //if the crop value is larger than this the file won't be cropped + var returns = { + crop: `0`, //sets the crop filter + log: ``, + } + + //tree for resolution : quality + if (file.meta.ImageWidth >= 1300) { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) + //crop only if it is a larger crop than 1%; + if (crop_height < min_crop) { + var crop_hdis = parseInt((file.meta.ImageHeight-crop_height)/2); + if (crop_height >= 790) { + returns.crop = `-filter:0 crop=1920:${crop_height}:0:${crop_hdis}`; + returns.log += `☑ - crop is larger than 1%\n`; + } + } else { + returns.log += `☒ - Crop is not necessary\n`; + } + } else if(file.meta.ImageWidth < 1300 && file.meta.ImageWidth >= 770) { + //crop only if it is a larger crop than 1%; + if (crop_height < min_crop) { + var crop_hdis = parseInt((file.meta.ImageHeight-crop_height)/2); + if (crop_height >= 530) { + returns.crop = `-filter:0 crop=1280:${crop_height}:0:${crop_hdis}`; + returns.log += `☑ - crop is larger than 1%\n`; + } + } else { + returns.log += `☒ - Crop is not necessary\n`; + } + } else if(file.meta.ImageWidth < 770) { //file won't be cropped at this resolution + returns.log += `No crop: Resolution < 720p\n`; + } + + return returns; +} + +function size_check(file, min_bitrate) { + var duration = file.meta.Duration; //duration of video in seconds + var source = file.meta.SourceFile; //source file + var stats = fs.statSync(source); + var size = stats["size"]/1000000000; + size = size.toFixed(2); + var returns = { + size: 0, + log: `` + } + + //tree for resolution : quality + if (file.meta.ImageWidth >= 1300) { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) + var min_transcode_size = (min_bitrate * duration * 0.125)/1000000; //minimum size in GB for transcode + min_transcode_size = min_transcode_size.toFixed(2); + + console.log(min_bitrate) + + //check if file is large enough for transcode + if (size >= (min_bitrate * duration * 0.125)/1000000) { + returns.log += `☑ - ${size}GB > ${min_transcode_size}GB\n`; + returns.size = 1; + } else { + returns.log += `☒ - ${size}GB < ${min_transcode_size}GB\n`; + } + } else if(file.meta.ImageWidth < 1300 && file.meta.ImageWidth >= 770) { //file will be encoded if the resolution is 720p + var min_transcode_size = ((min_bitrate/2) * duration * 0.125)/1000000; //minimum size in GB for transcode + min_transcode_size = min_transcode_size.toFixed(2); + + //check if file is large enough for transcode + if (size >= ((min_bitrate/2) * duration * 0.125)/1000000) { + returns.log += `☑ - ${size}GB > ${min_transcode_size}GB\n`; + returns.size = 1; + } else { + returns.log += `☒ - ${size}GB < ${min_transcode_size}GB\n`; + } + } else if(file.meta.ImageWidth < 770) { //file will be encoded if the resolution is 480p or 576p + var min_transcode_size = ((min_bitrate/4) * duration * 0.125)/1000000; //minimum size in GB for transcode + min_transcode_size = min_transcode_size.toFixed(2); + + //check if file is large enough for transcode + if (size >= ((min_bitrate/4) * duration * 0.125)/1000000) { + returns.log += `☑ - ${size}GB > ${min_transcode_size}GB\n`; + returns.size = 1; + } else { + returns.log += `☒ - ${size}GB < ${min_transcode_size}GB\n`; + } + } + + return returns; +} + +function error_fix(file) { + var fix = { + sub_codec: 0, //changes to 1 if unwanted codec is found + muxing: 0 + } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + + //these subtitle codecs don't fit in a mkv container + if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "mov_text" && file.ffProbeData.streams[i].codec_type.toLowerCase.includes("sub")) { + fix.sub_codec = 1; + } + + //mitigate TrueHD audio causing Too many packets error + if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "truehd" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "dts" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" ) { + fix.muxing = 1; + } + + } + + return fix; +} + +function encoder_string(file, avg_rate, max_rate) { + var encoder = ``; //encoder + var fix = error_fix(file); + var sub = ``; + + console.log(avg_rate); + + //tree for resolution : quality + if (file.meta.ImageWidth >= 1300) { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) + encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate}k -maxrate:v ${max_rate}k`; //-qp 26 + } else if(file.meta.ImageWidth < 1300 && file.meta.ImageWidth >= 770) { //file will be encoded if the resolution is 720p + encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate/2}k -maxrate:v ${max_rate/2}k`; //-qp 28 + } else if(file.meta.ImageWidth < 770) { //file will be encoded if the resolution is 480p or 576p + encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate/4}k -maxrate:v ${max_rate/4}k`; //-qp 30 + } + encoder += ` -c:v hevc_nvenc -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -dn`; + + if (fix.sub_codec == 1) { + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "mov_text" && file.ffProbeData.streams[i].codec_type.toLowerCase().includes("sub")) { + sub += ` -c:${i} ass`; + } else { + if (file.ffProbeData.streams[i].codec_type.toLowerCase().includes("sub")) { + sub += ` -c:${i} copy`; + } + } + } + } else { + sub = ` -c:s copy` + } + + if (fix.muxing == 1) { + encoder += ` -max_muxing_queue_size 2048`; + } + + return encoder + ` -c:a copy` + sub; +} + +function encoder_string_full(file, highres, crop, avg_rate, max_rate) { + var encoder = encoder_string(file, avg_rate, max_rate); + + if (highres == 1 && crop != "0") { + return crop + `,scale=-1:1920 ` + encoder; + } else if (highres == 1) { + return `-filter:0 scale=-1:1920 ` + encoder; + } else if (crop != "0") { + return crop + encoder; + } else { + return encoder; + } +} + +module.exports.details = details; +module.exports.plugin = plugin; From 73a1ee0704ba3849153ecdf7e0c69a17bf15be9b Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 7 Feb 2020 00:39:06 +0100 Subject: [PATCH 039/104] Updated link --- 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 6e72d7d..4631388 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js @@ -10,7 +10,7 @@ function details() { Operation:"Remove Audio", 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", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js", Inputs: [ { name: 'languages', From 426227d8edd01350450b34b9a77d96a3811c57b5 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 7 Feb 2020 00:47:19 +0100 Subject: [PATCH 040/104] Updated inputs, iso-639-2 auto install on any OS Updated for 1.104 beta to support inputs. change install_packages to yes to automatically install the node_module that is required for this plugin. ISO-639-2 node module can now be installed on any system automatically! Only tested on Linux but should hypothetically work on other OS too. --- Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index 373d420..89a5d70 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -125,8 +125,6 @@ function plugin(file, librarySettings, inputs, otherArguments) { response.infoLog += `No new subtitle languages were found\n`; } - //response.infoLog += `The ffmpeg string is: ${response.preset}\n` - return response } From 207ef9d42225dfbf3db8a0239df3fcbfc0079863 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 7 Feb 2020 01:05:07 +0100 Subject: [PATCH 041/104] updated link --- Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js | 4 +++- 1 file changed, 3 insertions(+), 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 4631388..a9e4568 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js @@ -30,8 +30,10 @@ function plugin(file, librarySettings, inputs, otherArguments) { } else { var languages = inputs.languages.split(','); //these languages should be kept, named according to ISO 639-2 language scheme } - if (inputs.special !== null) { + if (inputs.special !== "") { var special = inputs.special.split(','); + } else { + var special = ``; } if (languages.length >= special.length) { var length = languages.length; 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 042/104] 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 043/104] 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 044/104] 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 045/104] 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 046/104] 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 047/104] 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 048/104] 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 049/104] 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 050/104] 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 051/104] 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 052/104] 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 053/104] 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 054/104] 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 055/104] 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) + + if (targetBitrate == "0") { + response.processFile = false + response.infoLog += "☒Target bitrate could not be calculated. Skipping this plugin. \n" + 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` + 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 056/104] 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 057/104] 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 058/104] 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 059/104] 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 060/104] 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 061/104] 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 062/104] 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 063/104] 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 064/104] 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 f86d8c98fe15ae21b58fe3d4528d38d844eb129e Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 14 Feb 2020 10:26:54 +0100 Subject: [PATCH 065/104] Update Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js --- Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js index a9e4568..95c9ca4 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js @@ -11,6 +11,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_Keep_Preferred_Audio.js", + Tags:'pre-processing,ffmpeg,audio only,configurable', Inputs: [ { name: 'languages', From e208cb8266ace1dca15e21cd5e82f61bd45f055e Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 14 Feb 2020 10:30:44 +0100 Subject: [PATCH 066/104] Tags --- Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index 89a5d70..5ce10f7 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -11,6 +11,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', From de2146e786f77561d4b0a1c3d6336db50ed605e4 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 14 Feb 2020 10:35:25 +0100 Subject: [PATCH 067/104] Added force processing and muxing for container force processing will make sure the file gets transcoded even if the filters don't match. It will still look at the resolution, the file won't be cropped. If the container doesn't match the preferred container and all filters already match it will be muxed to the desired container. --- .../Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js | 88 ++++++++++--------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js index 9657947..10c46dc 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js @@ -9,19 +9,22 @@ function details() { Type: "Video", Operation:"Transcode", Description: `Uses iiDrakeii's filter, and crops video files when letterboxing is detected.\nThis uses the FFMPEG NVENC transcoding(hw).\nIf a file is 4K it will be scaled down to 1080p.\nNow with user definable bitrates!(since 1.104 beta)\nCreated by @control#0405`, - Version: "1.2", + Version: "1.3", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js", Inputs: [ { name: 'bitrate', - tooltip: `Desired bitrate for a 1080p video, minimum transcode size is based of this too!\n 720p will be half of 1080p, 480p will be half of 720p.\nThe default is '3000', this value is based of movies.\nI would suggest 1500-2000 for series.` + tooltip: `Desired bitrate for a 1080p video, minimum transcode size is based of this too!\\n 720p will be half of 1080p, 480p will be half of 720p.\\nThe default is '3000', this value is based of movies.\\nI would suggest 1500-2000 for series.\\nExample:\\n3000` + }, + { + name: 'container', + tooltip: `Enter the output container of the new file.\\n Default: .mkv\\nExample:\\n.mkv` }, ] } } -function plugin(file, librarySettings, inputs) { - console.log(inputs.bitrate); +function plugin(file, librarySettings, inputs, otherArguments) { if (inputs.bitrate == "") { var min_bitrate = 6600; var avg_rate = 3000; @@ -31,14 +34,10 @@ function plugin(file, librarySettings, inputs) { var avg_rate = inputs.bitrate; var max_rate = inputs.bitrate*2; } - var source = file.meta.SourceFile; //source file var dir = file.meta.Directory; //source directory var sourcename = file.meta.FileName.substring(0, file.meta.FileName.lastIndexOf(".")); //filename without extension - var cropfile = `${dir}/${sourcename}.txt`; //location and name of the crop file - var min_crop = parseInt(file.meta.ImageHeight*.98); //if the crop value is larger than this the file won't be cropped - var duration = file.meta.Duration; //duration of video in seconds var stats = fs.statSync(source); var size = stats["size"]/1000000000; size = size.toFixed(2); @@ -52,10 +51,15 @@ function plugin(file, librarySettings, inputs) { preset: '', container: '.mkv', handBrakeMode: false, - FFmpegMode: false, + FFmpegMode: true, reQueueAfter: true, infoLog: '' } + + if (inputs.container !== undefined) { + response.container = inputs.container; + console.log(`Changed container to: ` + inputs.container); + } var returns = { create_crop: create_crop_values(file), @@ -63,11 +67,6 @@ function plugin(file, librarySettings, inputs) { size: size_check(file, min_bitrate) } - var transcode = { - hevc: hevc(file), //if it's not hevc it will be processed, unless file size is too small - highres: highres(file) //changes to '1' if it's 4k, it should be transcoded to 1080p - } - var log = { size: returns.size.log, hevc: ``, @@ -75,22 +74,14 @@ function plugin(file, librarySettings, inputs) { crop: returns.crop.log, createcrop: returns.create_crop.log } - - //check if the file is a video - //if (file.fileMedium !== "video") { - // response.infoLog += `☒ - File is not a video \n` - // return response; - //} else { - // response.infoLog += `☑ - File is a video \n` - //} //filters if (size_check(file, min_bitrate).size == 1) { if (hevc(file) == 1) { - process = 1; log.hevc = `☑ - Video is not HEVC \n`; } else { log.hevc += "☒ - File is already in HEVC \n" + process = 1; } if (highres(file) == 1) { @@ -110,14 +101,19 @@ function plugin(file, librarySettings, inputs) { log.resolution + log.size + log.hevc; + response.preset = `${decoder}, -map 0:v:0 -map 0:a -map 0:s? ${encoder}` //change response if (process == 1) { response.processFile = true; - response.FFmpegMode = true; response.infoLog += `File will be processed\n`; - response.preset = `${decoder}, -map 0:v:0 -map 0:a -map 0:s? ${encoder}` - response.reQueueAfter = true; + } else if (file.forceProcessing === true) { + response.processFile = true; + response.infoLog += `Force processing!\n`; + } else if (response.container !== `.` + file.container) { + response.infoLog += `Container is not correct\nMuxing to ${response.container}!\n`; + response.preset = `${decoder}, -c copy`; + response.processFile = true; } else { response.infoLog += `Processing not necessary\n`; } @@ -227,17 +223,25 @@ function decoder_string(file) { } function crop_decider(file, crop_height) { - var min_crop = parseInt(file.meta.ImageHeight*.98); //if the crop value is larger than this the file won't be cropped var returns = { crop: `0`, //sets the crop filter log: ``, } + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + if (file.ffProbeData.streams[i].width !== undefined) { + var imageWidth = file.ffProbeData.streams[i].width; + var imageHeight = file.ffProbeData.streams[i].height; + break; + } + } + var min_crop = parseInt(imageHeight*.98); //if the crop value is larger than this the file won't be cropped + //tree for resolution : quality - if (file.meta.ImageWidth >= 1300) { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) + if (imageWidth >= 1300) { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) //crop only if it is a larger crop than 1%; if (crop_height < min_crop) { - var crop_hdis = parseInt((file.meta.ImageHeight-crop_height)/2); + var crop_hdis = parseInt((imageHeight-crop_height)/2); if (crop_height >= 790) { returns.crop = `-filter:0 crop=1920:${crop_height}:0:${crop_hdis}`; returns.log += `☑ - crop is larger than 1%\n`; @@ -245,10 +249,10 @@ function crop_decider(file, crop_height) { } else { returns.log += `☒ - Crop is not necessary\n`; } - } else if(file.meta.ImageWidth < 1300 && file.meta.ImageWidth >= 770) { + } else if(imageWidth < 1300 && file.meta.ImageWidth >= 770) { //crop only if it is a larger crop than 1%; if (crop_height < min_crop) { - var crop_hdis = parseInt((file.meta.ImageHeight-crop_height)/2); + var crop_hdis = parseInt((imageHeight-crop_height)/2); if (crop_height >= 530) { returns.crop = `-filter:0 crop=1280:${crop_height}:0:${crop_hdis}`; returns.log += `☑ - crop is larger than 1%\n`; @@ -256,7 +260,7 @@ function crop_decider(file, crop_height) { } else { returns.log += `☒ - Crop is not necessary\n`; } - } else if(file.meta.ImageWidth < 770) { //file won't be cropped at this resolution + } else if(imageWidth < 770) { //file won't be cropped at this resolution returns.log += `No crop: Resolution < 720p\n`; } @@ -275,12 +279,10 @@ function size_check(file, min_bitrate) { } //tree for resolution : quality - if (file.meta.ImageWidth >= 1300) { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) + if (file.video_resolution === "1080p" || file.video_resolution === "4KUHD") { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) var min_transcode_size = (min_bitrate * duration * 0.125)/1000000; //minimum size in GB for transcode min_transcode_size = min_transcode_size.toFixed(2); - console.log(min_bitrate) - //check if file is large enough for transcode if (size >= (min_bitrate * duration * 0.125)/1000000) { returns.log += `☑ - ${size}GB > ${min_transcode_size}GB\n`; @@ -288,7 +290,7 @@ function size_check(file, min_bitrate) { } else { returns.log += `☒ - ${size}GB < ${min_transcode_size}GB\n`; } - } else if(file.meta.ImageWidth < 1300 && file.meta.ImageWidth >= 770) { //file will be encoded if the resolution is 720p + } else if(file.video_resolution === "720p") { //file will be encoded if the resolution is 720p var min_transcode_size = ((min_bitrate/2) * duration * 0.125)/1000000; //minimum size in GB for transcode min_transcode_size = min_transcode_size.toFixed(2); @@ -299,7 +301,7 @@ function size_check(file, min_bitrate) { } else { returns.log += `☒ - ${size}GB < ${min_transcode_size}GB\n`; } - } else if(file.meta.ImageWidth < 770) { //file will be encoded if the resolution is 480p or 576p + } else if(file.video_resolution === "480p" || file.video_resolution === "576p") { //file will be encoded if the resolution is 480p or 576p var min_transcode_size = ((min_bitrate/4) * duration * 0.125)/1000000; //minimum size in GB for transcode min_transcode_size = min_transcode_size.toFixed(2); @@ -324,7 +326,7 @@ function error_fix(file) { for (var i = 0; i < file.ffProbeData.streams.length; i++) { //these subtitle codecs don't fit in a mkv container - if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "mov_text" && file.ffProbeData.streams[i].codec_type.toLowerCase.includes("sub")) { + if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "mov_text" && file.ffProbeData.streams[i].codec_type.toLowerCase.includes("sub") && response.container == '.mkv') { fix.sub_codec = 1; } @@ -343,14 +345,12 @@ function encoder_string(file, avg_rate, max_rate) { var fix = error_fix(file); var sub = ``; - console.log(avg_rate); - //tree for resolution : quality - if (file.meta.ImageWidth >= 1300) { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) + if (file.video_resolution === "1080p" || file.video_resolution === "4KUHD") { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate}k -maxrate:v ${max_rate}k`; //-qp 26 - } else if(file.meta.ImageWidth < 1300 && file.meta.ImageWidth >= 770) { //file will be encoded if the resolution is 720p + } else if(file.video_resolution === "720p") { //file will be encoded if the resolution is 720p encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate/2}k -maxrate:v ${max_rate/2}k`; //-qp 28 - } else if(file.meta.ImageWidth < 770) { //file will be encoded if the resolution is 480p or 576p + } else if(file.video_resolution === "480p" || file.video_resolution === "576p") { //file will be encoded if the resolution is 480p or 576p encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate/4}k -maxrate:v ${max_rate/4}k`; //-qp 30 } encoder += ` -c:v hevc_nvenc -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -dn`; @@ -379,6 +379,8 @@ function encoder_string(file, avg_rate, max_rate) { function encoder_string_full(file, highres, crop, avg_rate, max_rate) { var encoder = encoder_string(file, avg_rate, max_rate); + console.log(`crop filter: ` + crop) + if (highres == 1 && crop != "0") { return crop + `,scale=-1:1920 ` + encoder; } else if (highres == 1) { From 3d71c47c55f351dd851403f0f61a08165395ef03 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 14 Feb 2020 10:39:11 +0100 Subject: [PATCH 068/104] Tags --- Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js index 10c46dc..cc4219c 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js @@ -11,6 +11,7 @@ function details() { Description: `Uses iiDrakeii's filter, and crops video files when letterboxing is detected.\nThis uses the FFMPEG NVENC transcoding(hw).\nIf a file is 4K it will be scaled down to 1080p.\nNow with user definable bitrates!(since 1.104 beta)\nCreated by @control#0405`, Version: "1.3", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js", + Tags: 'h265,hevc,nvenc h265,ffmpeg,pre-processing,configurable', Inputs: [ { name: 'bitrate', 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 069/104] 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 070/104] 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 071/104] 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 072/104] 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 073/104] 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 074/104] 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 075/104] 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 076/104] 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 077/104] 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 078/104] 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 079/104] 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 080/104] 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 081/104] 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 082/104] 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 083/104] 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 (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 + 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` 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 084/104] 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 085/104] 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 086/104] 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 087/104] 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 088/104] 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 089/104] 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 090/104] 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 091/104] 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 092/104] 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 093/104] 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 094/104] 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 095/104] 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 e2cc0aaa7face2f315c4be7f8079f1c134fda416 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 2 Apr 2020 12:42:40 +0100 Subject: [PATCH 096/104] FFmpeg path change --- Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js index cc4219c..0554484 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js @@ -149,8 +149,8 @@ function create_crop_values(file) { //create crop value if (!fs.existsSync(`${cropfile}`)) { returns.log += `Creating crop values...\n`; - execSync(`ffmpeg -ss 300 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 > \"${cropfile}\"`); - execSync(`ffmpeg -ss 1200 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 >> \"${cropfile}\"`); + execSync(otherArguments.ffmpegPath + ` -ss 300 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 > \"${cropfile}\"`); + execSync(otherArguments.ffmpegPath + ` -ss 1200 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 >> \"${cropfile}\"`); //get data from copvalue.txt var data = fs.readFileSync(`${cropfile}`).toString().split("\n"); //full data from cropvalue.txt //get height of the supposed cropped video 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 097/104] 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) + +} + From 773a6c12fc5cbe51192c97571bc88afb83d66bc7 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 3 Apr 2020 18:38:54 +0200 Subject: [PATCH 098/104] Delete auto_crop script --- .../Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js | 397 ------------------ 1 file changed, 397 deletions(-) delete mode 100644 Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js deleted file mode 100644 index 0554484..0000000 --- a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js +++ /dev/null @@ -1,397 +0,0 @@ -const fs = require('fs'); -const execSync = require('child_process').execSync; - -function details() { - return { - id: "Tdarr_Plugin_e5c3_CnT_Remove_Letterbox", - Stage: "Pre-processing", - Name: "Remove letterbox", - Type: "Video", - Operation:"Transcode", - Description: `Uses iiDrakeii's filter, and crops video files when letterboxing is detected.\nThis uses the FFMPEG NVENC transcoding(hw).\nIf a file is 4K it will be scaled down to 1080p.\nNow with user definable bitrates!(since 1.104 beta)\nCreated by @control#0405`, - Version: "1.3", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js", - Tags: 'h265,hevc,nvenc h265,ffmpeg,pre-processing,configurable', - Inputs: [ - { - name: 'bitrate', - tooltip: `Desired bitrate for a 1080p video, minimum transcode size is based of this too!\\n 720p will be half of 1080p, 480p will be half of 720p.\\nThe default is '3000', this value is based of movies.\\nI would suggest 1500-2000 for series.\\nExample:\\n3000` - }, - { - name: 'container', - tooltip: `Enter the output container of the new file.\\n Default: .mkv\\nExample:\\n.mkv` - }, - ] - } -} - -function plugin(file, librarySettings, inputs, otherArguments) { - if (inputs.bitrate == "") { - var min_bitrate = 6600; - var avg_rate = 3000; - var max_rate = 6000; - } else { - var min_bitrate = inputs.bitrate*2.2; - var avg_rate = inputs.bitrate; - var max_rate = inputs.bitrate*2; - } - - var source = file.meta.SourceFile; //source file - var dir = file.meta.Directory; //source directory - var sourcename = file.meta.FileName.substring(0, file.meta.FileName.lastIndexOf(".")); //filename without extension - var stats = fs.statSync(source); - var size = stats["size"]/1000000000; - size = size.toFixed(2); - var decoder = decoder_string(file); //decoder, before the input - var encoder = encoder_string_full(file, highres(file), crop_decider(file, create_crop_values(file).crop_height).crop, avg_rate, max_rate); //encoder - var process = 0; //decides if it should be processed - - //default values that will be returned - var response = { - processFile: false, - preset: '', - container: '.mkv', - handBrakeMode: false, - FFmpegMode: true, - reQueueAfter: true, - infoLog: '' - } - - if (inputs.container !== undefined) { - response.container = inputs.container; - console.log(`Changed container to: ` + inputs.container); - } - - var returns = { - create_crop: create_crop_values(file), - crop: crop_decider(file, create_crop_values(file).crop_height), - size: size_check(file, min_bitrate) - } - - var log = { - size: returns.size.log, - hevc: ``, - resolution: ``, - crop: returns.crop.log, - createcrop: returns.create_crop.log - } - - //filters - if (size_check(file, min_bitrate).size == 1) { - if (hevc(file) == 1) { - log.hevc = `☑ - Video is not HEVC \n`; - } else { - log.hevc += "☒ - File is already in HEVC \n" - process = 1; - } - - if (highres(file) == 1) { - process = 1; - log.resolution += `☑ - Resolution > 1080p.\n File will be transcoded to 1080p \n`; - } else { - log.resolution += `☒ - Resolution <= 1080p \n`; - } - - if (crop_decider(file, create_crop_values(file).crop_height).crop != "0") { - process = 1; - } - } - - response.infoLog += log.createcrop + - log.crop + - log.resolution + - log.size + - log.hevc; - response.preset = `${decoder}, -map 0:v:0 -map 0:a -map 0:s? ${encoder}` - - //change response - if (process == 1) { - response.processFile = true; - response.infoLog += `File will be processed\n`; - } else if (file.forceProcessing === true) { - response.processFile = true; - response.infoLog += `Force processing!\n`; - } else if (response.container !== `.` + file.container) { - response.infoLog += `Container is not correct\nMuxing to ${response.container}!\n`; - response.preset = `${decoder}, -c copy`; - response.processFile = true; - } else { - response.infoLog += `Processing not necessary\n`; - } - - return response; -} - -function highres(file) { - //if file is larger than 1080p it should be transcoded - if (file.meta.ImageWidth > 1920) { - return 1; - } else { - return 0; - } -} - -function create_crop_values(file) { - var source = file.meta.SourceFile; //source file - var dir = file.meta.Directory; //source directory - var sourcename = file.meta.FileName.substring(0, file.meta.FileName.lastIndexOf(".")); //filename without extension - var cropfile = `${dir}/${sourcename}.txt`; //location and name of the crop file - var returns = { - crop_height: 0, //return value for this function, required for crop_decider - log: `` - } - //delete old crop value if it exists - //if (fs.existsSync(`${cropfile}`)) { - // returns.log += `removing old cropvalues...\n`; - // fs.unlinkSync(`${cropfile}`); - //} - - //create crop value - if (!fs.existsSync(`${cropfile}`)) { - returns.log += `Creating crop values...\n`; - execSync(otherArguments.ffmpegPath + ` -ss 300 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 > \"${cropfile}\"`); - execSync(otherArguments.ffmpegPath + ` -ss 1200 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 >> \"${cropfile}\"`); - //get data from copvalue.txt - var data = fs.readFileSync(`${cropfile}`).toString().split("\n"); //full data from cropvalue.txt - //get height of the supposed cropped video - //var crop_height = parseInt(data[0].substring(10, 14)); - - for (var c = 0; c < data.length; c++) { - if (parseInt(data[c].substring(10, 14)) > returns.crop_height) { - returns.crop_height = parseInt(data[c].substring(10, 14)); - returns.log += `New cropheight: ${parseInt(data[c].substring(10, 14))}\n`; - } - } - } else { - returns.log += `Crop values already exist\n`; - - var data = fs.readFileSync(`${cropfile}`).toString().split("\n"); //full data from cropvalue.txt - //get height of the supposed cropped video - //var crop_height = parseInt(data[0].substring(10, 14)); - - for (var c = 0; c < data.length; c++) { - if (parseInt(data[c].substring(10, 14)) > returns.crop_height) { - returns.crop_height = parseInt(data[c].substring(10, 14)); - returns.log += `New cropheight: ${parseInt(data[c].substring(10, 14))}\n`; - } - } - } - - return returns; -} - -function hevc(file) { - //check if the file is already hevc, it will not be transcoded if true - if ("hevc".toLowerCase().includes(file.ffProbeData.streams[0].codec_name.toLowerCase())) { - return 0; - } else { - return 1; - } -} - -function decoder_string(file) { - var decoder = ``; //decoder, before the input - - //use the correct decoder - if (file.video_codec_name == 'h263') { - decoder = `-c:v h263_cuvid` - } - else if (file.video_codec_name == 'h264') { - if (file.ffProbeData.streams[0].profile != 'High 10') { //Remove HW Decoding for High 10 Profile - decoder = `-c:v h264_cuvid` - } - } - else if (file.video_codec_name == 'mjpeg') { - decoder = `c:v mjpeg_cuvid` - } - else if (file.video_codec_name == 'mpeg1') { - decoder = `-c:v mpeg1_cuvid` - } - else if (file.video_codec_name == 'mpeg2') { - decoder = `-c:v mpeg2_cuvid` - } - else if (file.video_codec_name == 'vc1') { - decoder = `-c:v vc1_cuvid` - } - else if (file.video_codec_name == 'vp8') { - decoder = `-c:v vp8_cuvid` - } - else if (file.video_codec_name == 'vp9') { - decoder = `-c:v vp9_cuvid` - } - - return decoder; -} - -function crop_decider(file, crop_height) { - var returns = { - crop: `0`, //sets the crop filter - log: ``, - } - - for (var i = 0; i < file.ffProbeData.streams.length; i++) { - if (file.ffProbeData.streams[i].width !== undefined) { - var imageWidth = file.ffProbeData.streams[i].width; - var imageHeight = file.ffProbeData.streams[i].height; - break; - } - } - var min_crop = parseInt(imageHeight*.98); //if the crop value is larger than this the file won't be cropped - - //tree for resolution : quality - if (imageWidth >= 1300) { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) - //crop only if it is a larger crop than 1%; - if (crop_height < min_crop) { - var crop_hdis = parseInt((imageHeight-crop_height)/2); - if (crop_height >= 790) { - returns.crop = `-filter:0 crop=1920:${crop_height}:0:${crop_hdis}`; - returns.log += `☑ - crop is larger than 1%\n`; - } - } else { - returns.log += `☒ - Crop is not necessary\n`; - } - } else if(imageWidth < 1300 && file.meta.ImageWidth >= 770) { - //crop only if it is a larger crop than 1%; - if (crop_height < min_crop) { - var crop_hdis = parseInt((imageHeight-crop_height)/2); - if (crop_height >= 530) { - returns.crop = `-filter:0 crop=1280:${crop_height}:0:${crop_hdis}`; - returns.log += `☑ - crop is larger than 1%\n`; - } - } else { - returns.log += `☒ - Crop is not necessary\n`; - } - } else if(imageWidth < 770) { //file won't be cropped at this resolution - returns.log += `No crop: Resolution < 720p\n`; - } - - return returns; -} - -function size_check(file, min_bitrate) { - var duration = file.meta.Duration; //duration of video in seconds - var source = file.meta.SourceFile; //source file - var stats = fs.statSync(source); - var size = stats["size"]/1000000000; - size = size.toFixed(2); - var returns = { - size: 0, - log: `` - } - - //tree for resolution : quality - if (file.video_resolution === "1080p" || file.video_resolution === "4KUHD") { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) - var min_transcode_size = (min_bitrate * duration * 0.125)/1000000; //minimum size in GB for transcode - min_transcode_size = min_transcode_size.toFixed(2); - - //check if file is large enough for transcode - if (size >= (min_bitrate * duration * 0.125)/1000000) { - returns.log += `☑ - ${size}GB > ${min_transcode_size}GB\n`; - returns.size = 1; - } else { - returns.log += `☒ - ${size}GB < ${min_transcode_size}GB\n`; - } - } else if(file.video_resolution === "720p") { //file will be encoded if the resolution is 720p - var min_transcode_size = ((min_bitrate/2) * duration * 0.125)/1000000; //minimum size in GB for transcode - min_transcode_size = min_transcode_size.toFixed(2); - - //check if file is large enough for transcode - if (size >= ((min_bitrate/2) * duration * 0.125)/1000000) { - returns.log += `☑ - ${size}GB > ${min_transcode_size}GB\n`; - returns.size = 1; - } else { - returns.log += `☒ - ${size}GB < ${min_transcode_size}GB\n`; - } - } else if(file.video_resolution === "480p" || file.video_resolution === "576p") { //file will be encoded if the resolution is 480p or 576p - var min_transcode_size = ((min_bitrate/4) * duration * 0.125)/1000000; //minimum size in GB for transcode - min_transcode_size = min_transcode_size.toFixed(2); - - //check if file is large enough for transcode - if (size >= ((min_bitrate/4) * duration * 0.125)/1000000) { - returns.log += `☑ - ${size}GB > ${min_transcode_size}GB\n`; - returns.size = 1; - } else { - returns.log += `☒ - ${size}GB < ${min_transcode_size}GB\n`; - } - } - - return returns; -} - -function error_fix(file) { - var fix = { - sub_codec: 0, //changes to 1 if unwanted codec is found - muxing: 0 - } - - for (var i = 0; i < file.ffProbeData.streams.length; i++) { - - //these subtitle codecs don't fit in a mkv container - if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "mov_text" && file.ffProbeData.streams[i].codec_type.toLowerCase.includes("sub") && response.container == '.mkv') { - fix.sub_codec = 1; - } - - //mitigate TrueHD audio causing Too many packets error - if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "truehd" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "dts" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" ) { - fix.muxing = 1; - } - - } - - return fix; -} - -function encoder_string(file, avg_rate, max_rate) { - var encoder = ``; //encoder - var fix = error_fix(file); - var sub = ``; - - //tree for resolution : quality - if (file.video_resolution === "1080p" || file.video_resolution === "4KUHD") { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) - encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate}k -maxrate:v ${max_rate}k`; //-qp 26 - } else if(file.video_resolution === "720p") { //file will be encoded if the resolution is 720p - encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate/2}k -maxrate:v ${max_rate/2}k`; //-qp 28 - } else if(file.video_resolution === "480p" || file.video_resolution === "576p") { //file will be encoded if the resolution is 480p or 576p - encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate/4}k -maxrate:v ${max_rate/4}k`; //-qp 30 - } - encoder += ` -c:v hevc_nvenc -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -dn`; - - if (fix.sub_codec == 1) { - for (var i = 0; i < file.ffProbeData.streams.length; i++) { - if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "mov_text" && file.ffProbeData.streams[i].codec_type.toLowerCase().includes("sub")) { - sub += ` -c:${i} ass`; - } else { - if (file.ffProbeData.streams[i].codec_type.toLowerCase().includes("sub")) { - sub += ` -c:${i} copy`; - } - } - } - } else { - sub = ` -c:s copy` - } - - if (fix.muxing == 1) { - encoder += ` -max_muxing_queue_size 2048`; - } - - return encoder + ` -c:a copy` + sub; -} - -function encoder_string_full(file, highres, crop, avg_rate, max_rate) { - var encoder = encoder_string(file, avg_rate, max_rate); - - console.log(`crop filter: ` + crop) - - if (highres == 1 && crop != "0") { - return crop + `,scale=-1:1920 ` + encoder; - } else if (highres == 1) { - return `-filter:0 scale=-1:1920 ` + encoder; - } else if (crop != "0") { - return crop + encoder; - } else { - return encoder; - } -} - -module.exports.details = details; -module.exports.plugin = plugin; From 333ade3cadf0e9c909c4e28711e233d6d1042944 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 3 Apr 2020 18:39:45 +0200 Subject: [PATCH 099/104] Latest updates to add subtitles --- Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index 5ce10f7..65e7136 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -11,12 +11,15 @@ 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', tooltip: `Please change this to "yes", it allows the plugin to install the required nodemodule. (iso-639-2)` }, + { + name: 'container', + tooltip: `Enter the output container of the new file.\\n Default: .mkv\\nExample:\\n.mkv` + }, ] } } @@ -32,6 +35,11 @@ function plugin(file, librarySettings, inputs, otherArguments) { reQueueAfter: false, infoLog: `Searching new subtitles...\n`, } + + if (inputs.container !== undefined) { + response.container = inputs.container; + console.log(`Changed container to: ` + inputs.container); + } if (inputs.install_packages == "yes") { if (!fs.existsSync(`${otherArguments.homePath}/Tdarr/node_modules/iso-639-2`)) { @@ -126,6 +134,8 @@ function plugin(file, librarySettings, inputs, otherArguments) { response.infoLog += `No new subtitle languages were found\n`; } + //response.infoLog += `The ffmpeg string is: ${response.preset}\n` + return response } From 4c5bf97dd849ffd84a1743655d0a957897e71989 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 3 Apr 2020 18:40:43 +0200 Subject: [PATCH 100/104] Latest updates to Keep_Preferred_Audio --- ...rr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js index 95c9ca4..10326a7 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js @@ -6,35 +6,38 @@ function details() { id: "Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio", Stage: "Pre-processing", Name: "Keep Preffered Audio", - Type: "Video", + Type: "Audio", Operation:"Remove Audio", 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_Keep_Preferred_Audio.js", - Tags:'pre-processing,ffmpeg,audio only,configurable', + Version: "1.2", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Remove_non_English_Audio.js", 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:\\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:\\eng,dut` + }, + { + name: 'container', + tooltip: `Enter the output container of the new file.\\n Default: .mkv\\nExample:\\n.mkv` + }, ] } } function plugin(file, librarySettings, inputs, otherArguments) { - if (inputs.languages == "") { + if (inputs.languages == "" || inputs.special == 'undefined') { var languages = ["eng", "en"]; //these languages should be kept, named according to ISO 639-2 language scheme } else { - var languages = inputs.languages.split(','); //these languages should be kept, named according to ISO 639-2 language scheme + var languages = inputs.languages.toLowerCase().split(','); //these languages should be kept, named according to ISO 639-2 language scheme } - if (inputs.special !== "") { - var special = inputs.special.split(','); - } else { + if (inputs.special == "" || inputs.special == 'undefined') { var special = ``; + } else { + var special = inputs.special.toLowerCase().split(','); } if (languages.length >= special.length) { var length = languages.length; @@ -59,6 +62,11 @@ function plugin(file, librarySettings, inputs, otherArguments) { infoLog: 'Removing unwanted audio...\n', }; + if (inputs.container !== undefined) { + response.container = inputs.container; + console.log(`Changed container to: ` + inputs.container); + } + for (i = 0; i < file.ffProbeData.streams.length; i++) { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { //check for non-english tracks @@ -86,6 +94,8 @@ function plugin(file, librarySettings, inputs, otherArguments) { response.infoLog += `Found wanted ${languages[l]}: ${i}\n`; wanted++; break; + } else if (i == length-1) { + response.infoLog += `Found unwanted: ${file.ffProbeData.streams[i].tags.language}: ${i}\n`; } } } else { @@ -103,7 +113,7 @@ function plugin(file, librarySettings, inputs, otherArguments) { } } - if (audio > wanted && wanted > 1) { + if (audio > wanted && wanted > 0) { transcode = 1; } From bc8b9474ddd3b968d978bd5b03931c6ae8e7d315 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Fri, 3 Apr 2020 18:47:11 +0200 Subject: [PATCH 101/104] Fixed link --- Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js index 10326a7..113dde9 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js @@ -10,7 +10,7 @@ function details() { Operation:"Remove Audio", 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.2", - Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Remove_non_English_Audio.js", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js", Inputs: [ { name: 'languages', @@ -23,7 +23,7 @@ function details() { { name: 'container', tooltip: `Enter the output container of the new file.\\n Default: .mkv\\nExample:\\n.mkv` - }, + } ] } } From bd60ba87090f423080be2fe48ab7e67d9968e039 Mon Sep 17 00:00:00 2001 From: controlol <46456214+controlol@users.noreply.github.com> Date: Sat, 4 Apr 2020 17:59:59 +0200 Subject: [PATCH 102/104] Create Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js Uses iiDrakeii's filter, and crops video files when letterboxing is detected.\nThis uses the FFMPEG NVENC transcoding(hw).\nIf a file is 4K it will be scaled down to 1080p.\nNow with user definable bitrates!(since 1.104 beta)\nCreated by @control#0405 --- .../Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js | 386 ++++++++++++++++++ 1 file changed, 386 insertions(+) create mode 100644 Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js new file mode 100644 index 0000000..697b8d1 --- /dev/null +++ b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js @@ -0,0 +1,386 @@ +const fs = require('fs'); +const execSync = require('child_process').execSync; + +function details() { + return { + id: "Tdarr_Plugin_e5c3_CnT_Remove_Letterbox", + Stage: "Pre-processing", + Name: "Remove letterbox", + Type: "Video", + Operation:"Transcode", + Description: `Uses iiDrakeii's filter, and crops video files when letterboxing is detected.\nThis uses the FFMPEG NVENC transcoding(hw).\nIf a file is 4K it will be scaled down to 1080p.\nNow with user definable bitrates!(since 1.104 beta)\nCreated by @control#0405`, + Version: "1.4", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js", + Inputs: [ + { + name: 'bitrate', + tooltip: `Desired bitrate for a 1080p video, minimum transcode size is based of this too!\\n 720p will be half of 1080p, 480p will be half of 720p.\\nThe default is '3000', this value is based of movies.\\nI would suggest 1500-2000 for series.\\nExample:\\n3000` + }, + { + name: 'container', + tooltip: `Enter the output container of the new file.\\n Default: .mkv\\nExample:\\n.mkv` + }, + ] + } +} + +function plugin(file, librarySettings, inputs, otherArguments) { + if (inputs.bitrate == "" || inputs.special == 'undefined') { + var min_bitrate = 6600; + var avg_rate = 3000; + var max_rate = 6000; + } else { + var min_bitrate = inputs.bitrate*2.2; + var avg_rate = inputs.bitrate; + var max_rate = inputs.bitrate*2; + } + + var source = file.meta.SourceFile; //source file + var stats = fs.statSync(source); + var size = stats["size"]/1000000000; + size = size.toFixed(2); + var decoder = decoder_string(file); //decoder, before the input + var encoder = encoder_string_full(file, highres(file), crop_decider(file, create_crop_values(file).crop_height).crop, avg_rate, max_rate); //encoder + var process = 0; //decides if it should be processed + + //default values that will be returned + var response = { + processFile: false, + preset: '', + container: '.mkv', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: '' + } + + if (inputs.container !== undefined) { + response.container = inputs.container; + console.log(`Changed container to: ` + inputs.container); + } + + var returns = { + create_crop: create_crop_values(file), + crop: crop_decider(file, create_crop_values(file).crop_height), + size: size_check(file, min_bitrate) + } + + var log = { + size: returns.size.log, + hevc: ``, + resolution: ``, + crop: returns.crop.log, + createcrop: returns.create_crop.log + } + + //filters + if (size_check(file, min_bitrate).size == 1) { + if (hevc(file) == 1) { + log.hevc = `☑ - Video is not HEVC \n`; + process = 1; + } else { + log.hevc += "☒ - File is already in HEVC \n" + } + + if (highres(file) == 1) { + process = 1; + log.resolution += `☑ - Resolution > 1080p.\n File will be transcoded to 1080p \n`; + } else { + log.resolution += `☒ - Resolution <= 1080p \n`; + } + + if (crop_decider(file, create_crop_values(file).crop_height).crop != "0") { + process = 1; + } + } + + response.infoLog += log.createcrop + + log.crop + + log.resolution + + log.size + + log.hevc; + response.preset = `${decoder}, -map 0:v:0 -map 0:a -map 0:s? ${encoder}` + + //change response + if (process == 1) { + response.processFile = true; + response.infoLog += `File will be processed\n`; + } else if (file.forceProcessing === true) { + response.processFile = true; + response.infoLog += `Force processing!\n`; + } else if (response.container !== `.` + file.container) { + response.infoLog += `Container is not correct\nMuxing to ${response.container}!\n`; + response.preset = `${decoder}, -c copy`; + response.processFile = true; + } else { + response.infoLog += `Processing not necessary\n`; + } + + return response; +} + +function highres(file) { + //if file is larger than 1080p it should be transcoded + if (file.meta.ImageWidth > 1920) { + return 1; + } else { + return 0; + } +} + +function create_crop_values(file) { + var source = file.meta.SourceFile; //source file + var dir = file.meta.Directory; //source directory + var sourcename = file.meta.FileName.substring(0, file.meta.FileName.lastIndexOf(".")); //filename without extension + var cropfile = `${dir}/${sourcename}.txt`; //location and name of the crop file + var returns = { + crop_height: 0, //return value for this function, required for crop_decider + log: `` + } + + //create crop value + if (!fs.existsSync(`${cropfile}`)) { + returns.log += `Creating crop values...\n`; + execSync(`otherArguments.ffmpegPath -ss 300 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 > \"${cropfile}\"`); + execSync(`otherArguments.ffmpegPath -ss 1200 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 >> \"${cropfile}\"`); + } else { + returns.log += `Crop values already exist\n`; + } + + //get data from copvalue.txt + var data = fs.readFileSync(`${cropfile}`).toString().split("\n"); //full data from cropvalue.txt + + //get height of the supposed cropped video + //var crop_height = parseInt(data[0].substring(10, 14)); + for (var c = 0; c < data.length; c++) { + if (parseInt(data[c].substring(10, 14)) > returns.crop_height) { + returns.crop_height = parseInt(data[c].substring(10, 14)); + returns.log += `New cropheight: ${parseInt(data[c].substring(10, 14))}\n`; + } + } + return returns; +} + +function hevc(file) { + //check if the file is already hevc, it will not be transcoded if true + if (file.ffProbeData.streams[0].codec_name) { + if ("hevc".toLowerCase().includes(file.ffProbeData.streams[0].codec_name.toLowerCase())) { + return 0; + } else { + return 1; + } + } +} + +function decoder_string(file) { + var decoder = ``; //decoder, before the input + + //use the correct decoder + if (file.video_codec_name == 'h263') { + decoder = `-c:v h263_cuvid` + } + else if (file.video_codec_name == 'h264') { + if (file.ffProbeData.streams[0].profile != 'High 10') { //Remove HW Decoding for High 10 Profile + decoder = `-c:v h264_cuvid` + } + } + else if (file.video_codec_name == 'mjpeg') { + decoder = `c:v mjpeg_cuvid` + } + else if (file.video_codec_name == 'mpeg1') { + decoder = `-c:v mpeg1_cuvid` + } + else if (file.video_codec_name == 'mpeg2') { + decoder = `-c:v mpeg2_cuvid` + } + else if (file.video_codec_name == 'vc1') { + decoder = `-c:v vc1_cuvid` + } + else if (file.video_codec_name == 'vp8') { + decoder = `-c:v vp8_cuvid` + } + else if (file.video_codec_name == 'vp9') { + decoder = `-c:v vp9_cuvid` + } + + return decoder; +} + +function crop_decider(file, crop_height) { + var returns = { + crop: `0`, //sets the crop filter + log: ``, + } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + if (file.ffProbeData.streams[i].width !== undefined) { + var imageWidth = file.ffProbeData.streams[i].width; + var imageHeight = file.ffProbeData.streams[i].height; + break; + } + } + + var min_crop = parseInt(imageHeight*.98); //if the crop value is larger than this the file won't be cropped + + //tree for resolution : quality + if (imageWidth >= 1300) { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) + //crop only if it is a larger crop than 1%; + if (crop_height < min_crop) { + var crop_hdis = parseInt((imageHeight-crop_height)/2); + if (crop_height >= 790) { + returns.crop = `-filter:0 crop=${imageWidth}:${crop_height}:0:${crop_hdis}`; + returns.log += `☑ - crop is larger than 1%\n`; + } + } else { + returns.log += `☒ - Crop is not necessary\n`; + } + } else if(imageWidth < 1300 && file.meta.ImageWidth >= 770) { + //crop only if it is a larger crop than 1%; + if (crop_height < min_crop) { + var crop_hdis = parseInt((imageHeight-crop_height)/2); + if (crop_height >= 530) { + returns.crop = `-filter:0 crop=${imageWidth}:${crop_height}:0:${crop_hdis}`; + returns.log += `☑ - crop is larger than 1%\n`; + } + } else { + returns.log += `☒ - Crop is not necessary\n`; + } + } else if(imageWidth < 770) { //file won't be cropped at this resolution + returns.log += `No crop: Resolution < 720p\n`; + } + + return returns; +} + +function size_check(file, min_bitrate) { + var duration = file.meta.Duration; //duration of video in seconds + var source = file.meta.SourceFile; //source file + var stats = fs.statSync(source); + var size = stats["size"]/1000000000; + size = size.toFixed(2); + var returns = { + size: 0, + log: `` + } + + //tree for resolution : quality + if (file.video_resolution === "1080p" || file.video_resolution === "4KUHD") { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) + var min_transcode_size = (min_bitrate * duration * 0.125)/1000000; //minimum size in GB for transcode + min_transcode_size = min_transcode_size.toFixed(2); + + //check if file is large enough for transcode + if (size >= (min_bitrate * duration * 0.125)/1000000) { + returns.log += `☑ - ${size}GB > ${min_transcode_size}GB\n`; + returns.size = 1; + } else { + returns.log += `☒ - ${size}GB < ${min_transcode_size}GB\n`; + } + } else if(file.video_resolution === "720p") { //file will be encoded if the resolution is 720p + var min_transcode_size = ((min_bitrate/2) * duration * 0.125)/1000000; //minimum size in GB for transcode + min_transcode_size = min_transcode_size.toFixed(2); + + //check if file is large enough for transcode + if (size >= ((min_bitrate/2) * duration * 0.125)/1000000) { + returns.log += `☑ - ${size}GB > ${min_transcode_size}GB\n`; + returns.size = 1; + } else { + returns.log += `☒ - ${size}GB < ${min_transcode_size}GB\n`; + } + } else if(file.video_resolution === "480p" || file.video_resolution === "576p") { //file will be encoded if the resolution is 480p or 576p + var min_transcode_size = ((min_bitrate/4) * duration * 0.125)/1000000; //minimum size in GB for transcode + min_transcode_size = min_transcode_size.toFixed(2); + + //check if file is large enough for transcode + if (size >= ((min_bitrate/4) * duration * 0.125)/1000000) { + returns.log += `☑ - ${size}GB > ${min_transcode_size}GB\n`; + returns.size = 1; + } else { + returns.log += `☒ - ${size}GB < ${min_transcode_size}GB\n`; + } + } + + return returns; +} + +function error_fix(file) { + var fix = { + sub_codec: 0, //changes to 1 if unwanted codec is found + muxing: 0 + } + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + + //these subtitle codecs don't fit in a mkv container + if (file.ffProbeData.streams[i].codec_name && file.ffProbeData.streams[i].codec_type) { + if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "mov_text" && file.ffProbeData.streams[i].codec_type.toLowerCase.includes("sub") && response.container == '.mkv') { + fix.sub_codec = 1; + } + + //mitigate TrueHD audio causing Too many packets error + if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "truehd" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "dts" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" ) { + fix.muxing = 1; + } + } + } + + return fix; +} + +function encoder_string(file, avg_rate, max_rate) { + var encoder = ``; //encoder + var fix = error_fix(file); + var sub = ``; + + //tree for resolution : quality + if (file.video_resolution === "1080p" || file.video_resolution === "4KUHD") { //file will be encoded if the resolution is 1080p, or greater (it will be downscaled) + encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate}k -maxrate:v ${max_rate}k`; //-qp 26 + } else if(file.video_resolution === "720p") { //file will be encoded if the resolution is 720p + encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate/2}k -maxrate:v ${max_rate/2}k`; //-qp 28 + } else if(file.video_resolution === "480p" || file.video_resolution === "576p") { //file will be encoded if the resolution is 480p or 576p + encoder += ` -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 26 -b:v ${avg_rate/4}k -maxrate:v ${max_rate/4}k`; //-qp 30 + } + encoder += ` -c:v hevc_nvenc -preset slow -rc-lookahead 32 -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -dn`; + + if (fix.sub_codec == 1) { + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + if (file.ffProbeData.streams[i].codec_name) { + if (file.ffProbeData.streams[i].codec_name.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name.toLowerCase() == "mov_text" && file.ffProbeData.streams[i].codec_type.toLowerCase().includes("sub")) { + sub += ` -c:${i} ass`; + } else { + if (file.ffProbeData.streams[i].codec_type) { + if (file.ffProbeData.streams[i].codec_type.toLowerCase().includes("sub")) { + sub += ` -c:${i} copy`; + } + } + } + } + } + } else { + sub = ` -c:s copy` + } + + if (fix.muxing == 1) { + encoder += ` -max_muxing_queue_size 2048`; + } + + return encoder + ` -c:a copy` + sub; +} + +function encoder_string_full(file, highres, crop, avg_rate, max_rate) { + var encoder = encoder_string(file, avg_rate, max_rate); + + console.log(`crop filter: ` + crop) + + if (highres == 1 && crop != "0") { + return crop + `,scale=-1:1920 ` + encoder; + } else if (highres == 1) { + return `-filter:0 scale=-1:1920 ` + encoder; + } else if (crop != "0") { + return crop + encoder; + } else { + return encoder; + } +} + +module.exports.details = details; +module.exports.plugin = plugin; From 9af181680d87ac7e7189d53221ccfbad26db1002 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 4 Apr 2020 17:07:38 +0100 Subject: [PATCH 103/104] tags --- Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js index 697b8d1..3134077 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js @@ -20,7 +20,8 @@ function details() { name: 'container', tooltip: `Enter the output container of the new file.\\n Default: .mkv\\nExample:\\n.mkv` }, - ] + ], + Tags:'pre-processing,video only,ffmpeg,configurable', } } From 1e67bd74c1a52593634e906c3a855dc215809933 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 4 Apr 2020 17:10:58 +0100 Subject: [PATCH 104/104] Move variable outside of string --- Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js index 3134077..98bb3a2 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js @@ -142,8 +142,8 @@ function create_crop_values(file) { //create crop value if (!fs.existsSync(`${cropfile}`)) { returns.log += `Creating crop values...\n`; - execSync(`otherArguments.ffmpegPath -ss 300 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 > \"${cropfile}\"`); - execSync(`otherArguments.ffmpegPath -ss 1200 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 >> \"${cropfile}\"`); + execSync(otherArguments.ffmpegPath + ` -ss 300 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 > \"${cropfile}\"`); + execSync(otherArguments.ffmpegPath + ` -ss 1200 -i \"${source}\" -frames:v 240 -vf cropdetect -f null - 2>&1 | awk \'/crop/ { print $NF }\' | tail -240 >> \"${cropfile}\"`); } else { returns.log += `Crop values already exist\n`; }