fixed issue with audio normalizing

fixed issue with moving files
This commit is contained in:
reven
2021-11-30 14:26:27 +13:00
parent 197d512526
commit 6215d927d6
11 changed files with 20 additions and 5 deletions

Binary file not shown.

View File

@@ -26,6 +26,8 @@ namespace FileFlows.BasicNodes.File
public override int Execute(NodeParameters args)
{
string dest = args.ReplaceVariables(DestinationPath, true);
dest = dest.Replace("\\", Path.DirectorySeparatorChar.ToString());
dest = dest.Replace("/", Path.DirectorySeparatorChar.ToString());
if (string.IsNullOrEmpty(dest))
{
args.Logger?.ELog("No destination specified");

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -66,6 +66,11 @@ namespace FileFlows.VideoNodes
/// The duration of the stream
/// </summary>
public TimeSpan Duration { get; set; }
/// <summary>
/// The sample rate of the audio stream
/// </summary>
public int SampleRate { get; set; }
}
public class SubtitleStream : VideoFileStream

View File

@@ -13,6 +13,7 @@ namespace FileFlows.VideoNodes
Regex rgxTitle = new Regex(@"(?<=((^[\s]+title[\s]+:[\s])))(.*?)$", RegexOptions.Multiline);
Regex rgxDuration = new Regex(@"(?<=((^[\s]+DURATION(\-[\w]+)?[\s]+:[\s])))([\d]+:?)+\.[\d]+[1-9]", RegexOptions.Multiline);
Regex rgxDuration2 = new Regex(@"(?<=((^[\s]+Duration:[\s])))([\d]+:?)+\.[\d]+[1-9]", RegexOptions.Multiline);
Regex rgxAudioSampleRate = new Regex(@"(?<=((,|\s)))[\d]+(?=([\s]?hz))", RegexOptions.IgnoreCase);
public VideoInfoHelper(string ffMpegExe, ILogger logger)
{
@@ -147,6 +148,10 @@ namespace FileFlows.VideoNodes
audio.Channels = float.Parse(Regex.Match(parts[2], @"^[\d]+(\.[\d]+)?").Value);
}
var match = rgxAudioSampleRate.Match(info);
if (match.Success)
audio.SampleRate = int.Parse(match.Value);
if (rgxTitle.IsMatch(info))
audio.Title = rgxTitle.Match(info).Value.Trim();

Binary file not shown.

View File

@@ -108,8 +108,11 @@ namespace FileFlows.VideoNodes
TotalTime = videoInfo.VideoStreams[0].Duration;
if(NormalizeAudio)
ffArgs.Add($"-map 0:{bestAudio.Index} -c:a ac3 -af loudnorm=I=-24:LRA=7:TP=-2.0");
if (NormalizeAudio)
{
int sampleRate = bestAudio.SampleRate > 0 ? bestAudio.SampleRate : 48_000;
ffArgs.Add($"-map 0:{bestAudio.Index} -c:a ac3 -ar {sampleRate} -af loudnorm=I=-24:LRA=7:TP=-2.0");
}
else if (bestAudio.Codec.ToLower() != "ac3")
ffArgs.Add($"-map 0:{bestAudio.Index} -c:a ac3");
else

View File

@@ -1,17 +1,17 @@
[
{
"Name": "BasicNodes",
"Version": "0.0.1.17",
"Version": "0.0.1.18",
"Package": "https://github.com/revenz/FileFlowsPlugins/blob/master/Builds/BasicNodes.zip?raw=true"
},
{
"Name": "MetaNodes",
"Version": "0.0.1.17",
"Version": "0.0.1.18",
"Package": "https://github.com/revenz/FileFlowsPlugins/blob/master/Builds/MetaNodes.zip?raw=true"
},
{
"Name": "VideoNodes",
"Version": "0.0.1.17",
"Version": "0.0.1.18",
"Package": "https://github.com/revenz/FileFlowsPlugins/blob/master/Builds/VideoNodes.zip?raw=true"
}
]