Merge branch 'master' of https://github.com/HaveAGitGat/Tdarr_Plugins
commit
a4fe115a7c
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
@ -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;
|
||||||
@ -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: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
@ -0,0 +1,162 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function details() {
|
||||||
|
|
||||||
|
return {
|
||||||
|
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
|
||||||
|
`,
|
||||||
|
Version: "1.00",
|
||||||
|
Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.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 medium -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;
|
||||||
@ -0,0 +1,161 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function details() {
|
||||||
|
|
||||||
|
return {
|
||||||
|
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
|
||||||
|
`,
|
||||||
|
Version: "1.00",
|
||||||
|
Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.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 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;
|
||||||
@ -0,0 +1,162 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function details() {
|
||||||
|
|
||||||
|
return {
|
||||||
|
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
|
||||||
|
`,
|
||||||
|
Version: "1.00",
|
||||||
|
Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z2ab_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;
|
||||||
@ -0,0 +1,162 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function details() {
|
||||||
|
|
||||||
|
return {
|
||||||
|
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
|
||||||
|
`,
|
||||||
|
Version: "1.00",
|
||||||
|
Link: "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z3ab_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;
|
||||||
Loading…
Reference in new issue