mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Merge pull request #370 from jeroenvanderschoot/master
Add Uri support for Frame Analysis,
This commit is contained in:
commit
1b883f7da9
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