mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Merge pull request #62 from 3400442579/master
Snapshot ,Join
Former-commit-id: 7faeda3094
This commit is contained in:
commit
d948867396
2 changed files with 13 additions and 14 deletions
|
@ -18,7 +18,7 @@ public static string Extension(this Codec type)
|
||||||
}
|
}
|
||||||
public static readonly string Mp4 = ".mp4";
|
public static readonly string Mp4 = ".mp4";
|
||||||
public static readonly string Mp3 = ".mp3";
|
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 Ogv = ".ogv";
|
||||||
public static readonly string Png = ".png";
|
public static readonly string Png = ".png";
|
||||||
public static readonly string WebM = ".webm";
|
public static readonly string WebM = ".webm";
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
using System;
|
using FFMpegCore.Enums;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using FFMpegCore.Enums;
|
|
||||||
using FFMpegCore.Exceptions;
|
using FFMpegCore.Exceptions;
|
||||||
using FFMpegCore.Helpers;
|
using FFMpegCore.Helpers;
|
||||||
using FFMpegCore.Pipes;
|
using FFMpegCore.Pipes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace FFMpegCore
|
namespace FFMpegCore
|
||||||
{
|
{
|
||||||
|
@ -76,18 +75,18 @@ public static Bitmap Snapshot(MediaAnalysis source, Size? size = null, TimeSpan?
|
||||||
{
|
{
|
||||||
if (size.Value.Width == 0)
|
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),
|
size = new Size((int)(source.PrimaryVideoStream.Width * ratio),
|
||||||
(int) (source.PrimaryVideoStream.Height * ratio));
|
(int)(source.PrimaryVideoStream.Height * ratio));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size.Value.Height == 0)
|
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),
|
size = new Size((int)(source.PrimaryVideoStream.Width * ratio),
|
||||||
(int) (source.PrimaryVideoStream.Height * ratio));
|
(int)(source.PrimaryVideoStream.Height * ratio));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue