mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-01-19 04:56:43 +00:00
Merge 72eddfca6d
into eb221c3e49
This commit is contained in:
commit
9eaaf6c1cc
4 changed files with 29 additions and 2 deletions
22
FFMpegCore/FFMpeg/Arguments/CropArgument.cs
Normal file
22
FFMpegCore/FFMpeg/Arguments/CropArgument.cs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace FFMpegCore.Arguments
|
||||||
|
{
|
||||||
|
public class CropArgument : IArgument
|
||||||
|
{
|
||||||
|
public readonly Size? Size;
|
||||||
|
public readonly int Top;
|
||||||
|
public readonly int Left;
|
||||||
|
|
||||||
|
public CropArgument(Size? size, int top, int left)
|
||||||
|
{
|
||||||
|
Size = size;
|
||||||
|
Top = top;
|
||||||
|
Left = left;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CropArgument(int width, int height, int top, int left) : this(new Size(width, height), top, left) { }
|
||||||
|
|
||||||
|
public string Text => Size == null ? string.Empty : $"-vf crop={Size.Value.Width}:{Size.Value.Height}:{Left}:{Top}";
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,8 @@ public static class AudioCodec
|
||||||
public static Codec Ac3 => FFMpeg.GetCodec("ac3");
|
public static Codec Ac3 => FFMpeg.GetCodec("ac3");
|
||||||
public static Codec Eac3 => FFMpeg.GetCodec("eac3");
|
public static Codec Eac3 => FFMpeg.GetCodec("eac3");
|
||||||
public static Codec LibMp3Lame => FFMpeg.GetCodec("libmp3lame");
|
public static Codec LibMp3Lame => FFMpeg.GetCodec("libmp3lame");
|
||||||
|
public static Codec Copy => new Codec("copy", CodecType.Audio);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class VideoType
|
public static class VideoType
|
||||||
|
|
|
@ -16,7 +16,10 @@ internal FFMpegArgumentOptions() { }
|
||||||
public FFMpegArgumentOptions WithVariableBitrate(int vbr) => WithArgument(new VariableBitRateArgument(vbr));
|
public FFMpegArgumentOptions WithVariableBitrate(int vbr) => WithArgument(new VariableBitRateArgument(vbr));
|
||||||
public FFMpegArgumentOptions Resize(int width, int height) => WithArgument(new SizeArgument(width, height));
|
public FFMpegArgumentOptions Resize(int width, int height) => WithArgument(new SizeArgument(width, height));
|
||||||
public FFMpegArgumentOptions Resize(Size? size) => WithArgument(new SizeArgument(size));
|
public FFMpegArgumentOptions Resize(Size? size) => WithArgument(new SizeArgument(size));
|
||||||
|
public FFMpegArgumentOptions Crop(Size? size, int left, int top) => WithArgument(new CropArgument(size, top, left));
|
||||||
|
public FFMpegArgumentOptions Crop(int width, int height, int left, int top) => WithArgument(new CropArgument(new Size(width, height), top, left));
|
||||||
|
public FFMpegArgumentOptions Crop(Size? size) => WithArgument(new CropArgument(size, 0, 0));
|
||||||
|
public FFMpegArgumentOptions Crop(int width, int height) => WithArgument(new CropArgument(new Size(width, height), 0, 0));
|
||||||
public FFMpegArgumentOptions WithBitStreamFilter(Channel channel, Filter filter) => WithArgument(new BitStreamFilterArgument(channel, filter));
|
public FFMpegArgumentOptions WithBitStreamFilter(Channel channel, Filter filter) => WithArgument(new BitStreamFilterArgument(channel, filter));
|
||||||
public FFMpegArgumentOptions WithConstantRateFactor(int crf) => WithArgument(new ConstantRateFactorArgument(crf));
|
public FFMpegArgumentOptions WithConstantRateFactor(int crf) => WithArgument(new ConstantRateFactorArgument(crf));
|
||||||
public FFMpegArgumentOptions CopyChannel(Channel channel = Channel.Both) => WithArgument(new CopyArgument(channel));
|
public FFMpegArgumentOptions CopyChannel(Channel channel = Channel.Both) => WithArgument(new CopyArgument(channel));
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Instances" Version="3.0.0" />
|
<PackageReference Include="Instances" Version="3.0.0" />
|
||||||
<PackageReference Include="System.Text.Json" Version="7.0.3" />
|
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Reference in a new issue