From b11be87a45aadb901e46897a795f27d9637d378c Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Wed, 12 Feb 2020 20:45:16 +0100 Subject: [PATCH 01/12] More cleanup Former-commit-id: ecf7a711f4ced0480fa672584973f707872e337c --- FFMpegCore.Test/ArgumentBuilderTest.cs | 6 +++--- .../FFMPEG/Argument/ArgumentStringifier.cs | 6 +++--- FFMpegCore/FFMPEG/FFMpeg.cs | 18 ++++++++---------- FFMpegCore/FFMpegCore.csproj | 2 +- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/FFMpegCore.Test/ArgumentBuilderTest.cs b/FFMpegCore.Test/ArgumentBuilderTest.cs index 68df940..9dd1b9a 100644 --- a/FFMpegCore.Test/ArgumentBuilderTest.cs +++ b/FFMpegCore.Test/ArgumentBuilderTest.cs @@ -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] diff --git a/FFMpegCore/FFMPEG/Argument/ArgumentStringifier.cs b/FFMpegCore/FFMPEG/Argument/ArgumentStringifier.cs index 0a723ef..ee11c03 100644 --- a/FFMpegCore/FFMPEG/Argument/ArgumentStringifier.cs +++ b/FFMpegCore/FFMPEG/Argument/ArgumentStringifier.cs @@ -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) { diff --git a/FFMpegCore/FFMPEG/FFMpeg.cs b/FFMpegCore/FFMPEG/FFMpeg.cs index 5fe7689..b5b49db 100644 --- a/FFMpegCore/FFMPEG/FFMpeg.cs +++ b/FFMpegCore/FFMPEG/FFMpeg.cs @@ -99,11 +99,9 @@ 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()) - { - bmp.Save(ms, ImageFormat.Png); - result = new Bitmap(ms); - } + using var ms = new MemoryStream(); + bmp.Save(ms, ImageFormat.Png); + result = new Bitmap(ms); } if (output.Exists && !persistSnapshotOnFileSystem) @@ -499,13 +497,13 @@ 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) { - if (file.Length == 0) - { - throw new FFMpegException(FFMpegExceptionType.Process, _errorOutput); - } + throw new FFMpegException(FFMpegExceptionType.Process, _errorOutput); } + } else { throw new FFMpegException(FFMpegExceptionType.Process, _errorOutput); diff --git a/FFMpegCore/FFMpegCore.csproj b/FFMpegCore/FFMpegCore.csproj index a72cabc..f786256 100644 --- a/FFMpegCore/FFMpegCore.csproj +++ b/FFMpegCore/FFMpegCore.csproj @@ -129,7 +129,7 @@ - + From 17d0d718af2f5c4cf5cb1b10eb59e809f16776ce Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2020 10:36:38 +0100 Subject: [PATCH 02/12] Create ci.yml Former-commit-id: d97a08181309a36c4542fd778c8be27bd92ab81a --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1 @@ + From 55dd041961b09dd9effc80ef6526661ca138fb61 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2020 10:46:30 +0100 Subject: [PATCH 03/12] Update ci.yml Former-commit-id: a7e24788626f10aeac39288ea46f4ca42d0340e8 --- .github/workflows/ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b13789..602e45d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1 +1,16 @@ +name: CI +on: [pull_request] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - 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 From c9dc111f1712d4f0513f0c7696e9dc04d225392c Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2020 10:46:58 +0100 Subject: [PATCH 04/12] Update ci.yml Former-commit-id: 90727eb22886bd6adb4c57ae6c9f1044ba733155 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 602e45d..d8d288c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ on: [pull_request] jobs: build: - runs-on: ubuntu-latest + runs-on: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v1 - name: Setup .NET Core From c7eddb91c350b04908a65e10770013e3cb5046d1 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2020 10:55:09 +0100 Subject: [PATCH 05/12] Update .travis.yml Former-commit-id: d6aa7151d339d319ad455f2acacac36659889555 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a44cb8b..0983398 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: csharp mono: none -dotnet: 2.1.300 +dotnet: 3.1.101 os: - linux - osx From f89a3e2ef3a407281bdf4b3882a580a9ac631a44 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2020 10:59:08 +0100 Subject: [PATCH 06/12] Update ci.yml Former-commit-id: 95e5578bff136be310bd5dbf6f4c999b3b394cac --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8d288c..4c762cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ name: CI -on: [pull_request] +on: [push, pull_request] jobs: build: From 0d6acfebc8adb74e59e6c634c6d0fde805588ea6 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2020 11:02:59 +0100 Subject: [PATCH 07/12] Update ci.yml Former-commit-id: b222340dcc765aaf1806369e165ac41f27d12235 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c762cb..df5f86d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ on: [push, pull_request] jobs: build: - runs-on: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Setup .NET Core From 980fe8d74c425f666f52748ae351cf103115f59a Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2020 11:03:51 +0100 Subject: [PATCH 08/12] Update .travis.yml Former-commit-id: 32fb4ec8359b92fd9df393e54ba2a762b828e9a1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0983398..1cb2185 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: csharp mono: none -dotnet: 3.1.101 +dotnet: 3.1 os: - linux - osx From a7d21029581da4bb82574658481de942f30828f6 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2020 11:08:15 +0100 Subject: [PATCH 09/12] Bump versions Former-commit-id: 16a472642675e71b55cd12a066768835b384028a --- FFMpegCore.Test/FFMpegCore.Test.csproj | 4 ++-- FFMpegCore/FFMpegCore.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FFMpegCore.Test/FFMpegCore.Test.csproj b/FFMpegCore.Test/FFMpegCore.Test.csproj index 33df305..8e749dd 100644 --- a/FFMpegCore.Test/FFMpegCore.Test.csproj +++ b/FFMpegCore.Test/FFMpegCore.Test.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.1 + netcoreapp3.1 false diff --git a/FFMpegCore/FFMpegCore.csproj b/FFMpegCore/FFMpegCore.csproj index f786256..3fc56cf 100644 --- a/FFMpegCore/FFMpegCore.csproj +++ b/FFMpegCore/FFMpegCore.csproj @@ -129,7 +129,7 @@ - + From 949458bf03e835f3035c0285cb865587fb5dcc67 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2020 11:13:21 +0100 Subject: [PATCH 10/12] Update ci.yml Former-commit-id: b680302e996bdc586f799379811b710c204ef11b --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df5f86d..efd5f0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,12 @@ name: CI on: [push, pull_request] - jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - name: Prepare FFMpeg + run: apt-get update && apt-get install -y ffmpeg - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: From dda016040fc635a3287bc2ceb6cee93ecd23aab7 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2020 11:14:01 +0100 Subject: [PATCH 11/12] Change test path Former-commit-id: 757d23a99bab354c5d6f1af516a9faa35bd6275a --- FFMpegCore.Test/ffmpeg.config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FFMpegCore.Test/ffmpeg.config.json b/FFMpegCore.Test/ffmpeg.config.json index 12322b0..b9c9a56 100644 --- a/FFMpegCore.Test/ffmpeg.config.json +++ b/FFMpegCore.Test/ffmpeg.config.json @@ -1,3 +1,3 @@ { - "RootDirectory": "C:\\ProgramData\\chocolatey\\lib\\ffmpeg\\tools\\ffmpeg\\bin\\" + "RootDirectory": "" } \ No newline at end of file From 41e1a871acf55229c83e58a0988100f9fc51257a Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2020 11:16:28 +0100 Subject: [PATCH 12/12] Update ci.yml Former-commit-id: a1c5a9fc6073b2f5834de7d8ca130ca786b7e3a8 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efd5f0c..4a49128 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Prepare FFMpeg - run: apt-get update && apt-get install -y ffmpeg + run: sudo apt-get update && sudo apt-get install -y ffmpeg - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: