public async Task CheckFFprobeWrapperStream() { #region Prepare FFprobe var ffmpegPath = "ffmpeg"; await this.DownloadFfprobeAsync(ffmpegPath); var files = Directory.GetFiles(ffmpegPath, "ffprobe.exe", SearchOption.AllDirectories); var ffprobePath = files.FirstOrDefault(); if (string.IsNullOrEmpty(ffprobePath)) { Assert.Fail("Cannot found ffprobe"); } #endregion var testVideoPath = await this.GetTestVideoPathAsync(); var videoData = await File.ReadAllBytesAsync(testVideoPath); var videoAnalyzer = new VideoAnalyzer(ffprobePath); var anazlyeResult = videoAnalyzer.GetVideoInfo(videoData); Assert.IsTrue(anazlyeResult.Successful, $"Get VideoInfo is not successful {anazlyeResult.ErrorMessage}"); Assert.AreEqual(120, anazlyeResult.VideoInfo.Format.Duration); }
public async Task CheckFFprobeWrapper() { #region Prepare FFprobe var ffmpegPackageUrl = "https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.1.3-win64-static.zip"; var ffmpegZipFilePath = "ffmpeg.zip"; var ffmpegPath = "ffmpeg"; if (!await this.DownloadFileAsync(ffmpegPackageUrl, ffmpegZipFilePath)) { Assert.Fail("Cannot download ffmpeg package"); } ZipFile.ExtractToDirectory(ffmpegZipFilePath, ffmpegPath, overwriteFiles: true); var files = Directory.GetFiles(ffmpegPath, "ffprobe.exe", SearchOption.AllDirectories); var ffprobePath = files.FirstOrDefault(); if (ffprobePath == null) { Assert.Fail("Cannot found ffprobe"); } #endregion #region Prepare Video var testVideoZipFilePath = "TestVideos.zip"; var testVideosPath = "TestVideos"; await this.DownloadFileAsync("https://skimovies.s3-eu-west-1.amazonaws.com/VideoPostProcessing/TestVideos.zip", testVideoZipFilePath); ZipFile.ExtractToDirectory(testVideoZipFilePath, testVideosPath, overwriteFiles: true); files = Directory.GetFiles(testVideosPath, "video1.mp4", SearchOption.AllDirectories); var videoPath = files.FirstOrDefault(); #endregion var videoAnalyzer = new VideoAnalyzer(ffprobePath); var anazlyeResult = videoAnalyzer.GetVideoInfo(videoPath); Assert.IsTrue(anazlyeResult.Successful); Assert.AreEqual(120, anazlyeResult.VideoInfo.Format.Duration); }