From 74593461d4cc928ce8474404980c4f7116daba0d Mon Sep 17 00:00:00 2001 From: jianxingwu Date: Fri, 15 May 2020 16:58:56 +0800 Subject: [PATCH] PrepareSnapshotSize error : ratio=source.PrimaryVideoStream.Width / 0 ratio=source.PrimaryVideoStream.Height / 0 --- FFMpegCore/FFMpeg/FFMpeg.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FFMpegCore/FFMpeg/FFMpeg.cs b/FFMpegCore/FFMpeg/FFMpeg.cs index 8bcdc1f..c9bf3ac 100644 --- a/FFMpegCore/FFMpeg/FFMpeg.cs +++ b/FFMpegCore/FFMpeg/FFMpeg.cs @@ -76,7 +76,7 @@ public static Bitmap Snapshot(MediaAnalysis source, Size? size = null, TimeSpan? { if (size.Value.Width == 0) { - var ratio = source.PrimaryVideoStream.Width / (double) size.Value.Width; + var ratio = source.PrimaryVideoStream.Height / (double) size.Value.Height; size = new Size((int) (source.PrimaryVideoStream.Width * ratio), (int) (source.PrimaryVideoStream.Height * ratio)); @@ -84,7 +84,7 @@ public static Bitmap Snapshot(MediaAnalysis source, Size? size = null, TimeSpan? if (size.Value.Height == 0) { - var ratio = source.PrimaryVideoStream.Height / (double) size.Value.Height; + var ratio = source.PrimaryVideoStream.Width / (double) size.Value.Width; size = new Size((int) (source.PrimaryVideoStream.Width * ratio), (int) (source.PrimaryVideoStream.Height * ratio));