From 37246dd506490ba92a28dfc7d180949660c2f2d6 Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Wed, 25 Mar 2020 22:10:28 +0000 Subject: [PATCH] Update: MigzPlguin Update to Migz1FFMPEG plugins to deal with mjpeg streams. Detect and drop from being mapped. --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 10 ++++++++-- Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index e4a24e7..05aac9b 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -6,7 +6,7 @@ function details() { Type: "Video", Operation:"Transcode", 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", + Version: "2.20", 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: [ @@ -55,7 +55,7 @@ function plugin(file, librarySettings, inputs) { } if (inputs.container == "mkv") { - extraArguments = "-map -0:d " + extraArguments += "-map -0:d " } if (file.fileMedium !== "video") { @@ -70,6 +70,8 @@ function plugin(file, librarySettings, inputs) { var duration = (file.ffProbeData.streams[0].duration * 0.0166667) } + var videoIdx = 0 + var extraArguments = "" var bitrateSettings = "" var filesize = (file.file_size / 1000) var currentBitrate = ~~(file.file_size / (duration * 0.0075)) @@ -100,6 +102,9 @@ function plugin(file, librarySettings, inputs) { } 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 == 'mjpeg') { + extraArguments += `-map -v:${videoIdx} ` + } 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` @@ -111,6 +116,7 @@ function plugin(file, librarySettings, inputs) { response.processFile = true; return response } + videoIdx++ } } diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js index fad9d24..012825a 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -6,7 +6,7 @@ function details() { Type: "Video", Operation:"Transcode", Description: `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", + Version: "1.1", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js", Tags:'pre-processing,ffmpeg,video only,configurable,h265', Inputs: [ @@ -55,7 +55,7 @@ function plugin(file, librarySettings, inputs) { } if (inputs.container == "mkv") { - extraArguments = "-map -0:d " + extraArguments += "-map -0:d " } if (file.fileMedium !== "video") { @@ -70,6 +70,8 @@ function plugin(file, librarySettings, inputs) { var duration = (file.ffProbeData.streams[0].duration * 0.0166667) } + var videoIdx = 0 + var extraArguments = "" var bitrateSettings = "" var filesize = (file.file_size / 1000) var currentBitrate = ~~(file.file_size / (duration * 0.0075)) @@ -99,6 +101,9 @@ function plugin(file, librarySettings, inputs) { } 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 == 'mjpeg') { + extraArguments += `-map -v:${videoIdx} ` + } 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` @@ -110,6 +115,7 @@ function plugin(file, librarySettings, inputs) { response.processFile = true; return response } + videoIdx++ } }