From f5778d88e832c3e61d0a91e5721484214e685c81 Mon Sep 17 00:00:00 2001 From: TheRealShadoh <49546181+TheRealShadoh@users.noreply.github.com> Date: Sat, 23 Nov 2019 20:16:42 -0600 Subject: [PATCH 01/28] Create Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js --- ...adoh_HandBrake_H264_Fast1080p30_EngSubs.js | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 Community/Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js new file mode 100644 index 0000000..4bed893 --- /dev/null +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js @@ -0,0 +1,169 @@ + + + +function details() { + + return { + id: "Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js", + Name: "TheRealShadoh HandBrake Fast1080p30, English subs, no title meta, 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 maintains English subtitles. It 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.00", + Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.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") { + + + console.log("File is not video") + + response.infoLog += "☒File is not video \n" + response.processFile = false; + + return response + + } else { + + var jsonString = JSON.stringify(file) + + + var hasSubs = false + + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + + try { + + if(file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"){ + + hasSubs = true + + } + } catch (err) { } + } + + + if(file.ffProbeData.streams[0].codec_name != 'h264'){ + + response.infoLog += "☒File is not in h264! \n" + response.preset = '-Z "Fast 1080p30" --audio-lang-list eng,jpn --all-audio --subtitle-lang-list eng,und --all-subtitles' + response.reQueueAfter = true; + response.processFile = true; + response.handBrakeMode = true + return response + + }else{ + response.infoLog += "☑File is already in h264! \n" + } + + + /// + + if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){ + + response.infoLog += "☒File has title metadata and no aac and subs \n" + response.preset = ',-map_metadata -1 -map 0 -vcodec copy -acodec copy -scodec mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + } + + if(!jsonString.includes("aac") && hasSubs){ + + response.infoLog += "☒File has no aac track and has subs \n" + response.preset = ',-map 0:s:language:eng,language:en -map 0:v -map 0:a:language:eng,language:en,language:jpn,language:ja -map 0:a -map 0:s? -map 0:d? -vcodec copy -scodec mov_text -c:a:0 aac -b:a:0 192k -ac 2' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + } + + + if(file.meta.Title != "undefined" && hasSubs){ + + response.infoLog += "☒File has title and has subs \n" + response.preset = ',-map 0:s:language:eng,language:en -map_metadata -1 -map 0 -vcodec copy -acodec copy -scodec mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + } + + + + /// + if(file.meta.Title != undefined ){ + + response.infoLog += "☒File has title metadata \n" + response.preset = ',-map_metadata -1 -map 0 -vcodec copy -acodec copy -scodec mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + }else{ + response.infoLog += "☑File has no title metadata" + } + + if(!jsonString.includes("aac")){ + + response.infoLog += "☒File has no aac track \n" + response.preset = ',-map 0:v -map 0:a:0 -map 0:a:language:eng,language:en,language:jpn,language:ja -map 0:s? -map 0:d? -vcodec copy -scodec mov_text -c:a:0 aac -b:a:0 192k -ac 2' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + + }else{ + response.infoLog += "☑File has aac track \n" + } + + if(hasSubs){ + + response.infoLog += "☒File has subs \n" + response.preset = ',-map 0:s:language:eng,language:en -vcodec copy -acodec copy -scodec mov_text' + 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 + + } +} + +module.exports.details = details; + +module.exports.plugin = plugin; From bf3696959619dba17a70c81f6b397467e2fbcd78 Mon Sep 17 00:00:00 2001 From: Christian Crill Date: Sun, 24 Nov 2019 23:48:00 -0600 Subject: [PATCH 02/28] No longer aiming for keeping Eng subs... Initial upload --- ..._z0ab_TheRealShadoh_FFMPEG_H264_Medium.js} | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) rename Community/{Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js => Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js} (66%) diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js similarity index 66% rename from Community/Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js rename to Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js index 4bed893..7c862b4 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js @@ -4,13 +4,13 @@ function details() { return { - id: "Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js", - Name: "TheRealShadoh HandBrake Fast1080p30, English subs, no title meta, 192Kb AAC stereo,MP4 ", + id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js", + Name: "TheRealShadoh FFMPEG Medium, video MP4, audio AAC, keep subs. ", 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 maintains English subtitles. It 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 + 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. Filter logic from "Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30". \n\n `, Version: "1.00", - Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_HandBrake_H264_Fast1080p30_EngSubs.js" + Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js" } } @@ -33,7 +33,7 @@ function plugin(file) { } - + @@ -48,7 +48,7 @@ function plugin(file) { return response - } else { + } else { var jsonString = JSON.stringify(file) @@ -57,13 +57,13 @@ 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 - + } } catch (err) { } } @@ -72,10 +72,10 @@ function plugin(file) { if(file.ffProbeData.streams[0].codec_name != 'h264'){ response.infoLog += "☒File is not in h264! \n" - response.preset = '-Z "Fast 1080p30" --audio-lang-list eng,jpn --all-audio --subtitle-lang-list eng,und --all-subtitles' + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v libx264 -preset medium -c:a aac -c:s mov_text' response.reQueueAfter = true; response.processFile = true; - response.handBrakeMode = true + response.FFmpegMode = true return response }else{ @@ -88,7 +88,7 @@ function plugin(file) { if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){ response.infoLog += "☒File has title metadata and no aac and subs \n" - response.preset = ',-map_metadata -1 -map 0 -vcodec copy -acodec copy -scodec mov_text' + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' response.reQueueAfter = true; response.processFile = true; response.FFmpegMode = true @@ -98,7 +98,7 @@ function plugin(file) { if(!jsonString.includes("aac") && hasSubs){ response.infoLog += "☒File has no aac track and has subs \n" - response.preset = ',-map 0:s:language:eng,language:en -map 0:v -map 0:a:language:eng,language:en,language:jpn,language:ja -map 0:a -map 0:s? -map 0:d? -vcodec copy -scodec mov_text -c:a:0 aac -b:a:0 192k -ac 2' + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' response.reQueueAfter = true; response.processFile = true; response.FFmpegMode = true @@ -109,7 +109,7 @@ function plugin(file) { if(file.meta.Title != "undefined" && hasSubs){ response.infoLog += "☒File has title and has subs \n" - response.preset = ',-map 0:s:language:eng,language:en -map_metadata -1 -map 0 -vcodec copy -acodec copy -scodec mov_text' + response.preset = ', -map_metadata -1 -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 @@ -122,7 +122,7 @@ function plugin(file) { if(file.meta.Title != undefined ){ response.infoLog += "☒File has title metadata \n" - response.preset = ',-map_metadata -1 -map 0 -vcodec copy -acodec copy -scodec mov_text' + response.preset = ', -map_metadata -1 -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 @@ -134,7 +134,7 @@ function plugin(file) { if(!jsonString.includes("aac")){ response.infoLog += "☒File has no aac track \n" - response.preset = ',-map 0:v -map 0:a:0 -map 0:a:language:eng,language:en,language:jpn,language:ja -map 0:s? -map 0:d? -vcodec copy -scodec mov_text -c:a:0 aac -b:a:0 192k -ac 2' + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' response.reQueueAfter = true; response.processFile = true; response.FFmpegMode = true @@ -147,7 +147,7 @@ function plugin(file) { if(hasSubs){ response.infoLog += "☒File has subs \n" - response.preset = ',-map 0:s:language:eng,language:en -vcodec copy -acodec copy -scodec mov_text' + 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 From ca27502031df61608ea06efd82f318b97ca6b3b3 Mon Sep 17 00:00:00 2001 From: Christian Crill Date: Mon, 25 Nov 2019 00:47:55 -0600 Subject: [PATCH 03/28] Updated details --- ...arr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js index 7c862b4..2892a7e 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js @@ -7,7 +7,7 @@ function details() { id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js", Name: "TheRealShadoh FFMPEG 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. Filter logic from "Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30". \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_H264_Medium.js" @@ -32,13 +32,7 @@ function plugin(file) { } - - - - - - - if (file.fileMedium !== "video") { + if (file.fileMedium !== "video"){ console.log("File is not video") From 606ca243b3b66156591799ce7ed7455c6916b677 Mon Sep 17 00:00:00 2001 From: Christian Crill Date: Mon, 25 Nov 2019 01:01:01 -0600 Subject: [PATCH 04/28] Created slow,fast,veryfast Updated names to reflect Subs being kept --- ...0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js | 164 ++++++++++++++++++ ..._TheRealShadoh_FFmpeg_Subs_H264_Medium.js} | 8 +- ...0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js | 163 +++++++++++++++++ ...TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js | 163 +++++++++++++++++ 4 files changed, 494 insertions(+), 4 deletions(-) create mode 100644 Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js rename Community/{Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js => Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js} (93%) create mode 100644 Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js create mode 100644 Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js new file mode 100644 index 0000000..2219c43 --- /dev/null +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -0,0 +1,164 @@ + + + +function details() { + + return { + id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js", + 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 +`, + Version: "1.00", + Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js" + } + +} + +function plugin(file) { + + + //Must return this object + + var response = { + + processFile : false, + preset : '', + container : '.mp4', + handBrakeMode : false, + FFmpegMode : false, + FFmpegMode : false, + 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 + + } else { + + var jsonString = JSON.stringify(file) + + + var hasSubs = false + + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + + try { + + if(file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"){ + + hasSubs = true + + } + } catch (err) { } + } + + + if(file.ffProbeData.streams[0].codec_name != 'h264'){ + + response.infoLog += "☒File is not in h264! \n" + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v libx264 -preset fast -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + + }else{ + response.infoLog += "☑File is already in h264! \n" + } + + + /// + + if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){ + + response.infoLog += "☒File has title metadata and no aac and subs \n" + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + } + + if(!jsonString.includes("aac") && hasSubs){ + + response.infoLog += "☒File has no aac track and has subs \n" + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + } + + + if(file.meta.Title != "undefined" && hasSubs){ + + response.infoLog += "☒File has title and has subs \n" + response.preset = ', -map_metadata -1 -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 + } + + + + /// + if(file.meta.Title != undefined ){ + + response.infoLog += "☒File has title metadata \n" + response.preset = ', -map_metadata -1 -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 title metadata" + } + + if(!jsonString.includes("aac")){ + + response.infoLog += "☒File has no aac track \n" + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + + }else{ + response.infoLog += "☑File has aac track \n" + } + + if(hasSubs){ + + response.infoLog += "☒File has 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 meets conditions! \n" + return response + + } +} + +module.exports.details = details; + +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js similarity index 93% rename from Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js rename to Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js index 2892a7e..5434681 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -4,13 +4,13 @@ function details() { return { - id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFMPEG_H264_Medium.js", - Name: "TheRealShadoh FFMPEG Medium, video MP4, audio AAC, keep subs. ", + id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js", + 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: `[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_H264_Medium.js" + 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_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js new file mode 100644 index 0000000..66f71ba --- /dev/null +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -0,0 +1,163 @@ + + + +function details() { + + return { + id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js", + 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 +`, + Version: "1.00", + Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.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"){ + + + console.log("File is not video") + + response.infoLog += "☒File is not video \n" + response.processFile = false; + + return response + + } else { + + var jsonString = JSON.stringify(file) + + + var hasSubs = false + + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + + try { + + if(file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"){ + + hasSubs = true + + } + } catch (err) { } + } + + + if(file.ffProbeData.streams[0].codec_name != 'h264'){ + + response.infoLog += "☒File is not in h264! \n" + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v libx264 -preset slow -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + + }else{ + response.infoLog += "☑File is already in h264! \n" + } + + + /// + + if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){ + + response.infoLog += "☒File has title metadata and no aac and subs \n" + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + } + + if(!jsonString.includes("aac") && hasSubs){ + + response.infoLog += "☒File has no aac track and has subs \n" + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + } + + + if(file.meta.Title != "undefined" && hasSubs){ + + response.infoLog += "☒File has title and has subs \n" + response.preset = ', -map_metadata -1 -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 + } + + + + /// + if(file.meta.Title != undefined ){ + + response.infoLog += "☒File has title metadata \n" + response.preset = ', -map_metadata -1 -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 title metadata" + } + + if(!jsonString.includes("aac")){ + + response.infoLog += "☒File has no aac track \n" + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + + }else{ + response.infoLog += "☑File has aac track \n" + } + + if(hasSubs){ + + response.infoLog += "☒File has 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 meets conditions! \n" + return response + + } +} + +module.exports.details = details; + +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js new file mode 100644 index 0000000..6bbd312 --- /dev/null +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -0,0 +1,163 @@ + + + +function details() { + + return { + id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js", + 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 +`, + Version: "1.00", + Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Veryfast.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"){ + + + console.log("File is not video") + + response.infoLog += "☒File is not video \n" + response.processFile = false; + + return response + + } else { + + var jsonString = JSON.stringify(file) + + + var hasSubs = false + + + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + + try { + + if(file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle"){ + + hasSubs = true + + } + } catch (err) { } + } + + + if(file.ffProbeData.streams[0].codec_name != 'h264'){ + + response.infoLog += "☒File is not in h264! \n" + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v libx264 -preset veryfast -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + + }else{ + response.infoLog += "☑File is already in h264! \n" + } + + + /// + + if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){ + + response.infoLog += "☒File has title metadata and no aac and subs \n" + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + } + + if(!jsonString.includes("aac") && hasSubs){ + + response.infoLog += "☒File has no aac track and has subs \n" + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + } + + + if(file.meta.Title != "undefined" && hasSubs){ + + response.infoLog += "☒File has title and has subs \n" + response.preset = ', -map_metadata -1 -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 + } + + + + /// + if(file.meta.Title != undefined ){ + + response.infoLog += "☒File has title metadata \n" + response.preset = ', -map_metadata -1 -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 title metadata" + } + + if(!jsonString.includes("aac")){ + + response.infoLog += "☒File has no aac track \n" + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true + return response + + }else{ + response.infoLog += "☑File has aac track \n" + } + + if(hasSubs){ + + response.infoLog += "☒File has 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 meets conditions! \n" + return response + + } +} + +module.exports.details = details; + +module.exports.plugin = plugin; From 528cac935a5f841ab9a2bb92952e3f203fdc457d Mon Sep 17 00:00:00 2001 From: Christian Crill Date: Mon, 25 Nov 2019 01:20:31 -0600 Subject: [PATCH 05/28] Names --- ...0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js | 2 +- ...z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js} | 17 ++++++++--------- ...z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js} | 16 ++++++++-------- ..._TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js} | 16 ++++++++-------- 4 files changed, 25 insertions(+), 26 deletions(-) rename Community/{Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js => Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js} (95%) rename Community/{Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js => Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js} (95%) rename Community/{Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js => Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js} (95%) 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 5434681..60cf4dd 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -151,7 +151,7 @@ function plugin(file) { response.infoLog += "☑File has no subs \n" } - + response.processFile = false; response.infoLog += "☑File meets conditions! \n" return response diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js similarity index 95% rename from Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js rename to Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js index 2219c43..98f3490 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -22,14 +22,13 @@ function plugin(file) { var response = { - processFile : false, - preset : '', - container : '.mp4', - handBrakeMode : false, - FFmpegMode : false, - FFmpegMode : false, - reQueueAfter : false, - infoLog : '', + processFile : false, + preset : '', + container : '.mp4', + handBrakeMode : false, + FFmpegMode : false, + reQueueAfter : false, + infoLog : '', } @@ -152,7 +151,7 @@ function plugin(file) { response.infoLog += "☑File has no subs \n" } - + response.processFile = false; response.infoLog += "☑File meets conditions! \n" return response diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js similarity index 95% rename from Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js rename to Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js index 66f71ba..1e48b1c 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -22,13 +22,13 @@ function plugin(file) { var response = { - processFile : false, - preset : '', - container : '.mp4', - handBrakeMode : false, - FFmpegMode : false, - reQueueAfter : false, - infoLog : '', + processFile : false, + preset : '', + container : '.mp4', + handBrakeMode : false, + FFmpegMode : false, + reQueueAfter : false, + infoLog : '', } @@ -151,7 +151,7 @@ function plugin(file) { response.infoLog += "☑File has no subs \n" } - + response.processFile = false; response.infoLog += "☑File meets conditions! \n" return response diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js similarity index 95% rename from Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js rename to Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js index 6bbd312..9ab94d0 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -22,13 +22,13 @@ function plugin(file) { var response = { - processFile : false, - preset : '', - container : '.mp4', - handBrakeMode : false, - FFmpegMode : false, - reQueueAfter : false, - infoLog : '', + processFile : false, + preset : '', + container : '.mp4', + handBrakeMode : false, + FFmpegMode : false, + reQueueAfter : false, + infoLog : '', } @@ -151,7 +151,7 @@ function plugin(file) { response.infoLog += "☑File has no subs \n" } - + response.processFile = false; response.infoLog += "☑File meets conditions! \n" return response From b21f1f4fc4636ea3d64bad2d39d3dff235eb54ba Mon Sep 17 00:00:00 2001 From: Christian Crill Date: Mon, 25 Nov 2019 01:24:18 -0600 Subject: [PATCH 06/28] Names --- .../Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js | 4 ++-- .../Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js | 4 ++-- ...arr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js | 4 ++-- 3 files changed, 6 insertions(+), 6 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 98f3490..39460b4 100644 --- a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -4,13 +4,13 @@ function details() { return { - id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js", + id: "Tdarr_Plugin_z1sab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js", 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 `, Version: "1.00", - Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_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" } } 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 1e48b1c..e9e9994 100644 --- a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -4,13 +4,13 @@ function details() { return { - id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js", + id: "Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js", 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 `, Version: "1.00", - Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_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" } } 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 9ab94d0..6ffc456 100644 --- a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -4,13 +4,13 @@ function details() { return { - id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js", + id: "Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js", 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 `, Version: "1.00", - Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_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" } } From 2dd8b95828dedf93cf36873f5e41258ac12fe18b Mon Sep 17 00:00:00 2001 From: Christian Crill Date: Mon, 25 Nov 2019 01:31:06 -0600 Subject: [PATCH 07/28] Names --- .../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 39460b4..1c02c03 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_z1sab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js", + id: "Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js", 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 From 629a886312a173cf830f4813456735fc5853d294 Mon Sep 17 00:00:00 2001 From: Christian Crill Date: Mon, 25 Nov 2019 02:20:51 -0600 Subject: [PATCH 08/28] Remvoed "" from undefined in logic --- ...arr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js | 5 ++--- ...Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js | 6 ++---- ...Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js | 5 ++--- ...r_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js | 5 ++--- 4 files changed, 8 insertions(+), 13 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 60cf4dd..85ab199 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -79,7 +79,7 @@ function plugin(file) { /// - if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){ + if((file.meta.Title != undefined) && !jsonString.includes("aac") && hasSubs){ response.infoLog += "☒File has title metadata and no aac and subs \n" response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' @@ -100,7 +100,7 @@ function plugin(file) { } - if(file.meta.Title != "undefined" && hasSubs){ + if(file.meta.Title != undefined && hasSubs){ response.infoLog += "☒File has title and has subs \n" response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text' @@ -151,7 +151,6 @@ function plugin(file) { response.infoLog += "☑File has no subs \n" } - response.processFile = false; response.infoLog += "☑File meets conditions! \n" return response 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 1c02c03..a5bbdc0 100644 --- a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -79,7 +79,7 @@ function plugin(file) { /// - if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){ + if((file.meta.Title != undefined) && !jsonString.includes("aac") && hasSubs){ response.infoLog += "☒File has title metadata and no aac and subs \n" response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' @@ -100,7 +100,7 @@ function plugin(file) { } - if(file.meta.Title != "undefined" && hasSubs){ + if(file.meta.Title != undefined && hasSubs){ response.infoLog += "☒File has title and has subs \n" response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text' @@ -111,7 +111,6 @@ function plugin(file) { } - /// if(file.meta.Title != undefined ){ @@ -151,7 +150,6 @@ function plugin(file) { response.infoLog += "☑File has no subs \n" } - response.processFile = false; response.infoLog += "☑File meets conditions! \n" return response 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 e9e9994..f7f39ed 100644 --- a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -79,7 +79,7 @@ function plugin(file) { /// - if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){ + if((file.meta.Title != undefined) && !jsonString.includes("aac") && hasSubs){ response.infoLog += "☒File has title metadata and no aac and subs \n" response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' @@ -100,7 +100,7 @@ function plugin(file) { } - if(file.meta.Title != "undefined" && hasSubs){ + if(file.meta.Title != undefined && hasSubs){ response.infoLog += "☒File has title and has subs \n" response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text' @@ -151,7 +151,6 @@ function plugin(file) { response.infoLog += "☑File has no subs \n" } - response.processFile = false; response.infoLog += "☑File meets conditions! \n" return response 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 6ffc456..2211f6c 100644 --- a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -79,7 +79,7 @@ function plugin(file) { /// - if((file.meta.Title != "undefined") && !jsonString.includes("aac") && hasSubs){ + if((file.meta.Title != undefined) && !jsonString.includes("aac") && hasSubs){ response.infoLog += "☒File has title metadata and no aac and subs \n" response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text' @@ -100,7 +100,7 @@ function plugin(file) { } - if(file.meta.Title != "undefined" && hasSubs){ + if(file.meta.Title != undefined && hasSubs){ response.infoLog += "☒File has title and has subs \n" response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text' @@ -151,7 +151,6 @@ function plugin(file) { response.infoLog += "☑File has no subs \n" } - response.processFile = false; response.infoLog += "☑File meets conditions! \n" return response From f143dd64056b1cda388f2e66df796230cde722b7 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 5 Dec 2019 22:25:19 +0000 Subject: [PATCH 09/28] New --- .../Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js new file mode 100644 index 0000000..aa98292 --- /dev/null +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -0,0 +1,98 @@ +const fs = require('fs'); +const iso6392 = require('/home/Tdarr/Documents/node_modules/iso-639-2'); + +function details() { + return { + id: "Tdarr_Plugin_e5c3_CnT_Add_Subtitles", + 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", + Link: "", + } +} + +function plugin(file) { + 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 = ''; + + + //default response + var response = { + processFile: false, + preset: `,`, + container: '.mkv', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: `Testing for subtitles...\nPath: ${path}\n`, + } + + //find first subtitle stream + while (file.ffProbeData.streams[sub].codec_type.toLowerCase() != "subtitle") { + sub++ + } + response.infoLog += `The first subtitle stream is ${sub}\n` + + for (i = 0; i < lang.length; i++) { + //check if srt exists in folder + if (fs.existsSync(`${path}/${lang[i].iso6392B}.srt`)) { + response.infoLog += `Found subtitle ${lang[i].name}\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` + } + } + + //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++ + } + } 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` + } + + //if new subs have been found they will be added + if (new_subs > 0) { + response.FFmpegMode = true; + response.processFile = true; + response.reQueueAfter = true; + response.preset += ` -map 0:s -c copy` + } else { + response.infoLog += `No new subtitle languages were found\n` + } + + response.infoLog += `The ffmpeg string is: ${response.preset}\n` + + return response +} + +module.exports.details = details; +module.exports.plugin = plugin; From 02a52bf821948d371b677cd36213604c2c362ca6 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 5 Dec 2019 22:26:07 +0000 Subject: [PATCH 10/28] Link --- Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index aa98292..a81d881 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -9,7 +9,7 @@ function details() { 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", - Link: "", + Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js", } } From ca0a4bbf9e197518f3e073c2e85262814ec8d1a3 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Fri, 6 Dec 2019 21:13:55 +0000 Subject: [PATCH 11/28] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f86269c..9083939 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ For the plugin link, I'll add this once you create a PR to community plugins. } - Please see the bottom of this README for the structure of an example file object: + Please see the bottom of this README for the structure of an example file object. To see a specific file's details, search for the file in the search tab and click the 'i' info button. 6.Once you have finished configuring your plugin, From 06a7302b4293834a15c772259fa0ad1ee750f999 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Mon, 9 Dec 2019 01:46:48 +0000 Subject: [PATCH 12/28] Update Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js --- ..._d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 70 +++++++++++-------- 1 file changed, 40 insertions(+), 30 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 b2581a1..4265d1d 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -1,3 +1,4 @@ + function details() { return { id: "Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV", @@ -5,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 and 1080p. If files are not in hevc they will be transcoded. The output container is mkv. \n\n`, - Version: "1.03", + Version: "1.04", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js" } } @@ -44,34 +45,37 @@ function plugin(file) { //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,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v h263_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'h264') { - response.preset = `-c:v h264_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` + 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 -preset slow -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 -preset slow -c:a copy -c:s copy` + } } else if (file.video_codec_name == 'mjpeg') { - response.preset = `-c:v mjpeg_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v mjpeg_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'mpeg1') { - response.preset = `-c:v mpeg1_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v mpeg1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'mpeg2') { - response.preset = `-c:v mpeg2_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v mpeg2_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'mpeg4') { - response.preset = `,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -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 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'vc1') { - response.preset = `-c:v vc1_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v vc1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'vp8') { - response.preset = `-c:v vp8_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v vp8_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'vp9') { - response.preset = `-c:v vp9_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v vp9_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -c:a copy -c:s copy` } else { - response.preset = `, -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 30 -preset slow -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 -preset slow -c:a copy -c:s copy` } transcode = 1; @@ -81,34 +85,37 @@ function plugin(file) { //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,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v h263_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'h264') { - response.preset = `-c:v h264_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` + 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 -preset slow -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 -preset slow -c:a copy -c:s copy` + } } else if (file.video_codec_name == 'mjpeg') { - response.preset = `-c:v mjpeg_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v mjpeg_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'mpeg1') { - response.preset = `-c:v mpeg1_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v mpeg1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'mpeg2') { - response.preset = `-c:v mpeg2_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v mpeg2_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'mpeg4') { - response.preset = `,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -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 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'vc1') { - response.preset = `-c:v vc1_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v vc1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'vp8') { - response.preset = `-c:v vp8_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v vp8_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'vp9') { - response.preset = `-c:v vp9_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v vp9_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 31 -preset slow -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 -preset slow -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 -preset slow -c:a copy -c:s copy` } transcode = 1; @@ -118,31 +125,34 @@ function plugin(file) { //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,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v h263_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'h264') { - response.preset = `-c:v h264_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` + 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 32 -preset slow -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 32 -preset slow -c:a copy -c:s copy` + } } else if (file.video_codec_name == 'mjpeg') { - response.preset = `-c:v mjpeg_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v mjpeg_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'mpeg1') { - response.preset = `-c:v mpeg1_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v mpeg1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'mpeg2') { - response.preset = `-c:v mpeg2_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v mpeg2_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'mpeg4') { - response.preset = `,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -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 32 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'vc1') { - response.preset = `-c:v vc1_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v vc1_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'vp8') { - response.preset = `-c:v vp8_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v vp8_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` } else if (file.video_codec_name == 'vp9') { - response.preset = `-c:v vp9_cuvid,-c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` + response.preset = `-c:v vp9_cuvid,-map 0 -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` } else { response.preset = `, -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -c:a copy -c:s copy` From ffdcd84c4fc1e723d41331bb072d85c85e8f8d9d Mon Sep 17 00:00:00 2001 From: robejo9 Date: Mon, 9 Dec 2019 09:50:17 -0600 Subject: [PATCH 13/28] Increase Video Quality Updates to increase Video Quality. --- ..._d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 66 +++++++++---------- 1 file changed, 33 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 4265d1d..3aab319 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -45,37 +45,37 @@ function plugin(file) { //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 30 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -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 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -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 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -c:a copy -c:s copy` } transcode = 1; @@ -85,37 +85,37 @@ function plugin(file) { //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 31 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -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 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 -preset slow -c:a copy -c:s copy` + 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 -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 31 -preset slow -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 2500k -maxrate:v 5000k -preset slow -rc-lookahead 32 -c:a copy -c:s copy` } transcode = 1; @@ -125,37 +125,37 @@ function plugin(file) { //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 32 -preset slow -c:a copy -c:s copy` + 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 -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 32 -preset slow -c:a copy -c:s copy` + 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 -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 32 -preset slow -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 -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 32 -preset slow -c:a copy -c:s copy` + 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 -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 32 -preset slow -c:a copy -c:s copy` + 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 -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 32 -preset slow -c:a copy -c:s copy` + 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 -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 32 -preset slow -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 -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 32 -preset slow -c:a copy -c:s copy` + 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 -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 32 -preset slow -c:a copy -c:s copy` + 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 -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 32 -preset slow -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` } else { - response.preset = `, -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v 32 -preset slow -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 -c:a copy -c:s copy` } transcode = 1; From 1c6fc473bf68982e8012fe54a2ef366c1798b8ff Mon Sep 17 00:00:00 2001 From: robejo9 Date: Mon, 9 Dec 2019 13:21:12 -0600 Subject: [PATCH 14/28] Update Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js added Spatial AQ --- ..._d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 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 3aab319..d24789d 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 and 1080p. If files are not in hevc they will be transcoded. The output container is mkv. \n\n`, - Version: "1.04", + Version: "1.05", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js" } } @@ -45,37 +45,37 @@ function plugin(file) { //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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -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 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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -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 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; @@ -85,37 +85,37 @@ function plugin(file) { //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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -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 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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -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 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; @@ -125,37 +125,37 @@ function plugin(file) { //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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -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` } 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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -c:a copy -c:s copy` + 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 -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; From a378ce5aef98d61a784961e8e05b319a9241246c Mon Sep 17 00:00:00 2001 From: robejo9 Date: Mon, 9 Dec 2019 15:59:17 -0600 Subject: [PATCH 15/28] 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 | 165 +++++------------- 1 file changed, 48 insertions(+), 117 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 } +//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` + } +// 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" ) { - 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` - } - - 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` - } - + 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") { + 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 16/28] 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 17/28] 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 18/28] 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 19/28] 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 20/28] 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 21/28] 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 22/28] 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 23/28] 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 24/28] 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 25/28] 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 26/28] 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 27/28] 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 28/28] 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. +