From d97300a6f894a02f48d0991b59d56f7f49087cbc Mon Sep 17 00:00:00 2001 From: Marcos Cordeiro Date: Tue, 2 May 2023 23:29:38 -0300 Subject: [PATCH] Tweaks ffprobe arguments --- Wasari.Crunchyroll/CrunchyrollDownloadService.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Wasari.Crunchyroll/CrunchyrollDownloadService.cs b/Wasari.Crunchyroll/CrunchyrollDownloadService.cs index feea20e..e841b24 100644 --- a/Wasari.Crunchyroll/CrunchyrollDownloadService.cs +++ b/Wasari.Crunchyroll/CrunchyrollDownloadService.cs @@ -4,6 +4,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using FFMpegCore; +using FFMpegCore.Enums; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -103,14 +104,18 @@ private async IAsyncEnumerable ProcessEpisode(ApiEpisode ep { await episode.LoadStreams(crunchyrollApiService); - if (episode.ApiEpisodeStreams?.Streams == null || episode.ApiEpisodeStreams.Streams.Length <= 0) + if (episode.ApiEpisodeStreams?.Streams is not { Length: > 0 }) { Logger.LogWarning("Episode found with no stream options: {@Episode}", episode); yield break; } var stream = episode.ApiEpisodeStreams.Streams.Single(o => o.Type == "adaptive_hls" && string.IsNullOrEmpty(o.Locale)); - var mediaInfo = await FFProbe.AnalyseAsync(new Uri(stream.Url)); + var mediaInfo = await FFProbe.AnalyseAsync(new Uri(stream.Url), new FFOptions + { + LogLevel = FFMpegLogLevel.Error, + UseCache = false + }); var bestVideo = mediaInfo.VideoStreams.OrderBy(vStream => vStream.Height + vStream.Width).Last(); yield return new WasariEpisodeInputWithStream(stream.Url, episode.Locale, !episode.IsDubbed ? InputType.VideoWithAudio : InputType.Audio, mediaInfo.PrimaryAudioStream?.Index, !episode.IsDubbed ? bestVideo.Index : null);