mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Fix progress event output when using the convert(ArgumentContainer) function
Former-commit-id: 16a70ebd72
This commit is contained in:
parent
e19bc03334
commit
555c618706
2 changed files with 12 additions and 1 deletions
|
@ -40,5 +40,9 @@ public override string GetStringValue()
|
||||||
{
|
{
|
||||||
return string.Join(" ", Value.Select(v => ArgumentStringifier.Input(v)));
|
return string.Join(" ", Value.Select(v => ArgumentStringifier.Input(v)));
|
||||||
}
|
}
|
||||||
|
public VideoInfo[] GetAsVideoInfo()
|
||||||
|
{
|
||||||
|
return Value.Select(v => new VideoInfo(v)).ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -436,14 +436,21 @@ public VideoInfo ReplaceAudio(VideoInfo source, FileInfo audio, FileInfo output,
|
||||||
|
|
||||||
public VideoInfo Convert(ArgumentContainer arguments)
|
public VideoInfo Convert(ArgumentContainer arguments)
|
||||||
{
|
{
|
||||||
var args = ArgumentBuilder.BuildArguments(arguments);
|
|
||||||
var output = ((OutputArgument)arguments[typeof(OutputArgument)]).GetAsFileInfo();
|
var output = ((OutputArgument)arguments[typeof(OutputArgument)]).GetAsFileInfo();
|
||||||
|
var sources = ((InputArgument)arguments[typeof(InputArgument)]).GetAsVideoInfo();
|
||||||
|
|
||||||
|
// Sum duration of all sources
|
||||||
|
_totalTime = TimeSpan.Zero;
|
||||||
|
foreach (var source in sources)
|
||||||
|
_totalTime += source.Duration;
|
||||||
|
|
||||||
if (!RunProcess(arguments, output))
|
if (!RunProcess(arguments, output))
|
||||||
{
|
{
|
||||||
throw new FFMpegException(FFMpegExceptionType.Operation, "Could not replace the video audio.");
|
throw new FFMpegException(FFMpegExceptionType.Operation, "Could not replace the video audio.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_totalTime = TimeSpan.MinValue;
|
||||||
|
|
||||||
return new VideoInfo(output);
|
return new VideoInfo(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue