mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
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.
This commit is contained in:
parent
4617f89560
commit
31b93b3ed6
1 changed files with 16 additions and 0 deletions
|
@ -89,6 +89,15 @@ public static async Task<IMediaAnalysis> AnalyseAsync(string filePath, FFOptions
|
||||||
return ParseOutput(result);
|
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<FFProbeFrames> GetFramesAsync(string filePath, FFOptions? ffOptions = null, CancellationToken cancellationToken = default)
|
public static async Task<FFProbeFrames> GetFramesAsync(string filePath, FFOptions? ffOptions = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
ThrowIfInputFileDoesNotExist(filePath);
|
ThrowIfInputFileDoesNotExist(filePath);
|
||||||
|
@ -141,6 +150,13 @@ public static async Task<IMediaAnalysis> AnalyseAsync(Stream stream, FFOptions?
|
||||||
return ParseOutput(result);
|
return ParseOutput(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task<FFProbeFrames> 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)
|
private static IMediaAnalysis ParseOutput(IProcessResult instance)
|
||||||
{
|
{
|
||||||
var json = string.Join(string.Empty, instance.OutputData);
|
var json = string.Join(string.Empty, instance.OutputData);
|
||||||
|
|
Loading…
Reference in a new issue