add crop scaling behavior (#1443)

* add scaling behavior - crop

* fix ffmpeg version check on windows (snapshot)

* update dependencies
This commit is contained in:
Jason Dove
2023-09-22 08:23:49 -05:00
committed by GitHub
parent 694b6bbd91
commit 58fae1b0cc
23 changed files with 172 additions and 21 deletions
@@ -313,10 +313,22 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService
channel.FFmpegProfile.Resolution.Width,
channel.FFmpegProfile.Resolution.Height);
Option<FrameSize> cropSize = Option<FrameSize>.None;
if (channel.FFmpegProfile.ScalingBehavior is ScalingBehavior.Stretch)
{
scaledSize = paddedSize;
}
if (channel.FFmpegProfile.ScalingBehavior is ScalingBehavior.Crop)
{
paddedSize = ffmpegVideoStream.SquarePixelFrameSizeForCrop(
new FrameSize(channel.FFmpegProfile.Resolution.Width, channel.FFmpegProfile.Resolution.Height));
cropSize = new FrameSize(
channel.FFmpegProfile.Resolution.Width,
channel.FFmpegProfile.Resolution.Height);
}
var desiredState = new FrameState(
playbackSettings.RealtimeOutput,
@@ -326,6 +338,7 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService
Optional(playbackSettings.PixelFormat),
scaledSize,
paddedSize,
cropSize,
false,
playbackSettings.FrameRate,
playbackSettings.VideoBitrate,
@@ -429,6 +442,7 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService
new PixelFormatYuv420P(),
new FrameSize(desiredResolution.Width, desiredResolution.Height),
new FrameSize(desiredResolution.Width, desiredResolution.Height),
Option<FrameSize>.None,
false,
playbackSettings.FrameRate,
playbackSettings.VideoBitrate,