Various Updates

1) New plugin that uses CPU to convert to H265.

2) Change to FFMPEG NVidia plugin to specifiy bitrate cutoff.

3) Fix random infolog "2" in CleanTitle

4) Update descriptive audio check in CleanAudio and CleanSubs to look for "sdh"

5) Correct OrderStreams mentioning that "Audio not first" when audio should be second.
This commit is contained in:
Migz93 2020-03-14 01:00:16 +00:00
parent fc9692bacb
commit 5735ae6759
7 changed files with 179 additions and 24 deletions

View file

@ -5,9 +5,9 @@ function details() {
Name: "Migz-Transcode Using Nvidia GPU & FFMPEG",
Type: "Video",
Operation:"Transcode",
Description: `[TESTING]Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`,
Version: "2.00",
Link: "",
Description: `Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`,
Version: "2.10",
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js",
Tags:'pre-processing,ffmpeg,video only,nvenc h265,configurable',
Inputs: [
{
@ -20,6 +20,17 @@ function details() {
mp4`
},
{
name: 'bitrate_cutoff',
tooltip: `Specify bitrate cutoff, files with a current bitrate lower then this will not be transcoded. Rate is in kbps. Leave empty to disable.
\\nExample:\\n
6000
\\nExample:\\n
4000`
},
]
}
@ -57,6 +68,7 @@ function plugin(file, librarySettings, inputs) {
var bitrateSettings = ""
var filesize = (file.file_size / 1000)
var currentBitrate = ~~(file.file_size / (duration * 0.0075))
var targetBitrate = ~~((file.file_size / (duration * 0.0075)) / 2)
var minimumBitrate = ~~(targetBitrate * 0.7)
var maximumBitrate = ~~(targetBitrate * 1.3)
@ -67,19 +79,36 @@ function plugin(file, librarySettings, inputs) {
return response
}
if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container == inputs.container) {
response.processFile = false
response.infoLog += `☑File is already in ${inputs.container} & hevc. \n`
return response
if (inputs.bitrate_cutoff != "") {
if (currentBitrate <= inputs.bitrate_cutoff) {
if (file.container == inputs.container) {
response.processFile = false
response.infoLog += `☑Current bitrate is below configured bitrate cutoff of ${inputs.bitrate_cutoff} & file container is already ${inputs.container}. Nothing to do, skipping. \n`
return response
} else {
response.processFile = true
response.preset += `, -c copy`
response.infoLog += `☒Current bitrate is below configured bitrate cutoff of ${inputs.bitrate_cutoff} but is not in correct container. Remuxing to ${inputs.container} but not transcoding. \n`
return response
}
}
if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container != '${inputs.container}') {
response.infoLog += `☒File is hevc but is not in ${inputs.container} container. Remuxing. \n`
response.preset = ', -map 0 -c copy'
response.processFile = true;
return response
}
}
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") {
if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container == inputs.container) {
response.processFile = false
response.infoLog += `☑File is already in ${inputs.container} & hevc. \n`
return response
}
if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container != '${inputs.container}') {
response.infoLog += `☒File is hevc but is not in ${inputs.container} container. Remuxing. \n`
response.preset = ', -map 0 -c copy'
response.processFile = true;
return response
}
}
}
bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k`
response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n`