This commit is contained in:
Malte Rosenbjerg 2020-10-25 17:16:47 +01:00
parent cc42df3426
commit a7981f2886
2 changed files with 6 additions and 5 deletions

View file

@ -1,4 +1,5 @@
using System.IO; using System;
using System.IO;
using FFMpegCore.Enums; using FFMpegCore.Enums;
namespace FFMpegCore.Test.Resources namespace FFMpegCore.Test.Resources
@ -44,7 +45,7 @@ public static string OutputLocation(this FileInfo file, string type, string keyw
string originalLocation = file.Directory.FullName, string originalLocation = file.Directory.FullName,
outputFile = file.Name.Replace(file.Extension, keyword + "." + type.ToLowerInvariant()); outputFile = file.Name.Replace(file.Extension, keyword + "." + type.ToLowerInvariant());
return $"{originalLocation}{Path.DirectorySeparatorChar}{outputFile}"; return $"{originalLocation}{Path.DirectorySeparatorChar}{Guid.NewGuid()}_{outputFile}";
} }
} }
} }

View file

@ -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(3, video.Duration.TotalSeconds, 0.5); Assert.AreEqual(10, video.Duration.TotalSeconds, 0.5);
// Assert.AreEqual(1.25, video.Size); // Assert.AreEqual(1.25, video.Size);
} }
@ -580,7 +580,7 @@ public void Video_Duration()
{ {
FFMpegArguments FFMpegArguments
.FromFileInput(VideoLibrary.LocalVideo) .FromFileInput(VideoLibrary.LocalVideo)
.OutputToFile(output, false, opt => opt.WithDuration(TimeSpan.FromSeconds(video.Duration.TotalSeconds - 5))) .OutputToFile(output, false, opt => opt.WithDuration(TimeSpan.FromSeconds(video.Duration.TotalSeconds - 2)))
.ProcessSynchronously(); .ProcessSynchronously();
Assert.IsTrue(File.Exists(output)); Assert.IsTrue(File.Exists(output));
@ -589,7 +589,7 @@ public void Video_Duration()
Assert.AreEqual(video.Duration.Days, outputVideo.Duration.Days); Assert.AreEqual(video.Duration.Days, outputVideo.Duration.Days);
Assert.AreEqual(video.Duration.Hours, outputVideo.Duration.Hours); Assert.AreEqual(video.Duration.Hours, outputVideo.Duration.Hours);
Assert.AreEqual(video.Duration.Minutes, outputVideo.Duration.Minutes); Assert.AreEqual(video.Duration.Minutes, outputVideo.Duration.Minutes);
Assert.AreEqual(video.Duration.Seconds - 5, outputVideo.Duration.Seconds); Assert.AreEqual(video.Duration.Seconds - 2, outputVideo.Duration.Seconds);
} }
finally finally
{ {