From 913788fec0e87ddefe6ca1a0d2dc70a951347272 Mon Sep 17 00:00:00 2001 From: vodkapmp <70449815+vodkapmp@users.noreply.github.com> Date: Thu, 17 Sep 2020 15:19:43 +0200 Subject: [PATCH 1/3] fix ffmpeg bitrate bug Fix for ffmpeg bug where bitrate target is defaulted to 2500 even when using CQ with NVENC --- ...arr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js b/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js index e235ffe..b693c5e 100644 --- a/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js +++ b/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js @@ -185,7 +185,7 @@ module.exports.plugin = function plugin (file, librarySettings, inputs) { //codec will be checked so it can be transcoded correctly if (file.video_resolution === '480p' || file.video_resolution === '576p') { cqvinuse = `${inputs.sdCQV}` - response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v ${inputs.sdCQV} -preset ${ffmpeg_preset} -rc-lookahead 32 -bf ${inputs.bframe} -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy ${subcli}${maxmux}` + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.sdCQV} -spatial_aq 1 -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` transcode = 1 } @@ -193,21 +193,21 @@ module.exports.plugin = function plugin (file, librarySettings, inputs) { //codec will be checked so it can be transcoded correctly if (file.video_resolution === '720p') { cqvinuse = `${inputs.hdCQV}` - response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v ${inputs.hdCQV} -preset ${ffmpeg_preset} -rc-lookahead 32 -bf ${inputs.bframe} -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy ${subcli}${maxmux}` + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.hdCQV} -spatial_aq 1 -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` 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') { cqvinuse = `${inputs.fullhdCQV}` - response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v ${inputs.fullhdCQV} -preset ${ffmpeg_preset} -rc-lookahead 32 -bf ${inputs.bframe} -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy ${subcli}${maxmux}` + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.fullhdCQV} -spatial_aq 1 -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` 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') { cqvinuse = `${inputs.uhdCQV}` - response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc:v vbr_hq -qmin 0 -cq:v ${inputs.uhdCQV} -preset ${ffmpeg_preset} -rc-lookahead 32 -bf ${inputs.bframe} -spatial_aq:v 1 -aq-strength:v 8 -a53cc 0 -c:a copy ${subcli}${maxmux}` + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.uhdCQV} -spatial_aq 1 -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` transcode = 1 } //check if the file is eligible for transcoding From 0d5bc6624c64be1d9a7404e4f14ec41d3e7f73f3 Mon Sep 17 00:00:00 2001 From: vodkapmp <70449815+vodkapmp@users.noreply.github.com> Date: Thu, 17 Sep 2020 16:15:33 +0200 Subject: [PATCH 2/3] fix spatial_aq being unnecesary with cq --- ...arr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js b/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js index b693c5e..6dc6e0d 100644 --- a/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js +++ b/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js @@ -185,7 +185,7 @@ module.exports.plugin = function plugin (file, librarySettings, inputs) { //codec will be checked so it can be transcoded correctly if (file.video_resolution === '480p' || file.video_resolution === '576p') { cqvinuse = `${inputs.sdCQV}` - response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.sdCQV} -spatial_aq 1 -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.sdCQV} -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` transcode = 1 } @@ -193,21 +193,21 @@ module.exports.plugin = function plugin (file, librarySettings, inputs) { //codec will be checked so it can be transcoded correctly if (file.video_resolution === '720p') { cqvinuse = `${inputs.hdCQV}` - response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.hdCQV} -spatial_aq 1 -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.hdCQV} -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` 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') { cqvinuse = `${inputs.fullhdCQV}` - response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.fullhdCQV} -spatial_aq 1 -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.fullhdCQV} -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` 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') { cqvinuse = `${inputs.uhdCQV}` - response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.uhdCQV} -spatial_aq 1 -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` + response.preset += `,${map} -dn -c:v hevc_nvenc -pix_fmt p010le -rc vbr_hq -b:v 0 -preset ${ffmpeg_preset} -cq ${inputs.uhdCQV} -rc-lookahead 32 -bf ${inputs.bframe} -a53cc 0 -c:a copy ${subcli}${maxmux}` transcode = 1 } //check if the file is eligible for transcoding From 1d2c5153aeef4ccb80173de7cf856bb8ec7fc55c Mon Sep 17 00:00:00 2001 From: vodkapmp <70449815+vodkapmp@users.noreply.github.com> Date: Thu, 17 Sep 2020 19:04:03 +0200 Subject: [PATCH 3/3] changed example values changed example values to sane numbers that would give the typical compression results people might expect from such a plugin, should someone decide to just, use what it says instead of testing and finding the right value for their use --- ...arr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js b/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js index 6dc6e0d..08319a3 100644 --- a/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js +++ b/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js @@ -22,28 +22,28 @@ function details () { tooltip: `Enter the CQ:V value you want for 480p and 576p content. \\nExample:\\n - 18` + 21` }, { name: 'hdCQV', tooltip: `Enter the CQ:V value you want for 720p content. \\nExample:\\n - 17` + 23` }, { name: 'fullhdCQV', tooltip: `Enter the CQ:V value you want for 1080p content. \\nExample:\\n - 18` + 25` }, { name: 'uhdCQV', tooltip: `Enter the CQ:V value you want for 4K/UHD/2160p content. \\nExample:\\n - 22` + 28` }, { name: 'bframe',