mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
commit
bce2b98d5d
8 changed files with 36 additions and 21 deletions
17
.github/workflows/ci.yml
vendored
Normal file
17
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
name: CI
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Prepare FFMpeg
|
||||
run: sudo apt-get update && sudo apt-get install -y ffmpeg
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 3.1.101
|
||||
- name: Build with dotnet
|
||||
run: dotnet build
|
||||
- name: Test with dotnet
|
||||
run: dotnet test
|
|
@ -1,6 +1,6 @@
|
|||
language: csharp
|
||||
mono: none
|
||||
dotnet: 2.1.300
|
||||
dotnet: 3.1
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
|
|
@ -53,7 +53,7 @@ public void Builder_BuildString_Scale()
|
|||
public void Builder_BuildString_AudioCodec()
|
||||
{
|
||||
var str = GetArgumentsString(new AudioCodecArgument(AudioCodec.Aac, AudioQuality.Normal));
|
||||
Assert.AreEqual(str, "-i \"input.mp4\" -codec:a aac -b:a 128k -strict experimental \"output.mp4\"");
|
||||
Assert.AreEqual(str, "-i \"input.mp4\" -c:a aac -b:a 128k \"output.mp4\"");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -204,7 +204,7 @@ public void Builder_BuildString_Codec()
|
|||
{
|
||||
var str = GetArgumentsString(new VideoCodecArgument(VideoCodec.LibX264));
|
||||
|
||||
Assert.AreEqual(str, "-i \"input.mp4\" -codec:v libx264 -pix_fmt yuv420p \"output.mp4\"");
|
||||
Assert.AreEqual(str, "-i \"input.mp4\" -c:v libx264 -pix_fmt yuv420p \"output.mp4\"");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -212,7 +212,7 @@ public void Builder_BuildString_Codec_Override()
|
|||
{
|
||||
var str = GetArgumentsString(new VideoCodecArgument(VideoCodec.LibX264), new OverrideArgument());
|
||||
|
||||
Assert.AreEqual(str, "-i \"input.mp4\" -codec:v libx264 -pix_fmt yuv420p -y \"output.mp4\"");
|
||||
Assert.AreEqual(str, "-i \"input.mp4\" -c:v libx264 -pix_fmt yuv420p -y \"output.mp4\"");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"RootDirectory": "C:\\ProgramData\\chocolatey\\lib\\ffmpeg\\tools\\ffmpeg\\bin\\"
|
||||
"RootDirectory": ""
|
||||
}
|
|
@ -24,7 +24,7 @@ internal static string Audio(AudioCodec codec, int bitrate)
|
|||
|
||||
internal static string Audio(AudioCodec codec)
|
||||
{
|
||||
return $"-codec:a {codec.ToString().ToLower()} ";
|
||||
return $"-c:a {codec.ToString().ToLower()} ";
|
||||
}
|
||||
|
||||
internal static string Audio(AudioQuality bitrate)
|
||||
|
@ -34,12 +34,12 @@ internal static string Audio(AudioQuality bitrate)
|
|||
|
||||
internal static string Audio(int bitrate)
|
||||
{
|
||||
return $"-b:a {bitrate}k -strict experimental ";
|
||||
return $"-b:a {bitrate}k ";
|
||||
}
|
||||
|
||||
internal static string Video(VideoCodec codec, int bitrate = 0)
|
||||
{
|
||||
var video = $"-codec:v {codec.ToString().ToLower()} -pix_fmt yuv420p ";
|
||||
var video = $"-c:v {codec.ToString().ToLower()} -pix_fmt yuv420p ";
|
||||
|
||||
if (bitrate > 0)
|
||||
{
|
||||
|
|
|
@ -99,12 +99,10 @@ public Bitmap Snapshot(VideoInfo source, FileInfo output, Size? size = null, Tim
|
|||
Bitmap result;
|
||||
using (var bmp = (Bitmap) Image.FromFile(output.FullName))
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
using var ms = new MemoryStream();
|
||||
bmp.Save(ms, ImageFormat.Png);
|
||||
result = new Bitmap(ms);
|
||||
}
|
||||
}
|
||||
|
||||
if (output.Exists && !persistSnapshotOnFileSystem)
|
||||
{
|
||||
|
@ -499,8 +497,8 @@ private bool RunProcess(ArgumentContainer container, FileInfo output)
|
|||
Process.Close();
|
||||
|
||||
if (File.Exists(output.FullName))
|
||||
using (var file = File.Open(output.FullName, FileMode.Open))
|
||||
{
|
||||
using var file = File.Open(output.FullName, FileMode.Open);
|
||||
if (file.Length == 0)
|
||||
{
|
||||
throw new FFMpegException(FFMpegExceptionType.Process, _errorOutput);
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Instances" Version="1.1.0" />
|
||||
<PackageReference Include="Instances" Version="1.3.3" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="RunProcessAsTask" Version="1.2.4" />
|
||||
|
|
Loading…
Reference in a new issue