Skip to content

Commit 2220b54

Browse files
committed
Fixed import with FFmpeg and also fixed detection of FFmpeg/Gifski in settings window
1 parent b3c5ab9 commit 2220b54

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

ScreenToGif/Windows/Options.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ private void CheckTools(bool ffmpeg = true, bool gifski = true)
16811681
{
16821682
#region FFmpeg
16831683

1684-
if (Util.Other.IsFfmpegPresent(true, true))
1684+
if (Util.Other.IsFfmpegPresent(true, false))
16851685
{
16861686
var info = new FileInfo(Util.Other.AdjustPath(UserSettings.All.FfmpegLocation));
16871687
info.Refresh();
@@ -1702,7 +1702,7 @@ private void CheckTools(bool ffmpeg = true, bool gifski = true)
17021702
{
17031703
#region Gifski
17041704

1705-
if (Util.Other.IsGifskiPresent(true, true))
1705+
if (Util.Other.IsGifskiPresent(true, false))
17061706
{
17071707
var info = new FileInfo(Util.Other.AdjustPath(UserSettings.All.GifskiLocation));
17081708
info.Refresh();

ScreenToGif/Windows/Other/VideoSource.xaml.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using ScreenToGif.Domain.Enums;
12
using System;
23
using System.Collections.Generic;
34
using System.Diagnostics;
@@ -817,11 +818,12 @@ private async Task GetMultipleScreencaps()
817818

818819
var info = new ProcessStartInfo(UserSettings.All.FfmpegLocation)
819820
{
820-
Arguments = $" -i \"{VideoPath}\" -vsync 2 -progress pipe:1 -vf scale={VideoWidth}:{VideoHeight} -ss {start:hh\\:mm\\:ss\\.fff} -to {end:hh\\:mm\\:ss\\.fff} -hide_banner -c:v png -r {fps} -vframes {count} \"{path}\"",
821+
Arguments = $" -i \"{VideoPath}\" -progress pipe:1 -vf scale={VideoWidth}:{VideoHeight} -ss {start:hh\\:mm\\:ss\\.fff} -to {end:hh\\:mm\\:ss\\.fff} -hide_banner -c:v png -r {fps} -vframes {count} \"{path}\"",
821822
CreateNoWindow = true,
822823
ErrorDialog = false,
823824
UseShellExecute = false,
824-
RedirectStandardOutput = true
825+
RedirectStandardOutput = true,
826+
RedirectStandardError = true
825827
};
826828

827829
_process = new Process();
@@ -844,18 +846,18 @@ private async Task GetMultipleScreencaps()
844846
break;
845847
}
846848
};
847-
848-
_process.ErrorDataReceived += (sender, e) =>
849-
{
850-
if (!string.IsNullOrEmpty(e.Data))
851-
throw new Exception("Error while capturing frames with FFmpeg.") { HelpLink = $"Command:\n\r{info.Arguments}\n\rResult:\n\r{e.Data}" };
852-
};
853-
849+
854850
_process.StartInfo = info;
855851
_process.Start();
856852
_process.BeginOutputReadLine();
857-
853+
858854
await _process.WaitForExitAsync();
855+
856+
var error = await _process?.StandardError?.ReadToEndAsync();
857+
858+
if (!string.IsNullOrWhiteSpace(error))
859+
throw new Exception("Error while capturing frames with FFmpeg.") { HelpLink = $"Command:\n\r{info.Arguments}\n\rResult:\n\r{error}" };
860+
859861
}
860862
catch (Exception e)
861863
{

0 commit comments

Comments
 (0)