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 CheckFFprobeWrapperFile() { var fileDownloader = new FileDownloader(); var downloadResult = await fileDownloader.DownloadAsync("ffmpeg"); var testVideoPath = await this.GetTestVideoPathAsync(); var videoAnalyzer = new VideoAnalyzer(downloadResult.FfprobePath); var analyzeResult = await videoAnalyzer.GetVideoInfoAsync(testVideoPath); Assert.IsTrue(analyzeResult.Successful, "Get VideoInfo is not successful"); Assert.AreEqual(120, analyzeResult.VideoInfo.Format.Duration); }
public async Task CheckFFprobeWrapperStream() { var fileDownloader = new FileDownloader(); var downloadResult = await fileDownloader.DownloadAsync("ffmpeg"); var testVideoPath = await this.GetTestVideoPathAsync(); var videoData = await File.ReadAllBytesAsync(testVideoPath); var videoAnalyzer = new VideoAnalyzer(downloadResult.FfprobePath); var analyzeResult = await videoAnalyzer.GetVideoInfoAsync(videoData); Assert.IsTrue(analyzeResult.Successful, $"Get VideoInfo is not successful {analyzeResult.ErrorMessage}"); Assert.AreEqual(120, analyzeResult.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); }
public async Task GetVideoInfo_HTTPVideoURL_IsNotValid() { VideoAnalyzer videoAnalyzer = new VideoAnalyzer(); Assert.AreEqual(videoAnalyzer.IsValidURL("ftp://www.sample-videos.com/video123/mp4/240/big_buck_bunny_240p_1mb.mp4"), false); }
public VideoAnalyzer_Test() { videoAnalyzer = new VideoAnalyzer(); }