FFMpegCore: support configuration via ffmpeg.config.json

Former-commit-id: aed33a3d5c
This commit is contained in:
Vlad Jerca 2019-02-26 21:47:11 +02:00
parent 5f524bbc07
commit 9287cb3418
4 changed files with 33 additions and 2 deletions

View file

@ -6,6 +6,16 @@
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="ffmpeg.config.json" />
</ItemGroup>
<ItemGroup>
<Content Include="ffmpeg.config.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.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.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
namespace FFMpegCore.FFMPEG namespace FFMpegCore.FFMPEG
{ {
public abstract class FFBase : IDisposable public abstract class FFBase : IDisposable
{ {
private static string _ConfigFile = "./ffmpeg.config.json";
private static string _DefaultRoot = ".\\FFMPEG\\bin";
protected string ConfiguredRoot; protected string ConfiguredRoot;
protected Process Process; protected Process Process;
protected FFBase() protected FFBase()
{ {
ConfiguredRoot = ".\\FFMPEG\\bin"; ConfiguredRoot =
!File.Exists(_ConfigFile) ?
_DefaultRoot :
JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(_ConfigFile))["RootDirectory"];
} }
/// <summary> /// <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. 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
FFProbe is used to gather video information FFProbe is used to gather video information