added sensible defaults for audio add track node

This commit is contained in:
reven
2022-01-31 12:28:58 +13:00
parent 25510f25d9
commit 7fb2faf77d
3 changed files with 23 additions and 1 deletions

View File

@@ -30,7 +30,7 @@ namespace VideoNodes.Tests
new VideoFile().Execute(args);
node.Bitrate = 128;
node.Channels = 2;
node.Channels = 0;
node.Index = 2;
node.Codec = "aac";

Binary file not shown.

View File

@@ -4,6 +4,7 @@
using FileFlows.Plugin.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@@ -15,9 +16,11 @@
[NumberInt(1)]
[Range(1, 100)]
[DefaultValue(2)]
public int Index { get; set; }
[DefaultValue("aac")]
[Select(nameof(CodecOptions), 1)]
public string Codec { get; set; }
@@ -40,6 +43,7 @@
}
}
[DefaultValue(2f)]
[Select(nameof(ChannelsOptions), 2)]
public float Channels { get; set; }
@@ -73,6 +77,7 @@
{
_BitrateOptions = new List<ListOption>
{
new ListOption { Label = "Automatic", Value = 0},
new ListOption { Label = "64 Kbps", Value = 64},
new ListOption { Label = "96 Kbps", Value = 96},
new ListOption { Label = "128 Kbps", Value = 128},
@@ -157,6 +162,14 @@
if (Channels == 0)
{
// same as source
if(Bitrate == 0)
{
return new[]
{
"-map", videoInfo.AudioStreams[0].IndexString,
"-c:a:" + index, Codec
};
}
return new[]
{
"-map", videoInfo.AudioStreams[0].IndexString,
@@ -166,6 +179,15 @@
}
else
{
if (Bitrate == 0)
{
return new[]
{
"-map", videoInfo.AudioStreams[0].IndexString,
"-c:a:" + index, Codec,
"-ac", Channels.ToString()
};
}
return new[]
{
"-map", videoInfo.AudioStreams[0].IndexString,