mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-16 10:45:53 -07:00
commit
de02f3335a
1 changed files with 48 additions and 117 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
function details() {
|
function details() {
|
||||||
return {
|
return {
|
||||||
id: "Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV",
|
id: "Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV",
|
||||||
|
|
@ -6,11 +5,11 @@ function details() {
|
||||||
Type: "Video",
|
Type: "Video",
|
||||||
Operation:"Transcode",
|
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`,
|
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"
|
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugin(file) {
|
function plugin(file) {
|
||||||
var transcode = 0; //if this var changes to 1 the file will be transcoded
|
var transcode = 0; //if this var changes to 1 the file will be transcoded
|
||||||
|
|
||||||
|
|
@ -24,7 +23,7 @@ function plugin(file) {
|
||||||
reQueueAfter: true,
|
reQueueAfter: true,
|
||||||
infoLog: ''
|
infoLog: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if the file is a video, if not the function will be stopped immediately
|
//check if the file is a video, if not the function will be stopped immediately
|
||||||
if (file.fileMedium !== "video") {
|
if (file.fileMedium !== "video") {
|
||||||
response.processFile = false
|
response.processFile = false
|
||||||
|
|
@ -33,7 +32,7 @@ function plugin(file) {
|
||||||
} else {
|
} else {
|
||||||
response.infoLog += "☑File is a video! \n"
|
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
|
//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') {
|
if (file.ffProbeData.streams[0].codec_name == 'hevc') {
|
||||||
response.processFile = false
|
response.processFile = false
|
||||||
|
|
@ -41,126 +40,59 @@ function plugin(file) {
|
||||||
return response
|
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
|
//file will be encoded if the resolution is 480p or 576p
|
||||||
//codec will be checked so it can be transcoded correctly
|
//codec will be checked so it can be transcoded correctly
|
||||||
if(file.video_resolution === "480p" || file.video_resolution === "576p" ) {
|
if (file.video_resolution === "480p" || file.video_resolution === "576p" ) {
|
||||||
if (file.video_codec_name == 'h263') {
|
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`
|
||||||
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`
|
|
||||||
}
|
|
||||||
|
|
||||||
transcode = 1;
|
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
|
//file will be encoded if the resolution is 1080p
|
||||||
//codec will be checked so it can be transcoded correctly
|
//codec will be checked so it can be transcoded correctly
|
||||||
if(file.video_resolution === "1080p") {
|
if(file.video_resolution === "1080p") {
|
||||||
if (file.video_codec_name == 'h263') {
|
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 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`
|
|
||||||
}
|
|
||||||
|
|
||||||
transcode = 1;
|
transcode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if the file is eligible for transcoding
|
//check if the file is eligible for transcoding
|
||||||
//if true the neccessary response values will be changed
|
//if true the neccessary response values will be changed
|
||||||
if (transcode == 1) {
|
if (transcode == 1) {
|
||||||
|
|
@ -173,7 +105,6 @@ function plugin(file) {
|
||||||
|
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.details = details;
|
module.exports.details = details;
|
||||||
|
|
||||||
module.exports.plugin = plugin;
|
module.exports.plugin = plugin;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue