mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Added blackdetect and blackframe arguments
Former-commit-id: 7f72625eac
This commit is contained in:
parent
46d7f81516
commit
f042d78f2c
3 changed files with 30 additions and 0 deletions
14
FFMpegCore/FFMpeg/Arguments/BlackDetectArgument.cs
Normal file
14
FFMpegCore/FFMpeg/Arguments/BlackDetectArgument.cs
Normal 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}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
FFMpegCore/FFMpeg/Arguments/BlackFrameArgument.cs
Normal file
14
FFMpegCore/FFMpeg/Arguments/BlackFrameArgument.cs
Normal 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}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue