diff --git a/FFMpegCore/FFMpeg/Enums/FileExtension.cs b/FFMpegCore/FFMpeg/Enums/FileExtension.cs index d2e4a63..58a8ff3 100644 --- a/FFMpegCore/FFMpeg/Enums/FileExtension.cs +++ b/FFMpegCore/FFMpeg/Enums/FileExtension.cs @@ -18,7 +18,7 @@ public static string Extension(this Codec type) } public static readonly string Mp4 = ".mp4"; public static readonly string Mp3 = ".mp3"; - public static readonly string Ts = ".ts"; + public static readonly string Ts = ".mpegts"; public static readonly string Ogv = ".ogv"; public static readonly string Png = ".png"; public static readonly string WebM = ".webm"; diff --git a/FFMpegCore/FFMpeg/FFMpeg.cs b/FFMpegCore/FFMpeg/FFMpeg.cs index 8bcdc1f..e2fcfde 100644 --- a/FFMpegCore/FFMpeg/FFMpeg.cs +++ b/FFMpegCore/FFMpeg/FFMpeg.cs @@ -1,13 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Linq; -using FFMpegCore.Enums; +using FFMpegCore.Enums; using FFMpegCore.Exceptions; using FFMpegCore.Helpers; using FFMpegCore.Pipes; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; namespace FFMpegCore { @@ -76,18 +75,18 @@ 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 = (double)size.Value.Height / source.PrimaryVideoStream.Height; - size = new Size((int) (source.PrimaryVideoStream.Width * ratio), - (int) (source.PrimaryVideoStream.Height * ratio)); + size = new Size((int)(source.PrimaryVideoStream.Width * ratio), + (int)(source.PrimaryVideoStream.Height * ratio)); } if (size.Value.Height == 0) { - var ratio = source.PrimaryVideoStream.Height / (double) size.Value.Height; + var ratio = (double)size.Value.Width / source.PrimaryVideoStream.Width; - size = new Size((int) (source.PrimaryVideoStream.Width * ratio), - (int) (source.PrimaryVideoStream.Height * ratio)); + size = new Size((int)(source.PrimaryVideoStream.Width * ratio), + (int)(source.PrimaryVideoStream.Height * ratio)); } }