added max bitrate node

This commit is contained in:
John Andrews
2022-07-09 23:30:04 +12:00
parent 8b0761905e
commit 97bd00a258
4 changed files with 53 additions and 49 deletions

View File

@@ -10,6 +10,7 @@ public class Discord: Node
public override FlowElementType Type => FlowElementType.Communication;
public override string Icon => "fab fa-discord";
public override bool FailureNode => true;
public override string HelpUrl => "https://docs.fileflows.com/plugins/discord/discord";
[Required]
[TextVariable(1)]

View File

@@ -0,0 +1,40 @@
namespace FileFlows.VideoNodes.FfmpegBuilderNodes;
/// <summary>
/// Node that limits the bitrate for video
/// </summary>
public class FfmpegBuilderVideoMaxBitrate : FfmpegBuilderNode
{
public override string HelpUrl => "https://docs.fileflows.com/plugins/video-nodes/ffmpeg-builder/video-max-bitrate";
/// <summary>
/// Gets or sets the maximum bitrate in K
/// </summary>
[NumberInt(1)]
[DefaultValue(10_000)]
public float Bitrate { get; set; }
public override int Execute(NodeParameters args)
{
var video = Model.VideoStreams?.Where(x => x.Deleted == false)?.FirstOrDefault();
if (video?.Stream == null)
{
args.Logger?.ELog("No video stream found");
return -1;
}
if(Bitrate < 0)
{
args.Logger?.ELog("Minimum bitrate not set");
return -1;
}
video.AdditionalParameters.AddRange(new[]
{
"-b:v:{index}",
"-maxrate", Bitrate + "k"
});
return 1;
}
}

View File

@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-16"?><Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishSingleFile>true</PublishSingleFile>
<FileVersion>0.8.4.152</FileVersion>
<ProductVersion>0.8.4.152</ProductVersion>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>
<Authors>John Andrews</Authors>
<Product>Video Nodes</Product>
<PackageProjectUrl>https://fileflows.com/</PackageProjectUrl>
<Description>Nodes for processing video files. This plugin contains nodes to convert video files to different formats. Node to parse the video information from a file.</Description>
<RootNamespace> FileFlows.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;CS8618;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS8765;CS8767;</NoWarn>
<WarningLevel>0</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NoWarn>1701;1702;CS8618;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS8765;CS8767;</NoWarn>
<WarningLevel>0</WarningLevel>
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
</ItemGroup>
<ItemGroup>
<Content Include="VideoNodes.en.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Reference Include="Plugin">
<HintPath>..\FileFlows.Plugin.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup>
</Project>

View File

@@ -369,6 +369,18 @@
"Percent-Help": "When selected the bitrate will be calculated as a percentage of the current bitrate."
}
},
"FfmpegBuilderVideoMaxBitrate": {
"Label": "FFMPEG Builder: Video Max Bitrate",
"Description": "Sets FFMPEG Builder limit the bitrate of video",
"Outputs": {
"1": "FFMPEG Builder video streams updated"
},
"Fields": {
"Bitrate": "Maximum Bitrate",
"Bitrate-Suffix": "KB",
"Bitrate-Help": "The maximum bitrate of the video in kilobytes"
}
},
"FfmpegBuilderVideoCodec": {
"Label": "FFMPEG Builder: Video Codec",
"Description": "Sets FFMPEG Builder to encode the video streams in the specified codec",