mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-02-16 07:08:58 -06:00
update VideoEncode to only force audio reencode if container changes
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -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<string>(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");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace FileFlows.VideoNodes
|
||||
{
|
||||
using FileFlows.Plugin;
|
||||
using global::VideoNodes;
|
||||
|
||||
public abstract class VideoNode : Node
|
||||
{
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user