diff --git a/BasicNodes/BasicNodes.csproj b/BasicNodes/BasicNodes.csproj index 805ad689..caca0dbe 100644 Binary files a/BasicNodes/BasicNodes.csproj and b/BasicNodes/BasicNodes.csproj differ diff --git a/Builds/BasicNodes.zip b/Builds/BasicNodes.zip index e1d83390..3666644a 100644 Binary files a/Builds/BasicNodes.zip and b/Builds/BasicNodes.zip differ diff --git a/Builds/MetaNodes.zip b/Builds/MetaNodes.zip index a1468aa3..e71ee5d3 100644 Binary files a/Builds/MetaNodes.zip and b/Builds/MetaNodes.zip differ diff --git a/Builds/VideoNodes.zip b/Builds/VideoNodes.zip index 581fe18d..b03ccd2c 100644 Binary files a/Builds/VideoNodes.zip and b/Builds/VideoNodes.zip differ diff --git a/MetaNodes/MetaNodes.csproj b/MetaNodes/MetaNodes.csproj index aae95b3a..2af5c0bc 100644 Binary files a/MetaNodes/MetaNodes.csproj and b/MetaNodes/MetaNodes.csproj differ diff --git a/VideoNodes/ExtensionMethods.cs b/VideoNodes/ExtensionMethods.cs index 01f63af9..e9c21ba7 100644 --- a/VideoNodes/ExtensionMethods.cs +++ b/VideoNodes/ExtensionMethods.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VideoNodes +namespace FileFlows.VideoNodes { internal static class ExtensionMethods { @@ -12,7 +6,11 @@ namespace VideoNodes if (dict.ContainsKey(key)) dict[key] = value; else - dict.Add(key, value); + dict.Add(key, value); + } + public static string? EmptyAsNull(this string str) + { + return str == string.Empty ? null : str; } } } diff --git a/VideoNodes/VideoNodes.csproj b/VideoNodes/VideoNodes.csproj index 2c8d91fd..401201f5 100644 Binary files a/VideoNodes/VideoNodes.csproj and b/VideoNodes/VideoNodes.csproj differ diff --git a/VideoNodes/VideoNodes/VideoEncode.cs b/VideoNodes/VideoNodes/VideoEncode.cs index c5047ec5..74bc5273 100644 --- a/VideoNodes/VideoNodes/VideoEncode.cs +++ b/VideoNodes/VideoNodes/VideoEncode.cs @@ -51,7 +51,7 @@ namespace FileFlows.VideoNodes VideoCodecParameters = args.ReplaceVariables(VideoCodecParameters); AudioCodec = args.ReplaceVariables(AudioCodec); Language = args.ReplaceVariables(Language); - Extension = args.ReplaceVariables(Extension); + Extension = args.ReplaceVariables(Extension)?.EmptyAsNull() ?? "mkv"; VideoCodec = VideoCodec.ToLower(); AudioCodec = AudioCodec.ToLower(); @@ -92,6 +92,8 @@ namespace FileFlows.VideoNodes bool audioRightCodec = bestAudio?.Codec?.ToLower() == AudioCodec && videoInfo.AudioStreams[0] == bestAudio; args.Logger?.ILog("Best Audio: ", bestAudio == null ? "null" : (object)bestAudio); + bool sameContainer = new FileInfo(args.WorkingFile).Extension.ToLower() == Extension.ToLower(); + string crop = args.GetParameter(DetectBlackBars.CROP_KEY) ?? ""; if (crop != string.Empty) @@ -123,7 +125,7 @@ namespace FileFlows.VideoNodes TotalTime = videoInfo.VideoStreams[0].Duration; - if (audioRightCodec == false || videoIsRightCodec == null) // always redo audio if video is wrong codec, as this can lead to some failed encodes (found in mp4s to mkvs) + if (audioRightCodec == false || sameContainer == false) // if container changes, re-encode audio, otherwise this can lead to failed encodings (mp4 to mkv this can happen... a lot) ffArgs.Add($"-map 0:{bestAudio!.Index} -c:a {AudioCodec}"); else ffArgs.Add($"-map 0:{bestAudio!.Index} -c:a copy"); diff --git a/VideoNodes/VideoNodes/VideoNode.cs b/VideoNodes/VideoNodes/VideoNode.cs index 66e2badf..74d9a0a8 100644 --- a/VideoNodes/VideoNodes/VideoNode.cs +++ b/VideoNodes/VideoNodes/VideoNode.cs @@ -1,7 +1,6 @@ namespace FileFlows.VideoNodes { using FileFlows.Plugin; - using global::VideoNodes; public abstract class VideoNode : Node { diff --git a/plugins.json b/plugins.json index 249433a1..858cb8fc 100644 --- a/plugins.json +++ b/plugins.json @@ -1,17 +1,17 @@ [ { "Name": "BasicNodes", - "Version": "0.0.1.26", + "Version": "0.0.1.27", "Package": "https://github.com/revenz/FileFlowsPlugins/blob/master/Builds/BasicNodes.zip?raw=true" }, { "Name": "MetaNodes", - "Version": "0.0.1.26", + "Version": "0.0.1.27", "Package": "https://github.com/revenz/FileFlowsPlugins/blob/master/Builds/MetaNodes.zip?raw=true" }, { "Name": "VideoNodes", - "Version": "0.0.1.26", + "Version": "0.0.1.27", "Package": "https://github.com/revenz/FileFlowsPlugins/blob/master/Builds/VideoNodes.zip?raw=true" } ]