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.
make-only-subtitle-default
Migz93 6 years ago
parent fc9692bacb
commit 5735ae6759

@ -5,9 +5,9 @@ function details() {
Name: "Migz-Transcode Using Nvidia GPU & FFMPEG", Name: "Migz-Transcode Using Nvidia GPU & FFMPEG",
Type: "Video", Type: "Video",
Operation:"Transcode", Operation:"Transcode",
Description: `[TESTING]Files will be transcoded using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`, Description: `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", Version: "2.10",
Link: "", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js",
Tags:'pre-processing,ffmpeg,video only,nvenc h265,configurable', Tags:'pre-processing,ffmpeg,video only,nvenc h265,configurable',
Inputs: [ Inputs: [
{ {
@ -20,6 +20,17 @@ function details() {
mp4` 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 bitrateSettings = ""
var filesize = (file.file_size / 1000) var filesize = (file.file_size / 1000)
var currentBitrate = ~~(file.file_size / (duration * 0.0075))
var targetBitrate = ~~((file.file_size / (duration * 0.0075)) / 2) var targetBitrate = ~~((file.file_size / (duration * 0.0075)) / 2)
var minimumBitrate = ~~(targetBitrate * 0.7) var minimumBitrate = ~~(targetBitrate * 0.7)
var maximumBitrate = ~~(targetBitrate * 1.3) var maximumBitrate = ~~(targetBitrate * 1.3)
@ -67,19 +79,36 @@ function plugin(file, librarySettings, inputs) {
return response return response
} }
if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container == inputs.container) { if (inputs.bitrate_cutoff != "") {
response.processFile = false if (currentBitrate <= inputs.bitrate_cutoff) {
response.infoLog += `☑File is already in ${inputs.container} & hevc. \n` if (file.container == inputs.container) {
return response 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
if (file.ffProbeData.streams[0].codec_name == 'hevc' && file.container != '${inputs.container}') { } else {
response.infoLog += `☒File is hevc but is not in ${inputs.container} container. Remuxing. \n` response.processFile = true
response.preset = ', -map 0 -c copy' response.preset += `, -c copy`
response.processFile = true; 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 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` 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` 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`

@ -0,0 +1,126 @@
function details() {
return {
id: "Tdarr_Plugin_MC93_Migz1FFMPEG_CPU",
Stage: "Pre-processing",
Name: "Migz-Transcode Using CPU & FFMPEG",
Type: "Video",
Operation:"Transcode",
Description: `[TESTING]Files will be transcoded using CPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. \n\n`,
Version: "1.0",
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js",
Tags:'pre-processing,ffmpeg,video only,configurable',
Inputs: [
{
name: 'container',
tooltip: `Specify output container of file, ensure that all stream types you may have are supported by your chosen container. mkv is recommended.
\\nExample:\\n
mkv
\\nExample:\\n
mp4`
},
{
name: 'bitrate_cutoff',
tooltip: `Specify bitrate cutoff, files with a current bitrate lower then this will not be transcoded. Rate is in kbps. Leave empty to disable.
\\nExample:\\n
6000
\\nExample:\\n
4000`
},
]
}
}
function plugin(file, librarySettings, inputs) {
var response = {
processFile: false,
preset: '',
handBrakeMode: false,
FFmpegMode: true,
reQueueAfter: true,
infoLog: ''
}
if (inputs.container == "") {
response.infoLog += "☒Container has not been configured within plugin settings, please configure required options. Skipping this plugin. \n"
response.processFile = false
return response
} else {
response.container = '.' + inputs.container
}
if (file.fileMedium !== "video") {
response.processFile = false
response.infoLog += "☒File is not a video. \n"
return response
}
if (typeof file.meta.Duration != 'undefined') {
var duration = (file.meta.Duration * 0.0166667)
} else {
var duration = (file.ffProbeData.streams[0].duration * 0.0166667)
}
var bitrateSettings = ""
var filesize = (file.file_size / 1000)
var currentBitrate = ~~(file.file_size / (duration * 0.0075))
var targetBitrate = ~~((file.file_size / (duration * 0.0075)) / 2)
var minimumBitrate = ~~(targetBitrate * 0.7)
var maximumBitrate = ~~(targetBitrate * 1.3)
if (targetBitrate == "0") {
response.processFile = false
response.infoLog += "☒Target bitrate could not be calculated. Skipping this plugin. \n"
return response
}
if (inputs.bitrate_cutoff != "") {
if (currentBitrate <= inputs.bitrate_cutoff) {
if (file.container == inputs.container) {
response.processFile = false
response.infoLog += `☑Current bitrate is below configured bitrate cutoff of ${inputs.bitrate_cutoff} & file container is already ${inputs.container}. Nothing to do, skipping. \n`
return response
} else {
response.processFile = true
response.preset += `, -c copy`
response.infoLog += `☒Current bitrate is below configured bitrate cutoff of ${inputs.bitrate_cutoff} but is not in correct container. Remuxing to ${inputs.container} but not transcoding. \n`
return response
}
}
}
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") {
if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container == inputs.container) {
response.processFile = false
response.infoLog += `☑File is already in ${inputs.container} & hevc. \n`
return response
}
if (file.ffProbeData.streams[i].codec_name == 'hevc' && file.container != '${inputs.container}') {
response.infoLog += `☒File is hevc but is not in ${inputs.container} container. Remuxing. \n`
response.preset = ', -map 0 -c copy'
response.processFile = true;
return response
}
}
}
bitrateSettings = `-b:v ${targetBitrate}k -minrate ${minimumBitrate}k -maxrate ${maximumBitrate}k`
response.infoLog += `Container for output selected as ${inputs.container}. \n Current bitrate = ${~~(file.file_size / (duration * 0.0075))} \n Bitrate settings: \nTarget = ${targetBitrate} \nMinimum = ${minimumBitrate} \nMaximum = ${maximumBitrate} \n`
if (inputs.container == "mkv") {
extraArguments = "-map -0:d "
}
response.preset += `,-map 0 -c:v libx265 ${bitrateSettings} -bufsize 2M -spatial_aq:v 1 -c:a copy -c:s copy -max_muxing_queue_size 4096 ${extraArguments}`
response.processFile = true
response.infoLog += `☒File is not hevc. Transcoding. \n`
return response
}
module.exports.details = details;
module.exports.plugin = plugin;

@ -7,7 +7,7 @@ function details() {
Operation: "Clean", Operation: "Clean",
Description: `[TESTING]This plugin removes video title metadata if it exists. \n\n`, Description: `[TESTING]This plugin removes video title metadata if it exists. \n\n`,
Version: "1.10", Version: "1.10",
Link: "", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js",
Tags:'pre-processing,ffmpeg,video only', Tags:'pre-processing,ffmpeg,video only',
} }
} }
@ -48,7 +48,6 @@ function plugin(file) {
try { try {
if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') { if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') {
ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" ` ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" `
response.infoLog += "2"
convert = true convert = true
} }
} catch (err) { } } catch (err) { }

@ -7,7 +7,7 @@ function details() {
Operation: "Clean", Operation: "Clean",
Description: `[TESTING]This plugin keeps only specified language audio tracks & can tags those that have an unknown language. \n\n`, Description: `[TESTING]This plugin keeps only specified language audio tracks & can tags those that have an unknown language. \n\n`,
Version: "2.00", Version: "2.00",
Link: "", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js",
Tags:'pre-processing,ffmpeg,audio only,configurable', Tags:'pre-processing,ffmpeg,audio only,configurable',
Inputs: [ Inputs: [
{ {
@ -38,6 +38,7 @@ function details() {
eng eng
\\nExample:\\n \\nExample:\\n
por
` `
}, },
{ {
@ -104,7 +105,7 @@ function plugin(file, librarySettings, inputs) {
} catch (err) { } } catch (err) { }
try { try {
if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description'))) { if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('sdh'))) {
audioStreamsRemoved++ audioStreamsRemoved++
ffmpegCommandInsert += `-map -0:a:${audioIdx} ` ffmpegCommandInsert += `-map -0:a:${audioIdx} `
response.infoLog += `☒Audio stream detected as being Commentary or Description, removing. Audio stream 0:a:${audioIdx} - ${file.ffProbeData.streams[i].tags.title}. \n` response.infoLog += `☒Audio stream detected as being Commentary or Description, removing. Audio stream 0:a:${audioIdx} - ${file.ffProbeData.streams[i].tags.title}. \n`

@ -7,7 +7,7 @@ function details() {
Operation: "Clean", Operation: "Clean",
Description: `[TESTING] This plugin keeps only specified language subtitle tracks & can tag those that have an unknown language. \n\n`, Description: `[TESTING] This plugin keeps only specified language subtitle tracks & can tag those that have an unknown language. \n\n`,
Version: "2.00", Version: "2.00",
Link: "", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js",
Tags:'pre-processing,ffmpeg,subtitle only,configurable', Tags:'pre-processing,ffmpeg,subtitle only,configurable',
Inputs: [ Inputs: [
{ {
@ -86,7 +86,7 @@ function plugin(file, librarySettings, inputs) {
} catch (err) { } } catch (err) { }
try { try {
if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description'))) { if (inputs.commentary.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && (file.ffProbeData.streams[i].tags.title.toLowerCase().includes('commentary') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('description') || file.ffProbeData.streams[i].tags.title.toLowerCase().includes('sdh'))) {
ffmpegCommandInsert += `-map -0:s:${subtitleIdx} ` ffmpegCommandInsert += `-map -0:s:${subtitleIdx} `
response.infoLog += `☒Subtitle stream detected as being Commentary or Description, removing. Subtitle stream 0:s:${SubtitleIdx} - ${file.ffProbeData.streams[i].tags.title}. \n` response.infoLog += `☒Subtitle stream detected as being Commentary or Description, removing. Subtitle stream 0:s:${SubtitleIdx} - ${file.ffProbeData.streams[i].tags.title}. \n`
convert = true convert = true

@ -117,4 +117,4 @@ function plugin(file, librarySettings, inputs) {
} }
module.exports.details = details; module.exports.details = details;
module.exports.plugin = plugin; module.exports.plugin = plugin;

@ -7,7 +7,7 @@ function details() {
Operation: "Organize", Operation: "Organize",
Description: `[TESTING]Organizes streams into Video first, then Audio (2ch, 6ch, 8ch) and finally Subtitles. \n\n`, Description: `[TESTING]Organizes streams into Video first, then Audio (2ch, 6ch, 8ch) and finally Subtitles. \n\n`,
Version: "1.00", Version: "1.00",
Link: "", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js",
Tags:'pre-processing,ffmpeg,' Tags:'pre-processing,ffmpeg,'
} }
} }
@ -44,7 +44,7 @@ function plugin(file) {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
if (subtitleIdx != "0") { if (subtitleIdx != "0") {
convert = true convert = true
response.infoLog += "☒ Audio not first. \n" response.infoLog += "☒ Audio not second. \n"
} }
audioIdx++ audioIdx++
if (file.ffProbeData.streams[i].channels == "2") { if (file.ffProbeData.streams[i].channels == "2") {

Loading…
Cancel
Save