mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +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.Drawing;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
@ -123,13 +124,14 @@ public string GetFFmpegArgs(bool isCustom = false)
|
||||||
}
|
}
|
||||||
else if (FFmpeg.VideoSource.Equals(FFmpegCLIManager.SourceDDAGrab, StringComparison.OrdinalIgnoreCase))
|
else if (FFmpeg.VideoSource.Equals(FFmpegCLIManager.SourceDDAGrab, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
Screen[] screens = Screen.AllScreens.OrderBy(x => !x.Primary).ToArray();
|
||||||
int monitorIndex = 0;
|
int monitorIndex = 0;
|
||||||
Rectangle captureArea = Screen.AllScreens[0].Bounds;
|
Rectangle captureArea = screens[0].Bounds;
|
||||||
int maxIntersectionArea = 0;
|
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);
|
Rectangle intersection = Rectangle.Intersect(screen.Bounds, CaptureArea);
|
||||||
int intersectionArea = intersection.Width * intersection.Height;
|
int intersectionArea = intersection.Width * intersection.Height;
|
||||||
|
|
||||||
|
@ -139,13 +141,13 @@ public string GetFFmpegArgs(bool isCustom = false)
|
||||||
|
|
||||||
monitorIndex = i;
|
monitorIndex = i;
|
||||||
captureArea = new Rectangle(intersection.X - screen.Bounds.X, intersection.Y - screen.Bounds.Y, intersection.Width, intersection.Height);
|
captureArea = new Rectangle(intersection.X - screen.Bounds.X, intersection.Y - screen.Bounds.Y, intersection.Width, intersection.Height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (FFmpeg.IsEvenSizeRequired)
|
if (FFmpeg.IsEvenSizeRequired)
|
||||||
{
|
{
|
||||||
captureArea = CaptureHelpers.EvenRectangleSize(captureArea);
|
captureArea = CaptureHelpers.EvenRectangleSize(captureArea);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://ffmpeg.org/ffmpeg-filters.html#ddagrab
|
// https://ffmpeg.org/ffmpeg-filters.html#ddagrab
|
||||||
AppendInputDevice(args, "lavfi", FFmpeg.IsAudioSourceSelected);
|
AppendInputDevice(args, "lavfi", FFmpeg.IsAudioSourceSelected);
|
||||||
|
|
Loading…
Reference in a new issue