From 502c4415e7c59ed2b30cf29c9669e78c08be81c9 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Mon, 7 Dec 2020 22:07:41 +0100 Subject: [PATCH 1/3] Increase timeout time --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1960fbf..a6fe6cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: os: [windows-latest, ubuntu-latest] - timeout-minutes: 4 + timeout-minutes: 6 steps: - name: Checkout uses: actions/checkout@v1 From fb2e1e00aa7dfb4cda07e17bd987e25e5eef99da Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Tue, 8 Dec 2020 23:27:25 +0100 Subject: [PATCH 2/3] Init --- FFMpegCore/FFMpeg/Exceptions/FFMpegException.cs | 8 +++++--- FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs | 9 ++++----- FFMpegCore/FFMpegCore.csproj | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/FFMpegCore/FFMpeg/Exceptions/FFMpegException.cs b/FFMpegCore/FFMpeg/Exceptions/FFMpegException.cs index 6bd608d..b094a02 100644 --- a/FFMpegCore/FFMpeg/Exceptions/FFMpegException.cs +++ b/FFMpegCore/FFMpeg/Exceptions/FFMpegException.cs @@ -14,14 +14,16 @@ public enum FFMpegExceptionType public class FFMpegException : Exception { - public FFMpegException(FFMpegExceptionType type, string? message = null, Exception? innerException = null, string ffMpegErrorOutput = "") + public FFMpegException(FFMpegExceptionType type, string? message = null, Exception? innerException = null, string ffmpegErrorOutput = "", string ffmpegOutput = "") : base(message, innerException) { - FFMpegErrorOutput = ffMpegErrorOutput; + FfmpegOutput = ffmpegOutput; + FfmpegErrorOutput = ffmpegErrorOutput; Type = type; } public FFMpegExceptionType Type { get; } - public string FFMpegErrorOutput { get; } + public string FfmpegOutput { get; } + public string FfmpegErrorOutput { get; } } } \ No newline at end of file diff --git a/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs b/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs index 8a30dfc..a1186d0 100644 --- a/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs +++ b/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs @@ -70,7 +70,7 @@ void OnCancelEvent(object sender, EventArgs args) } catch (Exception e) { - if (!HandleException(throwOnError, e, instance.ErrorData)) return false; + if (!HandleException(throwOnError, e, instance.ErrorData, instance.OutputData)) return false; } finally { @@ -116,7 +116,7 @@ await Task.WhenAll(instance.FinishedRunning().ContinueWith(t => } catch (Exception e) { - if (!HandleException(throwOnError, e, instance.ErrorData)) return false; + if (!HandleException(throwOnError, e, instance.ErrorData, instance.OutputData)) return false; } finally { @@ -140,13 +140,12 @@ private Instance PrepareInstance(out CancellationTokenSource cancellationTokenSo } - private static bool HandleException(bool throwOnError, Exception e, IReadOnlyList errorData) + private static bool HandleException(bool throwOnError, Exception e, IReadOnlyList errorData, IReadOnlyList outputData) { if (!throwOnError) return false; - throw new FFMpegException(FFMpegExceptionType.Process, "Exception thrown during processing", e, - string.Join("\n", errorData)); + throw new FFMpegException(FFMpegExceptionType.Process, "Exception thrown during processing", e, string.Join("\n", errorData), string.Join("\n", outputData)); } private void OutputData(object sender, (DataType Type, string Data) msg) diff --git a/FFMpegCore/FFMpegCore.csproj b/FFMpegCore/FFMpegCore.csproj index 2601529..09960a1 100644 --- a/FFMpegCore/FFMpegCore.csproj +++ b/FFMpegCore/FFMpegCore.csproj @@ -9,9 +9,9 @@ 3.0.0.0 3.0.0.0 3.0.0.0 - - Fix snapshot in memory dispose exception + - Include ffmpeg output data in exception 8 - 3.2.2 + 3.2.3 MIT Malte Rosenbjerg, Vlad Jerca ffmpeg ffprobe convert video audio mediafile resize analyze muxing From f648a4b234ad33c3ab68888dcfb0d64f63915a47 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Tue, 8 Dec 2020 23:30:10 +0100 Subject: [PATCH 3/3] Include ffprobe std output in exception --- FFMpegCore/FFProbe/FFProbe.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FFMpegCore/FFProbe/FFProbe.cs b/FFMpegCore/FFProbe/FFProbe.cs index 5c21b9b..076bbfd 100644 --- a/FFMpegCore/FFProbe/FFProbe.cs +++ b/FFMpegCore/FFProbe/FFProbe.cs @@ -46,7 +46,7 @@ public static IMediaAnalysis Analyse(Stream stream, int outputCapacity = int.Max } var exitCode = task.ConfigureAwait(false).GetAwaiter().GetResult(); if (exitCode != 0) - throw new FFMpegException(FFMpegExceptionType.Process, $"FFProbe process returned exit status {exitCode}: {string.Join("\n", instance.OutputData)} {string.Join("\n", instance.ErrorData)}"); + throw new FFMpegException(FFMpegExceptionType.Process, $"FFProbe process returned exit status {exitCode}", null, string.Join("\n", instance.ErrorData), string.Join("\n", instance.OutputData)); return ParseOutput(pipeArgument.PipePath, instance); } @@ -86,7 +86,7 @@ public static async Task AnalyseAsync(Stream stream, int outputC } var exitCode = await task; if (exitCode != 0) - throw new FFMpegException(FFMpegExceptionType.Process, $"FFProbe process returned exit status {exitCode}: {string.Join("\n", instance.OutputData)} {string.Join("\n", instance.ErrorData)}"); + throw new FFMpegException(FFMpegExceptionType.Process, $"FFProbe process returned exit status {exitCode}", null, string.Join("\n", instance.ErrorData), string.Join("\n", instance.OutputData)); pipeArgument.Post(); return ParseOutput(pipeArgument.PipePath, instance);