From 31b93b3ed64a3505b54451ea93dcd8b1e315eede Mon Sep 17 00:00:00 2001 From: jeroenvanderschoot Date: Sun, 13 Nov 2022 08:41:30 +0100 Subject: [PATCH] Add Uri support for Frame Analysis, skipped Stream support as this cannot support MP4's with moov atom in the end of the file, and input pipes do not support seek. --- FFMpegCore/FFProbe/FFProbe.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/FFMpegCore/FFProbe/FFProbe.cs b/FFMpegCore/FFProbe/FFProbe.cs index 21cf3af..83c0135 100644 --- a/FFMpegCore/FFProbe/FFProbe.cs +++ b/FFMpegCore/FFProbe/FFProbe.cs @@ -89,6 +89,15 @@ public static async Task AnalyseAsync(string filePath, FFOptions return ParseOutput(result); } + public static FFProbeFrames GetFrames(Uri uri, FFOptions? ffOptions = null) + { + var instance = PrepareFrameAnalysisInstance(uri.AbsoluteUri, ffOptions ?? GlobalFFOptions.Current); + var result = instance.StartAndWaitForExit(); + ThrowIfExitCodeNotZero(result); + + return ParseFramesOutput(result); + } + public static async Task GetFramesAsync(string filePath, FFOptions? ffOptions = null, CancellationToken cancellationToken = default) { ThrowIfInputFileDoesNotExist(filePath); @@ -141,6 +150,13 @@ public static async Task AnalyseAsync(Stream stream, FFOptions? return ParseOutput(result); } + public static async Task GetFramesAsync(Uri uri, FFOptions? ffOptions = null, CancellationToken cancellationToken = default) + { + var instance = PrepareFrameAnalysisInstance(uri.AbsoluteUri, ffOptions ?? GlobalFFOptions.Current); + var result = await instance.StartAndWaitForExitAsync(cancellationToken).ConfigureAwait(false); + return ParseFramesOutput(result); + } + private static IMediaAnalysis ParseOutput(IProcessResult instance) { var json = string.Join(string.Empty, instance.OutputData);