diff --git a/BasicNodes/BasicNodes.csproj b/BasicNodes/BasicNodes.csproj index f3800900..f97d96de 100644 Binary files a/BasicNodes/BasicNodes.csproj and b/BasicNodes/BasicNodes.csproj differ diff --git a/Builds/BasicNodes.zip b/Builds/BasicNodes.zip index 51adeb7e..35b27c7e 100644 Binary files a/Builds/BasicNodes.zip and b/Builds/BasicNodes.zip differ diff --git a/Builds/MetaNodes.zip b/Builds/MetaNodes.zip index eece5062..00c2f5b7 100644 Binary files a/Builds/MetaNodes.zip and b/Builds/MetaNodes.zip differ diff --git a/Builds/VideoNodes.zip b/Builds/VideoNodes.zip index 04b5c8ff..451b21c3 100644 Binary files a/Builds/VideoNodes.zip and b/Builds/VideoNodes.zip differ diff --git a/MetaNodes/MetaNodes.csproj b/MetaNodes/MetaNodes.csproj index 00e81eaf..bd3c934d 100644 Binary files a/MetaNodes/MetaNodes.csproj and b/MetaNodes/MetaNodes.csproj differ diff --git a/VideoNodes/LogicalNodes/DetectBlackBars.cs b/VideoNodes/LogicalNodes/DetectBlackBars.cs index 37daac6f..03dde0cf 100644 --- a/VideoNodes/LogicalNodes/DetectBlackBars.cs +++ b/VideoNodes/LogicalNodes/DetectBlackBars.cs @@ -16,6 +16,9 @@ namespace FileFlows.VideoNodes internal const string CROP_KEY = "VideoCrop"; + [NumberInt(1)] + public int CroppingThreshold { get; set; } + public override int Execute(NodeParameters args) { string ffplay = GetFFMpegExe(args); @@ -26,13 +29,13 @@ namespace FileFlows.VideoNodes if (crop == string.Empty) return 2; - args.Logger.ILog("Black bars detcted, crop: " + crop); + args.Logger.ILog("Black bars detected, crop: " + crop); args.Parameters.Add(CROP_KEY, crop); return 1; } - public string Execute(string ffplay, string file, string tempDir) + public string Execute(string ffplay, string file, string tempDir, NodeParameters args) { string tempFile = Path.Combine(tempDir, Guid.NewGuid().ToString() + ".mkv"); try @@ -71,9 +74,13 @@ namespace FileFlows.VideoNodes if (y == int.MaxValue) y = 0; - if (x + y < 28) // to small to bother croping - return string.Empty; - return $"{width}:{height}:{x}:{y}"; + if(CroppingThreshold < 0) + CroppingThreshold = 0; + + bool willCrop = (x + y) > CroppingThreshold; + args.Logger?.ILog($"Crop detection, x:{x}, y:{y}, total:{x + y}, threshold:{CroppingThreshold}, above threshold: {willCrop}"); + + return willCrop ? $"{width}:{height}:{x}:{y}" : string.Empty; } } catch (Exception) diff --git a/VideoNodes/VideoNodes.csproj b/VideoNodes/VideoNodes.csproj index 1f3ce970..dd4f804d 100644 Binary files a/VideoNodes/VideoNodes.csproj and b/VideoNodes/VideoNodes.csproj differ diff --git a/VideoNodes/VideoNodes.en.json b/VideoNodes/VideoNodes.en.json index ce3e8303..f11d4166 100644 --- a/VideoNodes/VideoNodes.en.json +++ b/VideoNodes/VideoNodes.en.json @@ -5,7 +5,11 @@ "Description":"An input video file that has had its VideoInformation read and can be processed" }, "DetectBlackBars":{ - "Description":"Processes a video file and scans for black bars in the video.\n\nIf found a parameter \"VideoCrop\" will be added.\n\nOutput 1: Black bars detected\nOutput 2: Not detected" + "Description": "Processes a video file and scans for black bars in the video.\n\nIf found a parameter \"VideoCrop\" will be added.\n\nOutput 1: Black bars detected\nOutput 2: Not detected", + "Fields": { + "CroppingThreshold": "Threshold", + "CroppingThreshold-Help": "The amount of pixels that must be greater than to crop. E.g. if theres only 5 pixels detected as black space, you may consider this too small to crop." + } }, "VideoCodec":{ "Description":"This node will check the codecs in the input file, and trigger when matched.\n\nOutput 1: Matches\nOutput 2: Does not match", diff --git a/plugins.json b/plugins.json index 097afbe9..eedceabb 100644 --- a/plugins.json +++ b/plugins.json @@ -1,17 +1,17 @@ [ { "Name": "BasicNodes", - "Version": "0.0.1.20", + "Version": "0.0.1.21", "Package": "https://github.com/revenz/FileFlowsPlugins/blob/master/Builds/BasicNodes.zip?raw=true" }, { "Name": "MetaNodes", - "Version": "0.0.1.20", + "Version": "0.0.1.21", "Package": "https://github.com/revenz/FileFlowsPlugins/blob/master/Builds/MetaNodes.zip?raw=true" }, { "Name": "VideoNodes", - "Version": "0.0.1.20", + "Version": "0.0.1.21", "Package": "https://github.com/revenz/FileFlowsPlugins/blob/master/Builds/VideoNodes.zip?raw=true" } ]