mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
parent
daaf304a34
commit
4f9b4f4b57
12 changed files with 23 additions and 11 deletions
|
@ -15,6 +15,18 @@
|
||||||
<None Update="Resources\input.webm">
|
<None Update="Resources\input.webm">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="Resources\input_3sec.mp4">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="Resources\input_3sec.webm">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="Resources\input_audio_only_10sec.mp4">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="Resources\input_video_only_3sec.mp4">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -18,7 +18,7 @@ public void Probe_TooLongOutput()
|
||||||
public void Probe_Success()
|
public void Probe_Success()
|
||||||
{
|
{
|
||||||
var info = FFProbe.Analyse(VideoLibrary.LocalVideo.FullName);
|
var info = FFProbe.Analyse(VideoLibrary.LocalVideo.FullName);
|
||||||
Assert.AreEqual(13, info.Duration.Seconds);
|
Assert.AreEqual(3, info.Duration.Seconds);
|
||||||
Assert.AreEqual(".mp4", info.Extension);
|
Assert.AreEqual(".mp4", info.Extension);
|
||||||
Assert.AreEqual(VideoLibrary.LocalVideo.FullName, info.Path);
|
Assert.AreEqual(VideoLibrary.LocalVideo.FullName, info.Path);
|
||||||
|
|
||||||
|
@ -27,10 +27,10 @@ public void Probe_Success()
|
||||||
Assert.AreEqual("AAC (Advanced Audio Coding)", info.PrimaryAudioStream.CodecLongName);
|
Assert.AreEqual("AAC (Advanced Audio Coding)", info.PrimaryAudioStream.CodecLongName);
|
||||||
Assert.AreEqual("aac", info.PrimaryAudioStream.CodecName);
|
Assert.AreEqual("aac", info.PrimaryAudioStream.CodecName);
|
||||||
Assert.AreEqual("LC", info.PrimaryAudioStream.Profile);
|
Assert.AreEqual("LC", info.PrimaryAudioStream.Profile);
|
||||||
Assert.AreEqual(381988, info.PrimaryAudioStream.BitRate);
|
Assert.AreEqual(377351, info.PrimaryAudioStream.BitRate);
|
||||||
Assert.AreEqual(48000, info.PrimaryAudioStream.SampleRateHz);
|
Assert.AreEqual(48000, info.PrimaryAudioStream.SampleRateHz);
|
||||||
|
|
||||||
Assert.AreEqual(862991, info.PrimaryVideoStream.BitRate);
|
Assert.AreEqual(1471810, info.PrimaryVideoStream.BitRate);
|
||||||
Assert.AreEqual(16, info.PrimaryVideoStream.DisplayAspectRatio.Width);
|
Assert.AreEqual(16, info.PrimaryVideoStream.DisplayAspectRatio.Width);
|
||||||
Assert.AreEqual(9, info.PrimaryVideoStream.DisplayAspectRatio.Height);
|
Assert.AreEqual(9, info.PrimaryVideoStream.DisplayAspectRatio.Height);
|
||||||
Assert.AreEqual("yuv420p", info.PrimaryVideoStream.PixelFormat);
|
Assert.AreEqual("yuv420p", info.PrimaryVideoStream.PixelFormat);
|
||||||
|
@ -48,7 +48,7 @@ public void Probe_Success()
|
||||||
public async Task Probe_Async_Success()
|
public async Task Probe_Async_Success()
|
||||||
{
|
{
|
||||||
var info = await FFProbe.AnalyseAsync(VideoLibrary.LocalVideo.FullName);
|
var info = await FFProbe.AnalyseAsync(VideoLibrary.LocalVideo.FullName);
|
||||||
Assert.AreEqual(13, info.Duration.Seconds);
|
Assert.AreEqual(3, info.Duration.Seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod, Timeout(10000)]
|
[TestMethod, Timeout(10000)]
|
||||||
|
@ -56,7 +56,7 @@ public void Probe_Success_FromStream()
|
||||||
{
|
{
|
||||||
using var stream = File.OpenRead(VideoLibrary.LocalVideoWebm.FullName);
|
using var stream = File.OpenRead(VideoLibrary.LocalVideoWebm.FullName);
|
||||||
var info = FFProbe.Analyse(stream);
|
var info = FFProbe.Analyse(stream);
|
||||||
Assert.AreEqual(10, info.Duration.Seconds);
|
Assert.AreEqual(3, info.Duration.Seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
@ -64,7 +64,7 @@ public async Task Probe_Success_FromStream_Async()
|
||||||
{
|
{
|
||||||
await using var stream = File.OpenRead(VideoLibrary.LocalVideoWebm.FullName);
|
await using var stream = File.OpenRead(VideoLibrary.LocalVideoWebm.FullName);
|
||||||
var info = await FFProbe.AnalyseAsync(stream);
|
var info = await FFProbe.AnalyseAsync(stream);
|
||||||
Assert.AreEqual(10, info.Duration.Seconds);
|
Assert.AreEqual(3, info.Duration.Seconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,10 +15,10 @@ public enum ImageType
|
||||||
|
|
||||||
public static class VideoLibrary
|
public static class VideoLibrary
|
||||||
{
|
{
|
||||||
public static readonly FileInfo LocalVideo = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}input.mp4");
|
public static readonly FileInfo LocalVideo = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}input_3sec.mp4");
|
||||||
public static readonly FileInfo LocalVideoWebm = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}input.webm");
|
public static readonly FileInfo LocalVideoWebm = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}input_3sec.webm");
|
||||||
public static readonly FileInfo LocalVideoAudioOnly = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}audio_only.mp4");
|
public static readonly FileInfo LocalVideoAudioOnly = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}input_audio_only_10sec.mp4");
|
||||||
public static readonly FileInfo LocalVideoNoAudio = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}mute.mp4");
|
public static readonly FileInfo LocalVideoNoAudio = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}input_video_only_3sec.mp4");
|
||||||
public static readonly FileInfo LocalAudio = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}audio.mp3");
|
public static readonly FileInfo LocalAudio = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}audio.mp3");
|
||||||
public static readonly FileInfo LocalCover = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}cover.png");
|
public static readonly FileInfo LocalCover = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}cover.png");
|
||||||
public static readonly FileInfo ImageDirectory = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}images");
|
public static readonly FileInfo ImageDirectory = new FileInfo($".{Path.DirectorySeparatorChar}Resources{Path.DirectorySeparatorChar}images");
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
FFMpegCore.Test/Resources/input_3sec.mp4
Normal file
BIN
FFMpegCore.Test/Resources/input_3sec.mp4
Normal file
Binary file not shown.
BIN
FFMpegCore.Test/Resources/input_3sec.webm
Normal file
BIN
FFMpegCore.Test/Resources/input_3sec.webm
Normal file
Binary file not shown.
BIN
FFMpegCore.Test/Resources/input_audio_only_10sec.mp4
Normal file
BIN
FFMpegCore.Test/Resources/input_audio_only_10sec.mp4
Normal file
Binary file not shown.
BIN
FFMpegCore.Test/Resources/input_video_only_3sec.mp4
Normal file
BIN
FFMpegCore.Test/Resources/input_video_only_3sec.mp4
Normal file
Binary file not shown.
Binary file not shown.
|
@ -566,7 +566,7 @@ public void Video_With_Only_Audio_Should_Extract_Metadata()
|
||||||
var video = FFProbe.Analyse(VideoLibrary.LocalVideoAudioOnly.FullName);
|
var video = FFProbe.Analyse(VideoLibrary.LocalVideoAudioOnly.FullName);
|
||||||
Assert.AreEqual(null, video.PrimaryVideoStream);
|
Assert.AreEqual(null, video.PrimaryVideoStream);
|
||||||
Assert.AreEqual("aac", video.PrimaryAudioStream.CodecName);
|
Assert.AreEqual("aac", video.PrimaryAudioStream.CodecName);
|
||||||
Assert.AreEqual(79.5, video.Duration.TotalSeconds, 0.5);
|
Assert.AreEqual(3, video.Duration.TotalSeconds, 0.5);
|
||||||
// Assert.AreEqual(1.25, video.Size);
|
// Assert.AreEqual(1.25, video.Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue