1+ using ScreenToGif . Domain . Enums ;
12using System ;
23using System . Collections . Generic ;
34using 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 \r Result:\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 \r Result:\n \r { error } " } ;
860+
859861 }
860862 catch ( Exception e )
861863 {
0 commit comments