Former-commit-id: 1f7e663765
This commit is contained in:
Malte Rosenbjerg 2020-05-01 10:07:43 +02:00
commit 6f925f76a7
2 changed files with 5 additions and 5 deletions

View file

@ -395,7 +395,7 @@ public VideoInfo Convert(ArgumentContainer arguments, bool skipExistsCheck = fal
throw new FFMpegException(FFMpegExceptionType.Conversion, "Could not process file without error"); throw new FFMpegException(FFMpegExceptionType.Conversion, "Could not process file without error");
_totalTime = TimeSpan.MinValue; _totalTime = TimeSpan.MinValue;
return new VideoInfo(output); return output.Exists ? new VideoInfo(output) : null;
} }
public async Task<VideoInfo> ConvertAsync(ArgumentContainer arguments, bool skipExistsCheck = false) public async Task<VideoInfo> ConvertAsync(ArgumentContainer arguments, bool skipExistsCheck = false)
{ {
@ -406,7 +406,7 @@ public async Task<VideoInfo> ConvertAsync(ArgumentContainer arguments, bool skip
throw new FFMpegException(FFMpegExceptionType.Conversion, "Could not process file without error"); throw new FFMpegException(FFMpegExceptionType.Conversion, "Could not process file without error");
_totalTime = TimeSpan.MinValue; _totalTime = TimeSpan.MinValue;
return new VideoInfo(output); return output.Exists ? new VideoInfo(output) : null;
} }
private static (VideoInfo[] Input, FileInfo Output) GetInputOutput(ArgumentContainer arguments) private static (VideoInfo[] Input, FileInfo Output) GetInputOutput(ArgumentContainer arguments)

View file

@ -358,9 +358,9 @@ public enum VideoCodec
} }
``` ```
### ArgumentBuilder ### ArgumentBuilder
Custom video converting presets could be created with help of `ArgumentsContainer` class: Custom video converting presets could be created with help of `ArgumentContainer` class:
```csharp ```csharp
var container = new ArgumentsContainer(); var container = new ArgumentContainer();
container.Add(new VideoCodecArgument(VideoCodec.LibX264)); container.Add(new VideoCodecArgument(VideoCodec.LibX264));
container.Add(new ScaleArgument(VideoSize.Hd)); container.Add(new ScaleArgument(VideoSize.Hd));
@ -368,7 +368,7 @@ var ffmpeg = new FFMpeg();
var result = ffmpeg.Convert(container, new FileInfo("input.mp4"), new FileInfo("output.mp4")); var result = ffmpeg.Convert(container, new FileInfo("input.mp4"), new FileInfo("output.mp4"));
``` ```
Other availible arguments could be found in `FFMpegCore.FFMPEG.Arguments` namespace. Other availible arguments could be found in `FFMpegCore.FFMPEG.Argument` namespace.
If you need to create your custom argument, you just need to create new class, that is inherited from `Argument`, `Argument<T>` or `Argument<T1, T2>` If you need to create your custom argument, you just need to create new class, that is inherited from `Argument`, `Argument<T>` or `Argument<T1, T2>`
For example: For example: