mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-30 15:09:45 -06:00
fixed issue with video stream indexes
This commit is contained in:
@@ -5,7 +5,7 @@ namespace FileFlows.BasicNodes
|
||||
public class Plugin : FileFlows.Plugin.IPlugin
|
||||
{
|
||||
public string Name => "Basic Nodes";
|
||||
public string MinimumVersion => "0.5.0.679";
|
||||
public string MinimumVersion => "0.5.0.683";
|
||||
|
||||
public void Init() { }
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace ChecksumNodes
|
||||
public class Plugin : IPlugin
|
||||
{
|
||||
public string Name => "Checksum Nodes";
|
||||
public string MinimumVersion => "0.5.0.679";
|
||||
public string MinimumVersion => "0.5.0.683";
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace CollectionNodes
|
||||
public class Plugin : IPlugin
|
||||
{
|
||||
public string Name => "Collection Nodes";
|
||||
public string MinimumVersion => "0.5.0.679";
|
||||
public string MinimumVersion => "0.5.0.683";
|
||||
|
||||
[Folder(1)]
|
||||
[Required]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
public class Plugin : IPlugin
|
||||
{
|
||||
public string Name => "Email Nodes";
|
||||
public string MinimumVersion => "0.5.0.679";
|
||||
public string MinimumVersion => "0.5.0.683";
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace MetaNodes
|
||||
public class Plugin : FileFlows.Plugin.IPlugin
|
||||
{
|
||||
public string Name => "Meta Nodes";
|
||||
public string MinimumVersion => "0.5.0.679";
|
||||
public string MinimumVersion => "0.5.0.683";
|
||||
|
||||
public void Init() { }
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace FileFlows.MusicNodes
|
||||
public class Plugin : FileFlows.Plugin.IPlugin
|
||||
{
|
||||
public string Name => "Music Nodes";
|
||||
public string MinimumVersion => "0.5.0.679";
|
||||
public string MinimumVersion => "0.5.0.683";
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
if (Deleted)
|
||||
return new string[] { };
|
||||
|
||||
var results = new List<string> { "-map", "0:s:" + outputIndex, "-c:s:" + (Stream.TypeIndex - 1) };
|
||||
var results = new List<string> { "-map", "0:s:" + outputIndex, "-c:s:" + Stream.TypeIndex };
|
||||
//if (EncodingParameters.Any() == false)
|
||||
{
|
||||
results.Add("copy");
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace FileFlows.VideoNodes
|
||||
public class Plugin : FileFlows.Plugin.IPlugin
|
||||
{
|
||||
public string Name => "Video Nodes";
|
||||
public string MinimumVersion => "0.5.0.679";
|
||||
public string MinimumVersion => "0.5.0.683";
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
@@ -728,6 +728,54 @@ namespace FileFlows.VideoNodes.Tests.FfmpegBuilderTests
|
||||
string log = logger.ToString();
|
||||
Assert.AreEqual(1, result);
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void FfmpegBuilder_AudioMinusOne()
|
||||
{
|
||||
const string file = @"D:\videos\unprocessed\minus1.mkv";
|
||||
var logger = new TestLogger();
|
||||
const string ffmpeg = @"C:\utils\ffmpeg\ffmpeg.exe";
|
||||
var vi = new VideoInfoHelper(ffmpeg, logger);
|
||||
var vii = vi.Read(file);
|
||||
var args = new NodeParameters(file, logger, false, string.Empty);
|
||||
args.GetToolPathActual = (string tool) => ffmpeg;
|
||||
args.TempPath = @"D:\videos\temp";
|
||||
args.Parameters.Add("VideoInfo", vii);
|
||||
|
||||
|
||||
FfmpegBuilderStart ffStart = new();
|
||||
Assert.AreEqual(1, ffStart.Execute(args));
|
||||
|
||||
//FfmpegBuilderVideoCodec ffEncode = new();
|
||||
//ffEncode.VideoCodec = "h264";
|
||||
//ffEncode.Execute(args);
|
||||
|
||||
FfmpegBuilderAudioTrackRemover ffAudioRemover = new();
|
||||
ffAudioRemover.RemoveAll = true;
|
||||
ffAudioRemover.Execute(args);
|
||||
|
||||
FfmpegBuilderAudioAddTrack ffAddAudio = new();
|
||||
ffAddAudio.Codec = "ac3";
|
||||
ffAddAudio.Index = 0;
|
||||
ffAddAudio.Execute(args);
|
||||
|
||||
//FfmpegBuilderAudioAddTrack ffAddAudio2 = new();
|
||||
//ffAddAudio2.Codec = "aac";
|
||||
//ffAddAudio2.Index = 2;
|
||||
//ffAddAudio2.Execute(args);
|
||||
|
||||
//FfmpegBuilderAudioNormalization ffAudioNormalize = new();
|
||||
//ffAudioNormalize.TwoPass = false;
|
||||
//ffAudioNormalize.AllAudio = true;
|
||||
//ffAudioNormalize.Execute(args);
|
||||
|
||||
FfmpegBuilderExecutor ffExecutor = new();
|
||||
int result = ffExecutor.Execute(args);
|
||||
|
||||
string log = logger.ToString();
|
||||
Assert.AreEqual(1, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,9 @@ namespace FileFlows.VideoNodes
|
||||
|
||||
vi.Chapters = ParseChapters(output);
|
||||
|
||||
int subtitleIndex = 1;
|
||||
int subtitleIndex = 0;
|
||||
int videoIndex = 0;
|
||||
int audioIndex = 0;
|
||||
foreach (Match sm in streamMatches)
|
||||
{
|
||||
if (sm.Value.Contains(" Video: "))
|
||||
@@ -102,23 +104,27 @@ namespace FileFlows.VideoNodes
|
||||
if (vs != null)
|
||||
{
|
||||
vs.Index = streamIndex;
|
||||
vs.TypeIndex = videoIndex;
|
||||
var match = Regex.Match(sm.Value, @"(?<=(Stream #))[\d]+:[\d]+");
|
||||
if (match.Success)
|
||||
vs.IndexString = match.Value;
|
||||
vi.VideoStreams.Add(vs);
|
||||
}
|
||||
++videoIndex;
|
||||
}
|
||||
else if (sm.Value.Contains(" Audio: "))
|
||||
{
|
||||
var audio = ParseAudioStream(sm.Value);
|
||||
if (audio != null)
|
||||
{
|
||||
audio.TypeIndex = audioIndex;
|
||||
audio.Index = streamIndex;
|
||||
var match = Regex.Match(sm.Value, @"(?<=(Stream #))[\d]+:[\d]+");
|
||||
if (match.Success)
|
||||
audio.IndexString = match.Value;
|
||||
vi.AudioStreams.Add(audio);
|
||||
}
|
||||
++audioIndex;
|
||||
}
|
||||
else if (sm.Value.Contains(" Subtitle: "))
|
||||
{
|
||||
@@ -198,8 +204,6 @@ namespace FileFlows.VideoNodes
|
||||
vs.Width = width;
|
||||
if (int.TryParse(dimensions.Groups[2].Value, out int height))
|
||||
vs.Height = height;
|
||||
if (int.TryParse(Regex.Match(line, @"#([\d]+):([\d]+)").Groups[2].Value, out int typeIndex))
|
||||
vs.TypeIndex = typeIndex;
|
||||
|
||||
if (Regex.IsMatch(line, @"([\d]+(\.[\d]+)?)\sfps") && float.TryParse(Regex.Match(line, @"([\d]+(\.[\d]+)?)\sfps").Groups[1].Value, out float fps))
|
||||
vs.FramesPerSecond = fps;
|
||||
@@ -235,6 +239,7 @@ namespace FileFlows.VideoNodes
|
||||
var parts = line.Split(",").Select(x => x?.Trim() ?? "").ToArray();
|
||||
AudioStream audio = new AudioStream();
|
||||
audio.Title = "";
|
||||
// this isnt type index, this is overall index
|
||||
audio.TypeIndex = int.Parse(Regex.Match(line, @"#([\d]+):([\d]+)").Groups[2].Value) - 1;
|
||||
audio.Codec = parts[0].Substring(parts[0].IndexOf("Audio: ") + "Audio: ".Length).Trim().Split(' ').First().ToLower() ?? "";
|
||||
audio.Language = Regex.Match(line, @"(?<=(Stream\s#[\d]+:[\d]+)\()[^\)]+").Value?.ToLower() ?? "";
|
||||
|
||||
Reference in New Issue
Block a user