FFMpegCore: support configuration via ffmpeg.config.json

This commit is contained in:
Vlad Jerca 2019-02-26 21:47:11 +02:00
parent 8272dc9c94
commit aed33a3d5c
4 changed files with 33 additions and 2 deletions

View file

@ -6,6 +6,16 @@
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<None Remove="ffmpeg.config.json" />
</ItemGroup>
<ItemGroup>
<Content Include="ffmpeg.config.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />

View file

@ -0,0 +1,3 @@
{
"RootDirectory": ".//FFMPEG//bin"
}

View file

@ -1,17 +1,25 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace FFMpegCore.FFMPEG
{
public abstract class FFBase : IDisposable
{
private static string _ConfigFile = "./ffmpeg.config.json";
private static string _DefaultRoot = ".\\FFMPEG\\bin";
protected string ConfiguredRoot;
protected Process Process;
protected FFBase()
{
ConfiguredRoot = ".\\FFMPEG\\bin";
ConfiguredRoot =
!File.Exists(_ConfigFile) ?
_DefaultRoot :
JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(_ConfigFile))["RootDirectory"];
}
/// <summary>

View file

@ -12,6 +12,16 @@ Install-Package FFMpegCore
A great way to use FFMpeg encoding when writing video applications, client-side and server-side. It has wrapper methods that allow conversion to all web formats: MP4, OGV, TS and methods of capturing screens from the videos.
### Configuratoin
The root directory for the ffmpeg binaries can be configured via the `ffmpeg.config.json` file.
```json
{
"RootDirectory": ".//FFMPEG//bin"
}
```
### FFProbe
FFProbe is used to gather video information