Merge pull request #40 from Migz93/master

Migz Plugin Additions
make-only-subtitle-default
HaveAGitGat 6 years ago committed by GitHub
commit 93b7f3de95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,125 @@
function details() {
return {
id: "Tdarr_Plugin_MC93_Migz1FFMPEG",
Stage: "Pre-processing",
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 current file size. NVDEC & NVENC compatable GPU required. \n\n`,
Version: "2.00",
Link: "",
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`
},
]
}
}
function plugin(file, librarySettings, inputs) {
var response = {
processFile: false,
preset: '',
handBrakeMode: false,
FFmpegMode: true,
reQueueAfter: true,
infoLog: ''
}
var bitrateSettings = ""
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
}
response.infoLog += `Container for video selected as ${inputs.container}. \n`
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 (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
}
//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`
}
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`
}
if (file.file_size >= "30000") {
bitrateSettings = "-b:v 30M -minrate 20M"
} else if (file.file_size < "30000" && file.file_size >= "25000") {
bitrateSettings = "-b:v 15M -minrate 10M -maxrate 20M"
} else if (file.file_size < "25000" && file.file_size >= "20000") {
bitrateSettings = "-b:v 12M -minrate 8M -maxrate 16M"
} else if (file.file_size < "20000" && file.file_size >= "15000") {
bitrateSettings = "-b:v 10M -minrate 7M -maxrate 13M"
} else if (file.file_size < "15000" && file.file_size >= "10000") {
bitrateSettings = "-b:v 8M -minrate 6M -maxrate 10M"
} else if (file.file_size < "10000" && file.file_size >= "8000") {
bitrateSettings = "-b:v 5M -minrate 3M -maxrate 8M"
} else if (file.file_size < "8000" && file.file_size >= "6000") {
bitrateSettings = "-b:v 4M -minrate 2M -maxrate 6M"
} else if (file.file_size < "6000" && file.file_size >= "2000") {
bitrateSettings = "-b:v 3M -minrate 1M -maxrate 5M"
} else if (file.file_size < "2000" && file.file_size >= "500") {
bitrateSettings = "-b:v 1M -minrate 500k -maxrate 2M"
} else if (file.file_size < "500" ) {
bitrateSettings = "-b:v 250K -minrate 100k -maxrate 500k"
}
response.preset += `,-map 0 -c:v hevc_nvenc -rc:v vbr_hq ${bitrateSettings} -bufsize 2M -spatial_aq:v 1 -c:a copy -c:s copy -max_muxing_queue_size 4096`
response.processFile = true
response.infoLog += `☒File is not hevc. Transcoding. \n`
return response
}
module.exports.details = details;
module.exports.plugin = plugin;

@ -0,0 +1,65 @@
function details() {
return {
id: "Tdarr_Plugin_MC93_Migz2CleanTitle",
Stage: "Pre-processing",
Name: "Migz-Clean title metadata",
Type: "Video",
Operation: "Clean",
Description: `[TESTING]This plugin removes video title metadata if it exists. \n\n`,
Version: "1.00",
Link: ""
}
}
function plugin(file) {
var response = {
processFile : false,
preset : '',
container: '.' + file.container,
handBrakeMode : false,
FFmpegMode : true,
reQueueAfter : false,
infoLog : '',
}
var ffmpegCommandInsert = ''
var videoIdx = 0
var convert = false
if (file.fileMedium !== "video") {
console.log("File is not video")
response.infoLog += "☒File is not video \n"
response.processFile = false;
return response
}
if(file.meta.Title != undefined ){
ffmpegCommandInsert += ` -metadata title="" `
convert = true
}
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") {
if (file.ffProbeData.streams[i].tags.title != undefined) {
ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" `
convert = true
}
videoIdx++
}
}
if(convert == true){
response.infoLog += "☒File has title metadata \n"
response.preset = `,${ffmpegCommandInsert} -c copy`
response.reQueueAfter = true;
response.processFile = true;
}else{
response.infoLog += "☑File has no title metadata \n"
}
return response
}
module.exports.details = details;
module.exports.plugin = plugin;

@ -0,0 +1,170 @@
function details() {
return {
id: "Tdarr_Plugin_MC93_Migz3CleanAudio",
Stage: "Pre-processing",
Name: "Migz-Clean audio streams.",
Type: "Audio",
Operation: "Clean",
Description: `[TESTING]This plugin removes audio tracks which are not wanted & tags those that have an unknown language. \n\n`,
Version: "2.00",
Link: "",
Inputs: [
{
name: 'language',
tooltip: `Specify language tag/s here for the audio tracks you'd like to keep, recommended to keep "und" as this stands for undertermined, some files may not have the language specified. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
\\nExample:\\n
eng
\\nExample:\\n
eng,und
\\nExample:\\n
eng,und,jap`
},
{
name: 'commentary',
tooltip: `Specify if audio tracks that contain commentary/description should be removed.
\\nExample:\\n
true
\\nExample:\\n
false`
},
{
name: 'tag_language',
tooltip: `Specify a single language for audio tracks with no language or unknown language to be tagged with, leave empty to disable, you must have "und" in your list of languages to keep for this to function. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
\\nExample:\\n
eng
\\nExample:\\n
`
},
{
name: 'tag_title',
tooltip: `Specify audio tracks with no title to be tagged with the number of channels they contain. Do NOT use this with mp4, as mp4 does not support title tags.
\\nExample:\\n
true
\\nExample:\\n
false`
},
]
}
}
function plugin(file, librarySettings, inputs) {
var response = {
processFile: false,
preset: '',
container: '.' + file.container,
handBrakeMode: false,
FFmpegMode: true,
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
}
if (inputs.language == "") {
response.infoLog += "☒Language/s keep have not been configured within plugin settings, please configure required options. Skipping this plugin. \n"
response.processFile = false;
return response
}
var language = inputs.language.split(",")
var ffmpegCommandInsert = ''
var convert = false
var audioIdx = -1
var audioStreamsRemoved = 0
var audioStreamCount = file.ffProbeData.streams.filter(row => (row.codec_type.toLowerCase() == "audio")).length;
console.log("audioStreamCount:" + audioStreamCount)
response.infoLog += `Languages to keep are ${language} \n`
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
audioIdx++
}
} catch (err) { }
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && language.indexOf(file.ffProbeData.streams[i].tags.language.toLowerCase()) === -1) {
audioStreamsRemoved++
ffmpegCommandInsert += `-map -0:a:${audioIdx} `
response.infoLog += `☒Audio stream detected as being an unwanted language, removing. Audio stream 0:a:${audioIdx} - ${file.ffProbeData.streams[i].tags.language.toLowerCase()} \n`
convert = true
}
} catch (err) { }
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'))) {
audioStreamsRemoved++
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`
convert = true
}
} catch (err) { }
try {
if (inputs.tag_language != "") {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].tags.language.toLowerCase().includes('und') && language.indexOf('und') !== -1) {
ffmpegCommandInsert += `-metadata:s:a:${audioIdx} language=${inputs.tag_language} `
response.infoLog += `☒Audio stream detected as having unknown language tagged, tagging as ${inputs.tag_language}. \n`
convert = true
}
if (typeof file.ffProbeData.streams[i].tags.language === 'undefined' && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
ffmpegCommandInsert += `-metadata:s:a:${audioIdx} language=${inputs.tag_language} `
response.infoLog += `☒Audio stream detected as having no language tagged, tagging as ${inputs.tag_language}. \n`
convert = true
}
}
} catch (err) { }
try {
if (typeof file.ffProbeData.streams[i].tags.title == 'undefined' && inputs.tag_title.toLowerCase() == "true" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
if (file.ffProbeData.streams[i].channels == "8") {
ffmpegCommandInsert += `-metadata:s:a:${audioIdx} title="7.1" `
response.infoLog += `☒Audio stream detected as 8 channel audio track with no title, tagging title. Audio stream 0:a:${audioIdx} tagged as "7.1" \n`
convert = true
}
if (file.ffProbeData.streams[i].channels == "6") {
ffmpegCommandInsert += `-metadata:s:a:${audioIdx} title="5.1" `
response.infoLog += `☒Audio stream detected as 6 channel audio track with no title, tagging title. Audio stream 0:a:${audioIdx} tagged as "5.1" \n`
convert = true
}
if (file.ffProbeData.streams[i].channels == "2") {
ffmpegCommandInsert += `-metadata:s:a:${audioIdx} title="2.0" `
response.infoLog += `☒Audio stream detected as 2 channel audio track with no title, tagging title. Audio stream 0:a:${audioIdx} tagged as "2.0" \n`
convert = true
}
}
} catch (err) { }
}
if (audioStreamsRemoved == audioStreamCount) {
response.infoLog += "☒Cancelling plugin otherwise all audio tracks would be removed. \n"
response.processFile = false
return response
}
if (convert === true && (audioStreamsRemoved != audioStreamCount)) {
response.processFile = true
response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy`
response.container = '.' + file.container
response.reQueueAfter = true
} else {
response.processFile = false
response.infoLog += "☑File doesn't contain audio tracks which are unwanted or that require tagging.\n"
}
return response
}
module.exports.details = details;
module.exports.plugin = plugin;

@ -0,0 +1,125 @@
function details() {
return {
id: "Tdarr_Plugin_MC93_Migz4CleanSubs",
Stage: "Pre-processing",
Name: "Migz-Clean subtitle streams.",
Type: "subtitless",
Operation: "Clean",
Description: `[TESTING]This plugin removes subtitle tracks which are not wanted & tags subtitles that have an unknown language. \n\n`,
Version: "2.00",
Link: "",
Inputs: [
{
name: 'language',
tooltip: `Specify language tag/s here for the subtitle tracks you'd like to keep. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
\\nExample:\\n
eng
\\nExample:\\n
eng,jap`
},
{
name: 'commentary',
tooltip: `Specify if subtitle tracks that contain commentary/description should be removed.
\\nExample:\\n
true
\\nExample:\\n
false`
},
{
name: 'tag_title',
tooltip: `Specify a single language for subtitle tracks with no language or unknown language to be tagged with, leave empty to disable. Must follow ISO-639-2 3 letter format. https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
\\nExample:\\n
eng
\\nExample:\\n
por`
},
]
}
}
function plugin(file, librarySettings, inputs) {
var response = {
processFile: false,
preset: '',
container: '.' + file.container,
handBrakeMode: false,
FFmpegMode: true,
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
}
if (inputs.language == "") {
response.infoLog += "☒Language/s keep have not been configured within plugin settings, please configure required options. Skipping this plugin. \n"
response.processFile = false;
return response
}
var language = inputs.language.split(",")
var ffmpegCommandInsert = ''
var subtitleIdx = -1
var convert = false
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") {
subtitleIdx++
}
} catch (err) { }
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && language.indexOf(file.ffProbeData.streams[i].tags.language.toLowerCase()) === -1) {
ffmpegCommandInsert += `-map -0:s:${subtitleIdx} `
response.infoLog += `☒Subtitle stream detected as being an unwanted language, removing. Subtitle stream 0:s:${subtitleIdx} - ${file.ffProbeData.streams[i].tags.language.toLowerCase()} \n`
convert = true
}
} catch (err) { }
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'))) {
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`
convert = true
}
} catch (err) { }
try {
if (inputs.tag_title != "") {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && file.ffProbeData.streams[i].tags.language.toLowerCase().includes('und')) {
ffmpegCommandInsert += `-metadata:s:s:${subtitleIdx} language=${inputs.tag_title} `
response.infoLog += `☒Subtitle stream detected as having unknown language tagged, tagging as ${inputs.tag_title}. \n`
convert = true
}
}
} catch (err) { }
try {
if (typeof file.ffProbeData.streams[i].tags.language == 'undefined' && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") {
ffmpegCommandInsert += `-metadata:s:s:${subtitleIdx} language=${inputs.tag_title} `
response.infoLog += `☒Subtitle stream detected as having no language tagged, tagging as ${inputs.tag_title}. \n`
convert = true
}
} catch (err) { }
}
if (convert === true ) {
response.processFile = true;
response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy`
response.container = '.' + file.container
response.reQueueAfter = true;
} else {
response.processFile = false;
response.infoLog += "☑File doesn't contain subtitle tracks which are unwanted or that require tagging.\n"
}
return response
}
module.exports.details = details;
module.exports.plugin = plugin;

@ -0,0 +1,119 @@
function details() {
return {
id: "Tdarr_Plugin_MC93_Migz5ConvertAudio",
Stage: "Pre-processing",
Name: "Migz-Convert audio streams.",
Type: "Audio",
Operation: "Transcode",
Description: `[TESTING]This plugin can convert any 2.0 audio track/s to AAC and can create downmixed audio tracks. \n\n`,
Version: "2.00",
Link: "",
Inputs: [
{
name: 'aac_stereo',
tooltip: `Specify if any 2.0 audio tracks should be converted to aac for maximum compatability with devices.
\\nExample:\\n
true
\\nExample:\\n
false`
},
{
name: 'downmix',
tooltip: `Specify if downmixing should be used to create extra audio tracks. I.e if you have an 8ch but no 2ch or 6ch, create the missing audio tracks from the 8 ch. Likewise if you only have 6ch, create the missing 2ch from it.
\\nExample:\\n
true
\\nExample:\\n
false`
},
]
}
}
function plugin(file, librarySettings, inputs) {
var response = {
processFile: false,
container: '.' + file.container,
handBrakeMode: false,
FFmpegMode: true,
reQueueAfter: true,
infoLog: '',
}
if (file.fileMedium !== "video") {
console.log("File is not video")
response.infoLog += "☒File is not video. \n"
response.processFile = false;
return response
}
if (inputs.aac_stereo == "" && inputs.downmix == "") {
response.infoLog += "☒Neither aac_stereo or downmix options have been configured within plugin settings, please configure required options. Skipping this plugin. \n"
response.processFile = false
return response
}
var ffmpegCommandInsert = ''
var audioIdx = 0
var has2Channel = false
var has6Channel = false
var has8Channel = false
var convert = false
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
if (file.ffProbeData.streams[i].channels == "2") {
has2Channel = true
}
if (file.ffProbeData.streams[i].channels == "6") {
has6Channel = true
}
if (file.ffProbeData.streams[i].channels == "8") {
has8Channel = true
}
}
} catch (err) { }
}
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
if (inputs.downmix.toLowerCase() == "true") {
if (has8Channel == true && has6Channel == false && file.ffProbeData.streams[i].channels == "8") {
ffmpegCommandInsert += `-map 0:${i} -c:a:${audioIdx} ac3 -ac 6 -metadata:s:a:${audioIdx} title="5.1 " `
response.infoLog += "☒Audio track is 8 channel, no 6 channel exists. Creating 2 channel from 6 channel. \n"
convert = true
}
if (has6Channel == true && has2Channel == false && file.ffProbeData.streams[i].channels == "6") {
ffmpegCommandInsert += `-map 0:${i} -c:a:${audioIdx} aac -ac 2 -metadata:s:a:${audioIdx} title="2.0 " `
response.infoLog += "☒Audio track is 6 channel, no 2 channel exists. Creating 2 channel from 6 channel. \n"
convert = true
}
}
if (inputs.aac_stereo.toLowerCase() == "true") {
if (file.ffProbeData.streams[i].codec_name != "aac" && file.ffProbeData.streams[i].channels == "2" ) {
ffmpegCommandInsert += `-c:a:${audioIdx} aac `
response.infoLog += "☒Audio track is 2 channel but is not AAC. Converting. \n"
convert = true
}
}
audioIdx++
}
}
if (convert == true) {
response.processFile = true;
response.preset = `, -map 0 -c:v copy -c:a copy ${ffmpegCommandInsert} -strict -2 -c:s copy `
} else {
response.infoLog += "☑File contains all required audio formats. \n"
response.processFile = false;
}
return response
}
module.exports.details = details;
module.exports.plugin = plugin;

@ -0,0 +1,136 @@
function details() {
return {
id: "Tdarr_Plugin_MC93_Migz6OrderStreams",
Stage: "Pre-processing",
Name: "Migz-Organize Streams.",
Type: "Streams",
Operation: "Organize",
Description: `[TESTING]Organizes streams into Video first, then Audio (2ch, 6ch, 8ch) and finally Subtitles. \n\n`,
Version: "1.00",
Link: ""
}
}
function plugin(file) {
var response = {
processFile: false,
preset: '',
container: '.' + file.container,
handBrakeMode: false,
FFmpegMode: true,
infoLog: '',
}
var ffmpegCommandInsert = ''
var videoIdx = 0
var audioIdx = 0
var audio2Idx = 0
var audio6Idx = 0
var audio8Idx = 0
var subtitleIdx = 0
var convert = false
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") {
if (audioIdx != "0" || subtitleIdx != "0") {
convert = true
response.infoLog += "☒ Video not first. \n"
}
videoIdx++
}
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
if (subtitleIdx != "0") {
convert = true
response.infoLog += "☒ Audio not first. \n"
}
audioIdx++
if (file.ffProbeData.streams[i].channels == "2") {
if (audio6Idx != "0" || audio8Idx != "0") {
convert = true
response.infoLog += "☒ Audio 2ch not first. \n"
}
audio2Idx++
}
if (file.ffProbeData.streams[i].channels == "6") {
if (audio8Idx != "0") {
convert = true
response.infoLog += "☒ Audio 6ch not second. \n"
}
audio6Idx++
}
if (file.ffProbeData.streams[i].channels == "8") {
audio8Idx++
response.infoLog += "☒ Audio 8ch not last. \n"
}
}
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") {
subtitleIdx++
}
} catch (err) { }
}
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video" && file.ffProbeData.streams[i].codec_name.toLowerCase() != "mjpeg") {
ffmpegCommandInsert += `-map 0:${i} `
}
} catch (err) { }
}
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels == "2") {
ffmpegCommandInsert += `-map 0:${i} `
}
} catch (err) { }
}
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels == "6") {
ffmpegCommandInsert += `-map 0:${i} `
}
} catch (err) { }
}
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels == "8") {
ffmpegCommandInsert += `-map 0:${i} `
}
} catch (err) { }
}
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].channels != "2" && file.ffProbeData.streams[i].channels != "6" && file.ffProbeData.streams[i].channels != "8") {
ffmpegCommandInsert += `-map 0:${i} `
}
} catch (err) { }
}
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") {
ffmpegCommandInsert += `-map 0:${i} `
}
} catch (err) { }
}
if (convert == true) {
response.processFile = true;
response.preset = `,${ffmpegCommandInsert} -c copy`
response.reQueueAfter = true;
response.infoLog += "☒ Streams are out of order, reorganizing streams. Video, Audio, Subtitles. \n"
} else {
response.infoLog += "☑ Streams are in expected order. \n "
response.processFile = false;
}
return response
}
module.exports.details = details;
module.exports.plugin = plugin;
Loading…
Cancel
Save