mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-29 17:02:05 +13:00
Workaround for incorrect output_idx issue
This commit is contained in:
parent
f7a8d504ee
commit
4f4f983b9a
1 changed files with 10 additions and 8 deletions
|
@ -29,6 +29,7 @@ You should have received a copy of the GNU General Public License
|
|||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
@ -123,13 +124,14 @@ public string GetFFmpegArgs(bool isCustom = false)
|
|||
}
|
||||
else if (FFmpeg.VideoSource.Equals(FFmpegCLIManager.SourceDDAGrab, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Screen[] screens = Screen.AllScreens.OrderBy(x => !x.Primary).ToArray();
|
||||
int monitorIndex = 0;
|
||||
Rectangle captureArea = Screen.AllScreens[0].Bounds;
|
||||
Rectangle captureArea = screens[0].Bounds;
|
||||
int maxIntersectionArea = 0;
|
||||
|
||||
for (int i = 0; i < Screen.AllScreens.Length; i++)
|
||||
for (int i = 0; i < screens.Length; i++)
|
||||
{
|
||||
Screen screen = Screen.AllScreens[i];
|
||||
Screen screen = screens[i];
|
||||
Rectangle intersection = Rectangle.Intersect(screen.Bounds, CaptureArea);
|
||||
int intersectionArea = intersection.Width * intersection.Height;
|
||||
|
||||
|
@ -139,14 +141,14 @@ public string GetFFmpegArgs(bool isCustom = false)
|
|||
|
||||
monitorIndex = i;
|
||||
captureArea = new Rectangle(intersection.X - screen.Bounds.X, intersection.Y - screen.Bounds.Y, intersection.Width, intersection.Height);
|
||||
|
||||
if (FFmpeg.IsEvenSizeRequired)
|
||||
{
|
||||
captureArea = CaptureHelpers.EvenRectangleSize(captureArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (FFmpeg.IsEvenSizeRequired)
|
||||
{
|
||||
captureArea = CaptureHelpers.EvenRectangleSize(captureArea);
|
||||
}
|
||||
|
||||
// https://ffmpeg.org/ffmpeg-filters.html#ddagrab
|
||||
AppendInputDevice(args, "lavfi", FFmpeg.IsAudioSourceSelected);
|
||||
args.Append("-i ddagrab=");
|
||||
|
|
Loading…
Reference in a new issue