Added blackdetect and blackframe arguments

Former-commit-id: 7f72625eac
This commit is contained in:
Thodoris Koskinopoulos 2022-11-27 05:54:29 +02:00 committed by Malte Rosenbjerg
parent 46d7f81516
commit f042d78f2c
3 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,14 @@
namespace FFMpegCore.Arguments
{
public class BlackDetectArgument : IVideoFilterArgument
{
public string Key => "blackdetect";
public string Value { get; }
public BlackDetectArgument(double minimumDuration = 2.0, double pictureBlackRatioThreshold = 0.98, double pixelBlackThreshold = 0.1)
{
Value = $"d={minimumDuration}:pic_th={pictureBlackRatioThreshold}:pix_th={pixelBlackThreshold}";
}
}
}

View file

@ -0,0 +1,14 @@
namespace FFMpegCore.Arguments
{
internal class BlackFrameArgument : IVideoFilterArgument
{
public string Key => "blackframe";
public string Value { get; }
public BlackFrameArgument(int amount = 98, int threshold = 32)
{
Value = $"amount={amount}:threshold={threshold}";
}
}
}

View file

@ -51,6 +51,8 @@ public class VideoFilterOptions
public VideoFilterOptions Mirror(Mirroring mirroring) => WithArgument(new SetMirroringArgument(mirroring)); public VideoFilterOptions Mirror(Mirroring mirroring) => WithArgument(new SetMirroringArgument(mirroring));
public VideoFilterOptions DrawText(DrawTextOptions drawTextOptions) => WithArgument(new DrawTextArgument(drawTextOptions)); public VideoFilterOptions DrawText(DrawTextOptions drawTextOptions) => WithArgument(new DrawTextArgument(drawTextOptions));
public VideoFilterOptions HardBurnSubtitle(SubtitleHardBurnOptions subtitleHardBurnOptions) => WithArgument(new SubtitleHardBurnArgument(subtitleHardBurnOptions)); public VideoFilterOptions HardBurnSubtitle(SubtitleHardBurnOptions subtitleHardBurnOptions) => WithArgument(new SubtitleHardBurnArgument(subtitleHardBurnOptions));
public VideoFilterOptions BlackDetect(double minimumDuration = 2.0, double pictureBlackRatioThreshold = 0.98, double pixelBlackThreshold = 0.1) => WithArgument(new BlackDetectArgument(minimumDuration, pictureBlackRatioThreshold, pixelBlackThreshold));
public VideoFilterOptions BlackFrame(int amount = 98, int threshold = 32) => WithArgument(new BlackFrameArgument(amount, threshold));
private VideoFilterOptions WithArgument(IVideoFilterArgument argument) private VideoFilterOptions WithArgument(IVideoFilterArgument argument)
{ {