From 25c650f7fc612a65c7723bd8474fe142c5e54c5d Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 6 Dec 2020 01:15:16 +0100 Subject: [PATCH] Return clone to avoid problems with disposing original memorystream --- FFMpegCore/FFMpeg/FFMpeg.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FFMpegCore/FFMpeg/FFMpeg.cs b/FFMpegCore/FFMpeg/FFMpeg.cs index 602f03a..90c2265 100644 --- a/FFMpegCore/FFMpeg/FFMpeg.cs +++ b/FFMpegCore/FFMpeg/FFMpeg.cs @@ -69,7 +69,8 @@ public static Bitmap Snapshot(IMediaAnalysis source, Size? size = null, TimeSpan .ProcessSynchronously(); ms.Position = 0; - return new Bitmap(ms); + using var bitmap = new Bitmap(ms); + return bitmap.Clone(new Rectangle(0, 0, bitmap.Width, bitmap.Height), bitmap.PixelFormat); } /// /// Saves a 'png' thumbnail to an in-memory bitmap