mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-30 13:39:47 -06:00
FF-377 - added option same as source to audio nodes bitrate
This commit is contained in:
@@ -16,6 +16,9 @@ namespace FileFlows.AudioNodes
|
||||
/// Gets or sets duration in SECONDS
|
||||
/// </summary>
|
||||
public long Duration { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the bitrate (in bytes per second)
|
||||
/// </summary>
|
||||
public long Bitrate { get; set; }
|
||||
public string Codec { get; set; }
|
||||
public long Channels { get; set; }
|
||||
|
||||
@@ -161,9 +161,12 @@ namespace FileFlows.AudioNodes
|
||||
string br = line.Substring(line.ToLower().IndexOf("bitrate:") + "bitrate:".Length).Trim();
|
||||
if (br.IndexOf(" ") > 0)
|
||||
{
|
||||
int multiplier = br.ToLower().IndexOf("kb/s", StringComparison.Ordinal) > 0 ? 1024 :
|
||||
br.ToLower().IndexOf("mb/s", StringComparison.Ordinal) > 0 ? 1024 * 1024 :
|
||||
1;
|
||||
br = br.Substring(0, br.IndexOf(" "));
|
||||
if (long.TryParse(br, out long value))
|
||||
mi.Bitrate = value;
|
||||
mi.Bitrate = value * multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,13 +211,13 @@ namespace FileFlows.AudioNodes
|
||||
{
|
||||
if (SkipIfCodecMatches)
|
||||
{
|
||||
args.Logger?.ILog($"Audio file already '{Codec}' at bitrate '{AudioInfo.Bitrate}', and set to skip if codec matches");
|
||||
args.Logger?.ILog($"Audio file already '{Codec}' at bitrate '{AudioInfo.Bitrate} bps', and set to skip if codec matches");
|
||||
return 2;
|
||||
}
|
||||
|
||||
if(AudioInfo.Bitrate <= Bitrate)
|
||||
if(AudioInfo.Bitrate <= Bitrate * 1024) // this bitrate is in Kbps, whereas AudioInfo.Bitrate is bytes per second
|
||||
{
|
||||
args.Logger?.ILog($"Audio file already '{Codec}' at bitrate '{AudioInfo.Bitrate}'");
|
||||
args.Logger?.ILog($"Audio file already '{Codec}' at bitrate '{AudioInfo.Bitrate} bps'");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user