From 86a500309d9dcb2afbe73002a2f874f743625d57 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Wed, 22 Feb 2023 17:49:09 +0100 Subject: [PATCH 01/43] Set ContinuousIntegrationBuild to true --- Directory.Build.props | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index 2944c6b..628195a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,5 +13,14 @@ https://github.com/rosenbjerg/FFMpegCore MIT en + + true + true + snupkg + true + + + true + \ No newline at end of file From cc2d9890f95e2305d94001864af0a304ca81918f Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Wed, 22 Feb 2023 17:50:35 +0100 Subject: [PATCH 02/43] CI yaml fixes --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94a858f..993d057 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI on: push: branches: - - master + - main paths: - .github/workflows/ci.yml - FFMpegCore/** @@ -13,9 +13,9 @@ on: - main - release paths: - - .github/workflows/ci.yml - - FFMpegCore/** - - FFMpegCore.Test/** + - .github/workflows/ci.yml + - FFMpegCore/** + - FFMpegCore.Test/** jobs: ci: From 06f5bfa598879d00b1bc92f3732017d358957a47 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Wed, 22 Feb 2023 17:52:29 +0100 Subject: [PATCH 03/43] Update CI paths --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 993d057..6c3ba1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,8 @@ on: - .github/workflows/ci.yml - FFMpegCore/** - FFMpegCore.Test/** + - FFMpegCore.Extensions.SkiaSharp/** + - FFMpegCore.Extensions.System.Drawing.Common/** pull_request: branches: - main @@ -16,6 +18,8 @@ on: - .github/workflows/ci.yml - FFMpegCore/** - FFMpegCore.Test/** + - FFMpegCore.Extensions.SkiaSharp/** + - FFMpegCore.Extensions.System.Drawing.Common/** jobs: ci: From e9264a3c2adeac9304d9541614cfc57ea7f068db Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Wed, 22 Feb 2023 17:52:56 +0100 Subject: [PATCH 04/43] Update ci.yml --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c3ba1e..4f8fa34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ on: - main paths: - .github/workflows/ci.yml + - Directory.Build.props - FFMpegCore/** - FFMpegCore.Test/** - FFMpegCore.Extensions.SkiaSharp/** @@ -16,6 +17,7 @@ on: - release paths: - .github/workflows/ci.yml + - Directory.Build.props - FFMpegCore/** - FFMpegCore.Test/** - FFMpegCore.Extensions.SkiaSharp/** From 8a764eccc7e0ca37d9df2e0da8694a8dbdb2bdcc Mon Sep 17 00:00:00 2001 From: AddyMills <74471839+AddyMills@users.noreply.github.com> Date: Fri, 1 Mar 2024 07:08:16 -0600 Subject: [PATCH 05/43] Add MultiInputArgument --- .../FFMpeg/Arguments/MultiInputArgument.cs | 47 +++++++++++++++++++ FFMpegCore/FFMpeg/FFMpegArguments.cs | 2 + FFMpegCore/FFMpegCore.csproj | 4 +- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 FFMpegCore/FFMpeg/Arguments/MultiInputArgument.cs diff --git a/FFMpegCore/FFMpeg/Arguments/MultiInputArgument.cs b/FFMpegCore/FFMpeg/Arguments/MultiInputArgument.cs new file mode 100644 index 0000000..e64d96a --- /dev/null +++ b/FFMpegCore/FFMpeg/Arguments/MultiInputArgument.cs @@ -0,0 +1,47 @@ +namespace FFMpegCore.Arguments +{ + /// + /// Represents input parameters for multiple files + /// + public class MultiInputArgument : IInputArgument + { + public readonly bool VerifyExists; + public readonly string[] FilePaths; + + public MultiInputArgument(bool verifyExists, params string[] filePaths) + { + VerifyExists = verifyExists; + FilePaths = filePaths; + } + + public MultiInputArgument(string[] filePaths, bool verifyExists) : this(verifyExists, filePaths) { } + + public void Pre() + { + if (VerifyExists) + { + var missingFiles = new List(); + foreach (var filePath in FilePaths) + { + if (!File.Exists(filePath)) + { + missingFiles.Add(filePath); + } + } + + if (missingFiles.Any()) + { + throw new FileNotFoundException($"The following input files were not found: {string.Join(", ", missingFiles)}"); + } + } + } + + public Task During(CancellationToken cancellationToken = default) => Task.CompletedTask; + public void Post() { } + + /// + /// Generates a combined input argument text for all file paths + /// + public string Text => string.Join(" ", FilePaths.Select(filePath => $"-i \"{filePath}\"")); + } +} diff --git a/FFMpegCore/FFMpeg/FFMpegArguments.cs b/FFMpegCore/FFMpeg/FFMpegArguments.cs index cfc6d9d..cf57b84 100644 --- a/FFMpegCore/FFMpeg/FFMpegArguments.cs +++ b/FFMpegCore/FFMpeg/FFMpegArguments.cs @@ -21,6 +21,7 @@ namespace FFMpegCore public static FFMpegArguments FromConcatInput(IEnumerable filePaths, Action? addArguments = null) => new FFMpegArguments().WithInput(new ConcatArgument(filePaths), addArguments); public static FFMpegArguments FromDemuxConcatInput(IEnumerable filePaths, Action? addArguments = null) => new FFMpegArguments().WithInput(new DemuxConcatArgument(filePaths), addArguments); public static FFMpegArguments FromFileInput(string filePath, bool verifyExists = true, Action? addArguments = null) => new FFMpegArguments().WithInput(new InputArgument(verifyExists, filePath), addArguments); + public static FFMpegArguments FromFileInput(string[] filePath, bool verifyExists = true, Action? addArguments = null) => new FFMpegArguments().WithInput(new MultiInputArgument(verifyExists, filePath), addArguments); public static FFMpegArguments FromFileInput(FileInfo fileInfo, Action? addArguments = null) => new FFMpegArguments().WithInput(new InputArgument(fileInfo.FullName, false), addArguments); public static FFMpegArguments FromUrlInput(Uri uri, Action? addArguments = null) => new FFMpegArguments().WithInput(new InputArgument(uri.AbsoluteUri, false), addArguments); public static FFMpegArguments FromDeviceInput(string device, Action? addArguments = null) => new FFMpegArguments().WithInput(new InputDeviceArgument(device), addArguments); @@ -35,6 +36,7 @@ namespace FFMpegCore public FFMpegArguments AddConcatInput(IEnumerable filePaths, Action? addArguments = null) => WithInput(new ConcatArgument(filePaths), addArguments); public FFMpegArguments AddDemuxConcatInput(IEnumerable filePaths, Action? addArguments = null) => WithInput(new DemuxConcatArgument(filePaths), addArguments); public FFMpegArguments AddFileInput(string filePath, bool verifyExists = true, Action? addArguments = null) => WithInput(new InputArgument(verifyExists, filePath), addArguments); + public FFMpegArguments AddFileInput(string[] filePath, bool verifyExists = true, Action? addArguments = null) => WithInput(new MultiInputArgument(verifyExists, filePath), addArguments); public FFMpegArguments AddFileInput(FileInfo fileInfo, Action? addArguments = null) => WithInput(new InputArgument(fileInfo.FullName, false), addArguments); public FFMpegArguments AddUrlInput(Uri uri, Action? addArguments = null) => WithInput(new InputArgument(uri.AbsoluteUri, false), addArguments); public FFMpegArguments AddDeviceInput(string device, Action? addArguments = null) => WithInput(new InputDeviceArgument(device), addArguments); diff --git a/FFMpegCore/FFMpegCore.csproj b/FFMpegCore/FFMpegCore.csproj index ed3b71c..e6a45e9 100644 --- a/FFMpegCore/FFMpegCore.csproj +++ b/FFMpegCore/FFMpegCore.csproj @@ -3,7 +3,7 @@ true A .NET Standard FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your .NET applications - 5.1.0 + 5.1.1 ../nupkg @@ -20,5 +20,7 @@ + + From 8f6d1aa8e959442a0116986d691dd7358fe476d0 Mon Sep 17 00:00:00 2001 From: AddyMills <74471839+AddyMills@users.noreply.github.com> Date: Fri, 1 Mar 2024 07:13:55 -0600 Subject: [PATCH 06/43] Update MultiInput to IEnumerable --- FFMpegCore/FFMpeg/Arguments/MultiInputArgument.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FFMpegCore/FFMpeg/Arguments/MultiInputArgument.cs b/FFMpegCore/FFMpeg/Arguments/MultiInputArgument.cs index e64d96a..288c761 100644 --- a/FFMpegCore/FFMpeg/Arguments/MultiInputArgument.cs +++ b/FFMpegCore/FFMpeg/Arguments/MultiInputArgument.cs @@ -6,15 +6,15 @@ public class MultiInputArgument : IInputArgument { public readonly bool VerifyExists; - public readonly string[] FilePaths; + public readonly IEnumerable FilePaths; - public MultiInputArgument(bool verifyExists, params string[] filePaths) + public MultiInputArgument(bool verifyExists, IEnumerable filePaths) { VerifyExists = verifyExists; FilePaths = filePaths; } - public MultiInputArgument(string[] filePaths, bool verifyExists) : this(verifyExists, filePaths) { } + public MultiInputArgument(IEnumerable filePaths, bool verifyExists) : this(verifyExists, filePaths) { } public void Pre() { From d83650168121c2c5e6b98aa9977ada3cb31b076f Mon Sep 17 00:00:00 2001 From: AddyMills <74471839+AddyMills@users.noreply.github.com> Date: Sun, 3 Mar 2024 11:42:52 -0600 Subject: [PATCH 07/43] Change string array to IEnumerable --- FFMpegCore/FFMpeg/FFMpegArguments.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FFMpegCore/FFMpeg/FFMpegArguments.cs b/FFMpegCore/FFMpeg/FFMpegArguments.cs index cf57b84..08b9d19 100644 --- a/FFMpegCore/FFMpeg/FFMpegArguments.cs +++ b/FFMpegCore/FFMpeg/FFMpegArguments.cs @@ -21,7 +21,7 @@ namespace FFMpegCore public static FFMpegArguments FromConcatInput(IEnumerable filePaths, Action? addArguments = null) => new FFMpegArguments().WithInput(new ConcatArgument(filePaths), addArguments); public static FFMpegArguments FromDemuxConcatInput(IEnumerable filePaths, Action? addArguments = null) => new FFMpegArguments().WithInput(new DemuxConcatArgument(filePaths), addArguments); public static FFMpegArguments FromFileInput(string filePath, bool verifyExists = true, Action? addArguments = null) => new FFMpegArguments().WithInput(new InputArgument(verifyExists, filePath), addArguments); - public static FFMpegArguments FromFileInput(string[] filePath, bool verifyExists = true, Action? addArguments = null) => new FFMpegArguments().WithInput(new MultiInputArgument(verifyExists, filePath), addArguments); + public static FFMpegArguments FromFileInput(IEnumerable filePath, bool verifyExists = true, Action? addArguments = null) => new FFMpegArguments().WithInput(new MultiInputArgument(verifyExists, filePath), addArguments); public static FFMpegArguments FromFileInput(FileInfo fileInfo, Action? addArguments = null) => new FFMpegArguments().WithInput(new InputArgument(fileInfo.FullName, false), addArguments); public static FFMpegArguments FromUrlInput(Uri uri, Action? addArguments = null) => new FFMpegArguments().WithInput(new InputArgument(uri.AbsoluteUri, false), addArguments); public static FFMpegArguments FromDeviceInput(string device, Action? addArguments = null) => new FFMpegArguments().WithInput(new InputDeviceArgument(device), addArguments); From 622db9600c66f058085ee89b8487a4734dc02016 Mon Sep 17 00:00:00 2001 From: AddyMills <74471839+AddyMills@users.noreply.github.com> Date: Sun, 3 Mar 2024 12:49:34 -0600 Subject: [PATCH 08/43] Add MultiInput Test --- FFMpegCore.Test/ArgumentBuilderTest.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/FFMpegCore.Test/ArgumentBuilderTest.cs b/FFMpegCore.Test/ArgumentBuilderTest.cs index cf455c8..00b0c96 100644 --- a/FFMpegCore.Test/ArgumentBuilderTest.cs +++ b/FFMpegCore.Test/ArgumentBuilderTest.cs @@ -9,6 +9,7 @@ namespace FFMpegCore.Test public class ArgumentBuilderTest { private readonly string[] _concatFiles = { "1.mp4", "2.mp4", "3.mp4", "4.mp4" }; + private readonly string[] _multiFiles = { "1.mp3", "2.mp3", "3.mp3", "4.mp3" }; [TestMethod] public void Builder_BuildString_IO_1() @@ -611,5 +612,24 @@ namespace FFMpegCore.Test -i "input.mp4" -f tee "[movflags=faststart]output.mp4|[f=mpegts:select=\'0:v:0\']http://server/path" """, str); } + [TestMethod] + public void Builder_BuildString_MultiInput() + { + var audioStreams = string.Join("", _multiFiles.Select((item, index) => $"[{index}:0]")); + var mixFilter = $"{audioStreams}amix=inputs={_multiFiles.Length}:duration=longest:dropout_transition=1:normalize=0[final]"; + var ffmpegArgs = $"-filter_complex \"{mixFilter}\" -map \"[final]\""; + var str = FFMpegArguments + .FromFileInput(_multiFiles) + .OutputToFile("output.mp3", overwrite: true, options => options + .WithCustomArgument(ffmpegArgs) + .WithAudioCodec(AudioCodec.LibMp3Lame) // Set the audio codec to MP3 + .WithAudioBitrate(128) // Set the bitrate to 128kbps + .WithAudioSamplingRate(48000) // Set the sample rate to 48kHz + .WithoutMetadata() // Remove metadata + .WithCustomArgument("-ac 2 -write_xing 0 -id3v2_version 0")) // Force 2 Channels + .Arguments; + + Assert.AreEqual($"-i \"1.mp3\" -i \"2.mp3\" -i \"3.mp3\" -i \"4.mp3\" -filter_complex \"[0:0][1:0][2:0][3:0]amix=inputs=4:duration=longest:dropout_transition=1:normalize=0[final]\" -map \"[final]\" -c:a libmp3lame -b:a 128k -ar 48000 -map_metadata -1 -ac 2 -write_xing 0 -id3v2_version 0 \"output.mp3\" -y", str); + } } } From bb341e6dd7260196f13c69362aac3f6574b1cf95 Mon Sep 17 00:00:00 2001 From: AddyMills <74471839+AddyMills@users.noreply.github.com> Date: Sun, 3 Mar 2024 13:02:50 -0600 Subject: [PATCH 09/43] Update one more instance of string[] to IEnumerable --- FFMpegCore/FFMpeg/FFMpegArguments.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FFMpegCore/FFMpeg/FFMpegArguments.cs b/FFMpegCore/FFMpeg/FFMpegArguments.cs index 08b9d19..ddb1f72 100644 --- a/FFMpegCore/FFMpeg/FFMpegArguments.cs +++ b/FFMpegCore/FFMpeg/FFMpegArguments.cs @@ -36,7 +36,7 @@ namespace FFMpegCore public FFMpegArguments AddConcatInput(IEnumerable filePaths, Action? addArguments = null) => WithInput(new ConcatArgument(filePaths), addArguments); public FFMpegArguments AddDemuxConcatInput(IEnumerable filePaths, Action? addArguments = null) => WithInput(new DemuxConcatArgument(filePaths), addArguments); public FFMpegArguments AddFileInput(string filePath, bool verifyExists = true, Action? addArguments = null) => WithInput(new InputArgument(verifyExists, filePath), addArguments); - public FFMpegArguments AddFileInput(string[] filePath, bool verifyExists = true, Action? addArguments = null) => WithInput(new MultiInputArgument(verifyExists, filePath), addArguments); + public FFMpegArguments AddFileInput(IEnumerable filePath, bool verifyExists = true, Action? addArguments = null) => WithInput(new MultiInputArgument(verifyExists, filePath), addArguments); public FFMpegArguments AddFileInput(FileInfo fileInfo, Action? addArguments = null) => WithInput(new InputArgument(fileInfo.FullName, false), addArguments); public FFMpegArguments AddUrlInput(Uri uri, Action? addArguments = null) => WithInput(new InputArgument(uri.AbsoluteUri, false), addArguments); public FFMpegArguments AddDeviceInput(string device, Action? addArguments = null) => WithInput(new InputDeviceArgument(device), addArguments); From 31b117d1862fd80b7df928291986e2f693ff2c74 Mon Sep 17 00:00:00 2001 From: AddyMills <74471839+AddyMills@users.noreply.github.com> Date: Sun, 3 Mar 2024 13:09:52 -0600 Subject: [PATCH 10/43] Remove whitespace --- FFMpegCore.Test/ArgumentBuilderTest.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/FFMpegCore.Test/ArgumentBuilderTest.cs b/FFMpegCore.Test/ArgumentBuilderTest.cs index 00b0c96..b6ae6dd 100644 --- a/FFMpegCore.Test/ArgumentBuilderTest.cs +++ b/FFMpegCore.Test/ArgumentBuilderTest.cs @@ -628,7 +628,6 @@ namespace FFMpegCore.Test .WithoutMetadata() // Remove metadata .WithCustomArgument("-ac 2 -write_xing 0 -id3v2_version 0")) // Force 2 Channels .Arguments; - Assert.AreEqual($"-i \"1.mp3\" -i \"2.mp3\" -i \"3.mp3\" -i \"4.mp3\" -filter_complex \"[0:0][1:0][2:0][3:0]amix=inputs=4:duration=longest:dropout_transition=1:normalize=0[final]\" -map \"[final]\" -c:a libmp3lame -b:a 128k -ar 48000 -map_metadata -1 -ac 2 -write_xing 0 -id3v2_version 0 \"output.mp3\" -y", str); } } From 94db493d1951b7a72698b972d6f345d6860ddac6 Mon Sep 17 00:00:00 2001 From: AddyMills <74471839+AddyMills@users.noreply.github.com> Date: Sun, 3 Mar 2024 18:56:06 -0600 Subject: [PATCH 11/43] Add IEnumerable tests for inputs --- FFMpegCore.Test/ArgumentBuilderTest.cs | 63 ++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/FFMpegCore.Test/ArgumentBuilderTest.cs b/FFMpegCore.Test/ArgumentBuilderTest.cs index b6ae6dd..2b6c0d4 100644 --- a/FFMpegCore.Test/ArgumentBuilderTest.cs +++ b/FFMpegCore.Test/ArgumentBuilderTest.cs @@ -630,5 +630,68 @@ namespace FFMpegCore.Test .Arguments; Assert.AreEqual($"-i \"1.mp3\" -i \"2.mp3\" -i \"3.mp3\" -i \"4.mp3\" -filter_complex \"[0:0][1:0][2:0][3:0]amix=inputs=4:duration=longest:dropout_transition=1:normalize=0[final]\" -map \"[final]\" -c:a libmp3lame -b:a 128k -ar 48000 -map_metadata -1 -ac 2 -write_xing 0 -id3v2_version 0 \"output.mp3\" -y", str); } + [TestMethod] + public void Pre_VerifyExists_AllFilesExist() + { + // Arrange + var filePaths = new List + { + Path.GetTempFileName(), + Path.GetTempFileName(), + Path.GetTempFileName() + }; + var argument = new MultiInputArgument(true, filePaths); + try + { + // Act & Assert + argument.Pre(); // No exception should be thrown + } + finally + { + // Cleanup + foreach (var filePath in filePaths) + { + File.Delete(filePath); + } + } + } + + [TestMethod] + public void Pre_VerifyExists_SomeFilesNotExist() + { + // Arrange + var filePaths = new List + { + Path.GetTempFileName(), + "file2.mp4", + "file3.mp4" + }; + var argument = new MultiInputArgument(true, filePaths); + try + { + // Act & Assert + Assert.ThrowsException(() => argument.Pre()); + } + finally + { + // Cleanup + File.Delete(filePaths[0]); + } + } + + [TestMethod] + public void Pre_VerifyExists_NoFilesExist() + { + // Arrange + var filePaths = new List + { + "file1.mp4", + "file2.mp4", + "file3.mp4" + }; + var argument = new MultiInputArgument(true, filePaths); + // Act & Assert + Assert.ThrowsException(() => argument.Pre()); + } } } From 49c29414743ef712885c252de3c0c82ecc99f3ca Mon Sep 17 00:00:00 2001 From: AddyMills <74471839+AddyMills@users.noreply.github.com> Date: Sat, 31 Aug 2024 20:30:37 -0600 Subject: [PATCH 12/43] Remove JSON vulnerability Reference --- FFMpegCore/FFMpegCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FFMpegCore/FFMpegCore.csproj b/FFMpegCore/FFMpegCore.csproj index e6a45e9..0b9b742 100644 --- a/FFMpegCore/FFMpegCore.csproj +++ b/FFMpegCore/FFMpegCore.csproj @@ -18,7 +18,7 @@ - + From f3be9f2b775e562fc4121e31d192037b852b62ed Mon Sep 17 00:00:00 2001 From: AddyMills <74471839+AddyMills@users.noreply.github.com> Date: Sat, 16 Nov 2024 19:50:29 -0600 Subject: [PATCH 13/43] Update JSON Reference --- FFMpegCore/FFMpegCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FFMpegCore/FFMpegCore.csproj b/FFMpegCore/FFMpegCore.csproj index 0b9b742..8f205fe 100644 --- a/FFMpegCore/FFMpegCore.csproj +++ b/FFMpegCore/FFMpegCore.csproj @@ -18,7 +18,7 @@ - + From aabd5cc3a8371ec20bcc6cb1679be434c1194bd9 Mon Sep 17 00:00:00 2001 From: AddyMills <74471839+AddyMills@users.noreply.github.com> Date: Sat, 16 Nov 2024 20:07:57 -0600 Subject: [PATCH 14/43] Revert "Update JSON Reference" This reverts commit f3be9f2b775e562fc4121e31d192037b852b62ed. --- FFMpegCore/FFMpegCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FFMpegCore/FFMpegCore.csproj b/FFMpegCore/FFMpegCore.csproj index 8f205fe..0b9b742 100644 --- a/FFMpegCore/FFMpegCore.csproj +++ b/FFMpegCore/FFMpegCore.csproj @@ -18,7 +18,7 @@ - + From 83099515195bc82f2f9bc399603922b4e7e0a32e Mon Sep 17 00:00:00 2001 From: AddyMills <74471839+AddyMills@users.noreply.github.com> Date: Sat, 16 Nov 2024 20:09:24 -0600 Subject: [PATCH 15/43] Reapply "Update JSON Reference" This reverts commit aabd5cc3a8371ec20bcc6cb1679be434c1194bd9. --- FFMpegCore/FFMpegCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FFMpegCore/FFMpegCore.csproj b/FFMpegCore/FFMpegCore.csproj index 0b9b742..8f205fe 100644 --- a/FFMpegCore/FFMpegCore.csproj +++ b/FFMpegCore/FFMpegCore.csproj @@ -18,7 +18,7 @@ - + From 69535d6fdc670b8b6b08a6435f99f410621d1d06 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Wed, 4 Dec 2024 21:54:06 +0200 Subject: [PATCH 16/43] dotnet format --- FFMpegCore.Test/ArgumentBuilderTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FFMpegCore.Test/ArgumentBuilderTest.cs b/FFMpegCore.Test/ArgumentBuilderTest.cs index 2b6c0d4..ce39c9d 100644 --- a/FFMpegCore.Test/ArgumentBuilderTest.cs +++ b/FFMpegCore.Test/ArgumentBuilderTest.cs @@ -665,7 +665,7 @@ namespace FFMpegCore.Test Path.GetTempFileName(), "file2.mp4", "file3.mp4" - }; + }; var argument = new MultiInputArgument(true, filePaths); try { From dedd9136822206af8a96ec258cf9f2df7a1188e6 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Wed, 4 Dec 2024 22:15:02 +0200 Subject: [PATCH 17/43] Bump packages --- .../FFMpegCore.Extensions.SkiaSharp.csproj | 4 ++-- .../FFMpegCore.Extensions.System.Drawing.Common.csproj | 2 +- FFMpegCore.Test/FFMpegCore.Test.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj b/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj index 3b16e06..0181f64 100644 --- a/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj +++ b/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj b/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj index ebd7c9a..05bdc73 100644 --- a/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj +++ b/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj @@ -13,7 +13,7 @@ - + diff --git a/FFMpegCore.Test/FFMpegCore.Test.csproj b/FFMpegCore.Test/FFMpegCore.Test.csproj index 84b863f..7791423 100644 --- a/FFMpegCore.Test/FFMpegCore.Test.csproj +++ b/FFMpegCore.Test/FFMpegCore.Test.csproj @@ -20,7 +20,7 @@ - + From 217c1d99e2dedbef124d91aa955c8bf66d76b8be Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Wed, 4 Dec 2024 22:16:22 +0200 Subject: [PATCH 18/43] Bump extension package nuget version --- .../FFMpegCore.Extensions.SkiaSharp.csproj | 2 +- .../FFMpegCore.Extensions.System.Drawing.Common.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj b/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj index 0181f64..9867a9c 100644 --- a/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj +++ b/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj @@ -3,7 +3,7 @@ true Image extension for FFMpegCore using SkiaSharp - 5.0.0 + 5.0.1 ../nupkg diff --git a/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj b/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj index 05bdc73..885779a 100644 --- a/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj +++ b/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj @@ -3,7 +3,7 @@ true Image extension for FFMpegCore using System.Common.Drawing - 5.0.0 + 5.0.1 ../nupkg From c7f8c19be762bdc6efcdbeb61782585eaf48908f Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Wed, 4 Dec 2024 22:19:57 +0200 Subject: [PATCH 19/43] Specify codecov os --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a810a2..cc25d22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,3 +58,4 @@ jobs: fail_ci_if_error: true directory: FFMpegCore.Test/TestResults token: ${{ secrets.CODECOV_TOKEN }} + os: windows From 9d0f8893a5ae26a24e41da0b761da6dc1a3eacbf Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Wed, 4 Dec 2024 22:25:36 +0200 Subject: [PATCH 20/43] Use codecov/codecov-action@v4 instead of 5 --- .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 cc25d22..3f3677b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: - if: matrix.os == 'windows-latest' name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@v4 with: fail_ci_if_error: true directory: FFMpegCore.Test/TestResults From 855e6ece3038d49a70c8003d35f502145eebf0cf Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 5 Dec 2024 10:59:59 +0200 Subject: [PATCH 21/43] Bump Instances --- FFMpegCore/FFMpegCore.csproj | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/FFMpegCore/FFMpegCore.csproj b/FFMpegCore/FFMpegCore.csproj index 2563fb5..5eebc22 100644 --- a/FFMpegCore/FFMpegCore.csproj +++ b/FFMpegCore/FFMpegCore.csproj @@ -17,10 +17,8 @@ - + - - From f5a8cf5de797c57964390406b58c4665f4f810b2 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2025 22:17:13 +0100 Subject: [PATCH 22/43] v 5.2.0 --- .../FFMpegCore.Extensions.SkiaSharp.csproj | 9 ++++----- ...MpegCore.Extensions.System.Drawing.Common.csproj | 7 +++---- FFMpegCore.Test/FFMpegCore.Test.csproj | 12 ++++++------ FFMpegCore/FFMpegCore.csproj | 13 +++++++++---- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj b/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj index 9867a9c..3609ddf 100644 --- a/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj +++ b/FFMpegCore.Extensions.SkiaSharp/FFMpegCore.Extensions.SkiaSharp.csproj @@ -3,18 +3,17 @@ true Image extension for FFMpegCore using SkiaSharp - 5.0.1 + 5.0.2 ../nupkg - - + Bump dependencies ffmpeg ffprobe convert video audio mediafile resize analyze muxing skiasharp Malte Rosenbjerg, Vlad Jerca, Max Bagryantsev, Dimitri Vranken true - - + + diff --git a/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj b/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj index 885779a..3a45aa5 100644 --- a/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj +++ b/FFMpegCore.Extensions.System.Drawing.Common/FFMpegCore.Extensions.System.Drawing.Common.csproj @@ -3,17 +3,16 @@ true Image extension for FFMpegCore using System.Common.Drawing - 5.0.1 + 5.0.2 ../nupkg - - + Bump dependencies ffmpeg ffprobe convert video audio mediafile resize analyze muxing Malte Rosenbjerg, Vlad Jerca, Max Bagryantsev true - + diff --git a/FFMpegCore.Test/FFMpegCore.Test.csproj b/FFMpegCore.Test/FFMpegCore.Test.csproj index 7791423..8413f84 100644 --- a/FFMpegCore.Test/FFMpegCore.Test.csproj +++ b/FFMpegCore.Test/FFMpegCore.Test.csproj @@ -8,19 +8,19 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + diff --git a/FFMpegCore/FFMpegCore.csproj b/FFMpegCore/FFMpegCore.csproj index 5eebc22..c324d62 100644 --- a/FFMpegCore/FFMpegCore.csproj +++ b/FFMpegCore/FFMpegCore.csproj @@ -3,10 +3,15 @@ true A .NET Standard FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your .NET applications - 5.1.1 + 5.2.0 ../nupkg - - + - **Instances and Packages Updates**: Updates to various instances and packages by rosenbjerg. +- **Audio and Video Enhancements**: Additions include a Copy option to Audio Codec and a Crop option to Arguments by brett-baker; video-stream level added to FFProbe analysis by Kaaybi; AV1 support for smaller snapshots and videos by BenediktBertsch; multiple input files support by AddyMills; HDR color properties support added to FFProbe analysis by Tomiscout. +- **System.Text.Json Bump**: Update by Kaaybi. +- **FFMpeg Processors and Utilities**: Modification for handling durations over 24 hours in `FFMpegArgumentProcessor` by alahane-techtel; fix for snapshots with correct width/height from rotated videos by Hagfjall. +- **Feature Additions and Fixes**: Support for multiple outputs and tee muxer by duggaraju; custom ffprob arguments by vfrz; fix for null reference exception with tags container by rosenbjerg; Chapter Modell change by vortex852456; codec copy added to the SaveM3U8Stream method by rpaschoal. +- **Closed and Non-merged Contributions**: Notable closed contributions include JSON source generators usage by onionware-github; Snapshot overload by 3UR; FromRawInput method by pedoc; runtime ffmpeg suite installation by yuqian5; and support for scale_npp by vicwilliam. +- **Miscellaneous Fixes**: Minor readme corrections by NaBian; fix for ffmpeg path issue by devedse. ffmpeg ffprobe convert video audio mediafile resize analyze muxing Malte Rosenbjerg, Vlad Jerca, Max Bagryantsev README.md @@ -18,7 +23,7 @@ - + From cc1d9d496675c82ad42aab976ac97ae7b3ceb518 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2025 22:29:15 +0100 Subject: [PATCH 23/43] Only run CI for PRs --- .github/workflows/ci.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f3677b..ea7c804 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,16 +1,6 @@ name: CI on: - push: - branches: - - main - paths: - - .github/workflows/ci.yml - - Directory.Build.props - - FFMpegCore/** - - FFMpegCore.Test/** - - FFMpegCore.Extensions.SkiaSharp/** - - FFMpegCore.Extensions.System.Drawing.Common/** pull_request: branches: - main From 19c83b86612b2f2ed95d0c50d522ee10124ed9fe Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Sun, 16 Feb 2025 22:29:29 +0100 Subject: [PATCH 24/43] Update property for Prepare FFMpeg CI step --- .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 ea7c804..f962c67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Prepare FFMpeg uses: FedericoCarboni/setup-ffmpeg@v3 with: - token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Test with dotnet run: dotnet test FFMpegCore.sln --collect "XPlat Code Coverage" --logger GitHubActions From df08334765777e1cff857a0f3eeb399ec9040fb8 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Tue, 18 Feb 2025 08:45:58 +0100 Subject: [PATCH 25/43] Specify ffmpeg version used for CI --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f962c67..03e0bfb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,7 @@ jobs: - name: Prepare FFMpeg uses: FedericoCarboni/setup-ffmpeg@v3 with: + ffmpeg-version: 6.1.0 github-token: ${{ secrets.GITHUB_TOKEN }} - name: Test with dotnet From 0e9ceee8d9214ebdf7f4cca91789b00761b2e5cc Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Tue, 18 Feb 2025 08:50:36 +0100 Subject: [PATCH 26/43] Use different ffmpeg version --- .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 03e0bfb..fb996e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Prepare FFMpeg uses: FedericoCarboni/setup-ffmpeg@v3 with: - ffmpeg-version: 6.1.0 + ffmpeg-version: 6.1.1 github-token: ${{ secrets.GITHUB_TOKEN }} - name: Test with dotnet From 37973c3dafc2b0a2f89cf2484690de2b99a626c1 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Tue, 18 Feb 2025 08:55:41 +0100 Subject: [PATCH 27/43] Use different ffmpeg version --- .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 fb996e0..5193d2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Prepare FFMpeg uses: FedericoCarboni/setup-ffmpeg@v3 with: - ffmpeg-version: 6.1.1 + ffmpeg-version: 6.0.1 github-token: ${{ secrets.GITHUB_TOKEN }} - name: Test with dotnet From aa1051b2686136e6ff9dede89bc96f695eb0ecdd Mon Sep 17 00:00:00 2001 From: Victor Horobchuk Date: Thu, 17 Apr 2025 12:29:06 +0300 Subject: [PATCH 28/43] FEAT: added more extensions for snapshot(jpg, bmp, webp) --- FFMpegCore.Test/VideoTest.cs | 59 +++++++++++++++++++- FFMpegCore/FFMpeg/Enums/Enums.cs | 26 ++++++++- FFMpegCore/FFMpeg/Enums/FileExtension.cs | 15 ++++- FFMpegCore/FFMpeg/FFMpeg.cs | 38 ++++++++----- FFMpegCore/FFMpeg/SnapshotArgumentBuilder.cs | 26 ++++++++- 5 files changed, 144 insertions(+), 20 deletions(-) diff --git a/FFMpegCore.Test/VideoTest.cs b/FFMpegCore.Test/VideoTest.cs index 8da9c19..ce23660 100644 --- a/FFMpegCore.Test/VideoTest.cs +++ b/FFMpegCore.Test/VideoTest.cs @@ -467,7 +467,7 @@ namespace FFMpegCore.Test } [TestMethod, Timeout(BaseTimeoutMilliseconds)] - public void Video_Snapshot_PersistSnapshot() + public void Video_Snapshot_Png_PersistSnapshot() { using var outputPath = new TemporaryFile("out.png"); var input = FFProbe.Analyse(TestResources.Mp4Video); @@ -480,6 +480,63 @@ namespace FFMpegCore.Test Assert.AreEqual("png", analysis.PrimaryVideoStream!.CodecName); } + [TestMethod, Timeout(BaseTimeoutMilliseconds)] + public void Video_Snapshot_Jpg_PersistSnapshot() + { + using var outputPath = new TemporaryFile("out.jpg"); + var input = FFProbe.Analyse(TestResources.Mp4Video); + + FFMpeg.Snapshot(TestResources.Mp4Video, outputPath); + + var analysis = FFProbe.Analyse(outputPath); + Assert.AreEqual(input.PrimaryVideoStream!.Width, analysis.PrimaryVideoStream!.Width); + Assert.AreEqual(input.PrimaryVideoStream.Height, analysis.PrimaryVideoStream!.Height); + Assert.AreEqual("mjpeg", analysis.PrimaryVideoStream!.CodecName); + } + + [TestMethod, Timeout(BaseTimeoutMilliseconds)] + public void Video_Snapshot_Bmp_PersistSnapshot() + { + using var outputPath = new TemporaryFile("out.bmp"); + var input = FFProbe.Analyse(TestResources.Mp4Video); + + FFMpeg.Snapshot(TestResources.Mp4Video, outputPath); + + var analysis = FFProbe.Analyse(outputPath); + Assert.AreEqual(input.PrimaryVideoStream!.Width, analysis.PrimaryVideoStream!.Width); + Assert.AreEqual(input.PrimaryVideoStream.Height, analysis.PrimaryVideoStream!.Height); + Assert.AreEqual("bmp", analysis.PrimaryVideoStream!.CodecName); + } + + [TestMethod, Timeout(BaseTimeoutMilliseconds)] + public void Video_Snapshot_Webp_PersistSnapshot() + { + using var outputPath = new TemporaryFile("out.webp"); + var input = FFProbe.Analyse(TestResources.Mp4Video); + + FFMpeg.Snapshot(TestResources.Mp4Video, outputPath); + + var analysis = FFProbe.Analyse(outputPath); + Assert.AreEqual(input.PrimaryVideoStream!.Width, analysis.PrimaryVideoStream!.Width); + Assert.AreEqual(input.PrimaryVideoStream.Height, analysis.PrimaryVideoStream!.Height); + Assert.AreEqual("webp", analysis.PrimaryVideoStream!.CodecName); + } + + [TestMethod, Timeout(BaseTimeoutMilliseconds)] + public void Video_Snapshot_Exception_PersistSnapshot() + { + using var outputPath = new TemporaryFile("out.asd"); + + try + { + FFMpeg.Snapshot(TestResources.Mp4Video, outputPath); + } + catch (Exception ex) + { + Assert.IsTrue(ex is ArgumentException); + } + } + [TestMethod, Timeout(BaseTimeoutMilliseconds)] public void Video_Snapshot_Rotated_PersistSnapshot() { diff --git a/FFMpegCore/FFMpeg/Enums/Enums.cs b/FFMpegCore/FFMpeg/Enums/Enums.cs index 1f00203..d777ecb 100644 --- a/FFMpegCore/FFMpeg/Enums/Enums.cs +++ b/FFMpegCore/FFMpeg/Enums/Enums.cs @@ -15,9 +15,33 @@ public static Codec LibX265 => FFMpeg.GetCodec("libx265"); public static Codec LibVpx => FFMpeg.GetCodec("libvpx"); public static Codec LibTheora => FFMpeg.GetCodec("libtheora"); - public static Codec Png => FFMpeg.GetCodec("png"); public static Codec MpegTs => FFMpeg.GetCodec("mpegts"); public static Codec LibaomAv1 => FFMpeg.GetCodec("libaom-av1"); + + public static class Image + { + public static Codec Png => FFMpeg.GetCodec("png"); + public static Codec Jpg => FFMpeg.GetCodec("mjpeg"); + public static Codec Bmp => FFMpeg.GetCodec("bmp"); + public static Codec Webp => FFMpeg.GetCodec("webp"); + + public static Codec GetByExtension(string path) + { + var ext = Path.GetExtension(path); + switch (ext) + { + case FileExtension.Image.Png: + return Png; + case FileExtension.Image.Jpg: + return Jpg; + case FileExtension.Image.Bmp: + return Bmp; + case FileExtension.Image.Webp: + return Webp; + default: throw new NotSupportedException($"Unsupported image extension: {ext}"); + } + } + } } public static class AudioCodec diff --git a/FFMpegCore/FFMpeg/Enums/FileExtension.cs b/FFMpegCore/FFMpeg/Enums/FileExtension.cs index f3067ba..386ef33 100644 --- a/FFMpegCore/FFMpeg/Enums/FileExtension.cs +++ b/FFMpegCore/FFMpeg/Enums/FileExtension.cs @@ -10,7 +10,10 @@ "libxvpx" => WebM, "libxtheora" => Ogv, "mpegts" => Ts, - "png" => Png, + "png" => Image.Png, + "jpg" => Image.Jpg, + "bmp" => Image.Bmp, + "webp" => Image.Webp, _ => throw new Exception("The extension for this video type is not defined.") }; } @@ -18,8 +21,16 @@ public static readonly string Ts = VideoType.MpegTs.Extension; public static readonly string Ogv = VideoType.Ogv.Extension; public static readonly string WebM = VideoType.WebM.Extension; - public static readonly string Png = ".png"; public static readonly string Mp3 = ".mp3"; public static readonly string Gif = ".gif"; + + public static class Image + { + public const string Png = ".png"; + public const string Jpg = ".jpg"; + public const string Bmp = ".bmp"; + public const string Webp = ".webp"; + public static readonly List All = [Png, Jpg, Bmp, Webp]; + } } } diff --git a/FFMpegCore/FFMpeg/FFMpeg.cs b/FFMpegCore/FFMpeg/FFMpeg.cs index 820d9fb..beb815c 100644 --- a/FFMpegCore/FFMpeg/FFMpeg.cs +++ b/FFMpegCore/FFMpeg/FFMpeg.cs @@ -20,16 +20,11 @@ namespace FFMpegCore /// Bitmap with the requested snapshot. public static bool Snapshot(string input, string output, Size? size = null, TimeSpan? captureTime = null, int? streamIndex = null, int inputFileIndex = 0) { - if (Path.GetExtension(output) != FileExtension.Png) - { - output = Path.Combine(Path.GetDirectoryName(output), Path.GetFileNameWithoutExtension(output) + FileExtension.Png); - } + CheckSnapshotOutputExtension(ref output); var source = FFProbe.Analyse(input); - var (arguments, outputOptions) = SnapshotArgumentBuilder.BuildSnapshotArguments(input, source, size, captureTime, streamIndex, inputFileIndex); - return arguments - .OutputToFile(output, true, outputOptions) + return SnapshotProcess(input, output, source, size, captureTime, streamIndex, inputFileIndex) .ProcessSynchronously(); } /// @@ -44,24 +39,37 @@ namespace FFMpegCore /// Bitmap with the requested snapshot. public static async Task SnapshotAsync(string input, string output, Size? size = null, TimeSpan? captureTime = null, int? streamIndex = null, int inputFileIndex = 0) { - if (Path.GetExtension(output) != FileExtension.Png) - { - output = Path.Combine(Path.GetDirectoryName(output), Path.GetFileNameWithoutExtension(output) + FileExtension.Png); - } + CheckSnapshotOutputExtension(ref output); var source = await FFProbe.AnalyseAsync(input).ConfigureAwait(false); - var (arguments, outputOptions) = SnapshotArgumentBuilder.BuildSnapshotArguments(input, source, size, captureTime, streamIndex, inputFileIndex); - return await arguments - .OutputToFile(output, true, outputOptions) + return await SnapshotProcess(input, output, source, size, captureTime, streamIndex, inputFileIndex) .ProcessAsynchronously(); } + private static FFMpegArgumentProcessor SnapshotProcess(string input, string output, IMediaAnalysis source, Size? size = null, TimeSpan? captureTime = null, int? streamIndex = null, int inputFileIndex = 0) + { + var (arguments, outputOptions) = SnapshotArgumentBuilder.BuildSnapshotArguments(input, output, source, size, captureTime, streamIndex, inputFileIndex); + + return arguments + .OutputToFile(output, true, outputOptions); + } + + private static void CheckSnapshotOutputExtension(ref string output) + { + if (!FileExtension.Image.All.Contains(Path.GetExtension(output).ToLower())) + { + throw new ArgumentException( + $"Invalid snapshot output extension: {output}, needed: {string.Join(",", FileExtension.Image.All)}"); + } + } + public static bool GifSnapshot(string input, string output, Size? size = null, TimeSpan? captureTime = null, TimeSpan? duration = null, int? streamIndex = null) { if (Path.GetExtension(output)?.ToLower() != FileExtension.Gif) { - output = Path.Combine(Path.GetDirectoryName(output), Path.GetFileNameWithoutExtension(output) + FileExtension.Gif); + throw new ArgumentException( + $"Invalid snapshot output extension: {output}, needed: {FileExtension.Gif}"); } var source = FFProbe.Analyse(input); diff --git a/FFMpegCore/FFMpeg/SnapshotArgumentBuilder.cs b/FFMpegCore/FFMpeg/SnapshotArgumentBuilder.cs index 7d83183..3204bcc 100644 --- a/FFMpegCore/FFMpeg/SnapshotArgumentBuilder.cs +++ b/FFMpegCore/FFMpeg/SnapshotArgumentBuilder.cs @@ -9,6 +9,30 @@ public static class SnapshotArgumentBuilder { public static (FFMpegArguments, Action outputOptions) BuildSnapshotArguments( string input, + string output, + IMediaAnalysis source, + Size? size = null, + TimeSpan? captureTime = null, + int? streamIndex = null, + int inputFileIndex = 0) + { + return BuildSnapshotArguments(input, VideoCodec.Image.GetByExtension(output), source, size, captureTime, streamIndex, inputFileIndex); + } + + public static (FFMpegArguments, Action outputOptions) BuildSnapshotArguments( + string input, + IMediaAnalysis source, + Size? size = null, + TimeSpan? captureTime = null, + int? streamIndex = null, + int inputFileIndex = 0) + { + return BuildSnapshotArguments(input, VideoCodec.Image.Png, source, size, captureTime, streamIndex, inputFileIndex); + } + + private static (FFMpegArguments, Action outputOptions) BuildSnapshotArguments( + string input, + Codec codec, IMediaAnalysis source, Size? size = null, TimeSpan? captureTime = null, @@ -26,7 +50,7 @@ public static class SnapshotArgumentBuilder .Seek(captureTime)), options => options .SelectStream((int)streamIndex, inputFileIndex) - .WithVideoCodec(VideoCodec.Png) + .WithVideoCodec(codec) .WithFrameOutputCount(1) .Resize(size)); } From 4025b82fbfe6dc5e47d7680975ffa5b83cc48705 Mon Sep 17 00:00:00 2001 From: Victor Horobchuk Date: Thu, 17 Apr 2025 13:02:27 +0300 Subject: [PATCH 29/43] FIX: small moments --- FFMpegCore/FFMpeg/FFMpeg.cs | 63 +++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/FFMpegCore/FFMpeg/FFMpeg.cs b/FFMpegCore/FFMpeg/FFMpeg.cs index beb815c..cc9f94a 100644 --- a/FFMpegCore/FFMpeg/FFMpeg.cs +++ b/FFMpegCore/FFMpeg/FFMpeg.cs @@ -20,7 +20,7 @@ namespace FFMpegCore /// Bitmap with the requested snapshot. public static bool Snapshot(string input, string output, Size? size = null, TimeSpan? captureTime = null, int? streamIndex = null, int inputFileIndex = 0) { - CheckSnapshotOutputExtension(ref output); + CheckSnapshotOutputExtension(output, FileExtension.Image.All); var source = FFProbe.Analyse(input); @@ -39,7 +39,7 @@ namespace FFMpegCore /// Bitmap with the requested snapshot. public static async Task SnapshotAsync(string input, string output, Size? size = null, TimeSpan? captureTime = null, int? streamIndex = null, int inputFileIndex = 0) { - CheckSnapshotOutputExtension(ref output); + CheckSnapshotOutputExtension(output, FileExtension.Image.All); var source = await FFProbe.AnalyseAsync(input).ConfigureAwait(false); @@ -47,52 +47,47 @@ namespace FFMpegCore .ProcessAsynchronously(); } - private static FFMpegArgumentProcessor SnapshotProcess(string input, string output, IMediaAnalysis source, Size? size = null, TimeSpan? captureTime = null, int? streamIndex = null, int inputFileIndex = 0) - { - var (arguments, outputOptions) = SnapshotArgumentBuilder.BuildSnapshotArguments(input, output, source, size, captureTime, streamIndex, inputFileIndex); - - return arguments - .OutputToFile(output, true, outputOptions); - } - - private static void CheckSnapshotOutputExtension(ref string output) - { - if (!FileExtension.Image.All.Contains(Path.GetExtension(output).ToLower())) - { - throw new ArgumentException( - $"Invalid snapshot output extension: {output}, needed: {string.Join(",", FileExtension.Image.All)}"); - } - } - public static bool GifSnapshot(string input, string output, Size? size = null, TimeSpan? captureTime = null, TimeSpan? duration = null, int? streamIndex = null) { - if (Path.GetExtension(output)?.ToLower() != FileExtension.Gif) - { - throw new ArgumentException( - $"Invalid snapshot output extension: {output}, needed: {FileExtension.Gif}"); - } + CheckSnapshotOutputExtension(output, [FileExtension.Gif]); var source = FFProbe.Analyse(input); - var (arguments, outputOptions) = SnapshotArgumentBuilder.BuildGifSnapshotArguments(input, source, size, captureTime, duration, streamIndex); - return arguments - .OutputToFile(output, true, outputOptions) + return GifSnapshotProcess(input, output, source, size, captureTime, duration, streamIndex) .ProcessSynchronously(); } public static async Task GifSnapshotAsync(string input, string output, Size? size = null, TimeSpan? captureTime = null, TimeSpan? duration = null, int? streamIndex = null) { - if (Path.GetExtension(output)?.ToLower() != FileExtension.Gif) - { - output = Path.Combine(Path.GetDirectoryName(output), Path.GetFileNameWithoutExtension(output) + FileExtension.Gif); - } + CheckSnapshotOutputExtension(output, [FileExtension.Gif]); var source = await FFProbe.AnalyseAsync(input).ConfigureAwait(false); + + return await GifSnapshotProcess(input, output, source, size, captureTime, duration, streamIndex) + .ProcessAsynchronously(); + } + + private static FFMpegArgumentProcessor SnapshotProcess(string input, string output, IMediaAnalysis source, Size? size = null, TimeSpan? captureTime = null, int? streamIndex = null, int inputFileIndex = 0) + { + var (arguments, outputOptions) = SnapshotArgumentBuilder.BuildSnapshotArguments(input, output, source, size, captureTime, streamIndex, inputFileIndex); + + return arguments.OutputToFile(output, true, outputOptions); + } + + private static FFMpegArgumentProcessor GifSnapshotProcess(string input, string output, IMediaAnalysis source, Size? size = null, TimeSpan? captureTime = null, TimeSpan? duration = null, int? streamIndex = null) + { var (arguments, outputOptions) = SnapshotArgumentBuilder.BuildGifSnapshotArguments(input, source, size, captureTime, duration, streamIndex); - return await arguments - .OutputToFile(output, true, outputOptions) - .ProcessAsynchronously(); + return arguments.OutputToFile(output, true, outputOptions); + } + + private static void CheckSnapshotOutputExtension(string output, List extensions) + { + if (!extensions.Contains(Path.GetExtension(output).ToLower())) + { + throw new ArgumentException( + $"Invalid snapshot output extension: {output}, needed: {string.Join(",", FileExtension.Image.All)}"); + } } /// From 3d21599c5d420a812317b92f6cc8fb63382eebc7 Mon Sep 17 00:00:00 2001 From: Victor Horobchuk Date: Thu, 17 Apr 2025 13:17:52 +0300 Subject: [PATCH 30/43] FIX: for dotnet format --- FFMpegCore/FFMpeg/Arguments/IDynamicArgument.cs | 2 +- FFMpegCore/FFMpeg/Arguments/VideoFiltersArgument.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FFMpegCore/FFMpeg/Arguments/IDynamicArgument.cs b/FFMpegCore/FFMpeg/Arguments/IDynamicArgument.cs index d44d18d..c7b6b56 100644 --- a/FFMpegCore/FFMpeg/Arguments/IDynamicArgument.cs +++ b/FFMpegCore/FFMpeg/Arguments/IDynamicArgument.cs @@ -8,6 +8,6 @@ /// /// //public string GetText(StringBuilder context); - public string GetText(IEnumerable context); + string GetText(IEnumerable context); } } diff --git a/FFMpegCore/FFMpeg/Arguments/VideoFiltersArgument.cs b/FFMpegCore/FFMpeg/Arguments/VideoFiltersArgument.cs index f7a9e4a..4a43c9d 100644 --- a/FFMpegCore/FFMpeg/Arguments/VideoFiltersArgument.cs +++ b/FFMpegCore/FFMpeg/Arguments/VideoFiltersArgument.cs @@ -36,8 +36,8 @@ namespace FFMpegCore.Arguments public interface IVideoFilterArgument { - public string Key { get; } - public string Value { get; } + string Key { get; } + string Value { get; } } public class VideoFilterOptions From bbfcfaefac82cf822f8bc8dfcdccc12cbef501bb Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Mon, 21 Jul 2025 17:08:22 +0800 Subject: [PATCH 31/43] docs: update nuget badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 33f7ddf..4b4a2b2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # [FFMpegCore](https://www.nuget.org/packages/FFMpegCore/) -[![NuGet Badge](https://buildstats.info/nuget/FFMpegCore)](https://www.nuget.org/packages/FFMpegCore/) +[![NuGet Version](https://img.shields.io/nuget/v/FFMpegCore)](https://www.nuget.org/packages/FFMpegCore/) [![GitHub issues](https://img.shields.io/github/issues/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/issues) [![GitHub stars](https://img.shields.io/github/stars/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/stargazers) [![GitHub](https://img.shields.io/github/license/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/blob/master/LICENSE) From abb9f15eeb7cb793b39fed5f9916b0613239ec07 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:19:05 +0200 Subject: [PATCH 32/43] Use brew if running on arm64 macos --- .github/workflows/ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5193d2a..02bf305 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-latest, ubuntu-latest, macos-13] + os: [windows-latest, ubuntu-latest, macos-latest] timeout-minutes: 7 steps: @@ -32,12 +32,15 @@ jobs: - name: Lint with dotnet run: dotnet format FFMpegCore.sln --severity warn --verify-no-changes - - - name: Prepare FFMpeg + + - if: runner.os != 'macOS' || runner.arch != 'ARM64' uses: FedericoCarboni/setup-ffmpeg@v3 with: ffmpeg-version: 6.0.1 - github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ github.server_url == 'https://github.com' && github.token || '' }} + + - if: runner.os == 'macOS' && runner.arch == 'ARM64' + run: brew install ffmpeg@6 - name: Test with dotnet run: dotnet test FFMpegCore.sln --collect "XPlat Code Coverage" --logger GitHubActions From 918ca9a9aba356ee6ed7b3a425138e38c4106619 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:22:09 +0200 Subject: [PATCH 33/43] Remove accessibility modifiers on interface properties (IDE0040) --- FFMpegCore/FFMpeg/Arguments/IDynamicArgument.cs | 2 +- FFMpegCore/FFMpeg/Arguments/VideoFiltersArgument.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FFMpegCore/FFMpeg/Arguments/IDynamicArgument.cs b/FFMpegCore/FFMpeg/Arguments/IDynamicArgument.cs index d44d18d..c7b6b56 100644 --- a/FFMpegCore/FFMpeg/Arguments/IDynamicArgument.cs +++ b/FFMpegCore/FFMpeg/Arguments/IDynamicArgument.cs @@ -8,6 +8,6 @@ /// /// //public string GetText(StringBuilder context); - public string GetText(IEnumerable context); + string GetText(IEnumerable context); } } diff --git a/FFMpegCore/FFMpeg/Arguments/VideoFiltersArgument.cs b/FFMpegCore/FFMpeg/Arguments/VideoFiltersArgument.cs index f7a9e4a..4a43c9d 100644 --- a/FFMpegCore/FFMpeg/Arguments/VideoFiltersArgument.cs +++ b/FFMpegCore/FFMpeg/Arguments/VideoFiltersArgument.cs @@ -36,8 +36,8 @@ namespace FFMpegCore.Arguments public interface IVideoFilterArgument { - public string Key { get; } - public string Value { get; } + string Key { get; } + string Value { get; } } public class VideoFilterOptions From 5d8d346598325baaa7f104be38a5cf3c300a545d Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:32:11 +0200 Subject: [PATCH 34/43] Only lint on ubuntu-latest to not waste time --- .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 02bf305..5d9b911 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,8 @@ jobs: with: dotnet-version: '8.0.x' - - name: Lint with dotnet + - if: runner.os == 'ubuntu-latest' + name: Lint with dotnet run: dotnet format FFMpegCore.sln --severity warn --verify-no-changes - if: runner.os != 'macOS' || runner.arch != 'ARM64' From 9c636d405959b7c7dd8f06204790936f9895ef97 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:32:23 +0200 Subject: [PATCH 35/43] Migrate to AnimMouse/setup-ffmpeg@v1 --- .github/workflows/ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d9b911..5b7800c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,13 +35,14 @@ jobs: run: dotnet format FFMpegCore.sln --severity warn --verify-no-changes - if: runner.os != 'macOS' || runner.arch != 'ARM64' - uses: FedericoCarboni/setup-ffmpeg@v3 + uses: AnimMouse/setup-ffmpeg@v1 with: - ffmpeg-version: 6.0.1 - github-token: ${{ github.server_url == 'https://github.com' && github.token || '' }} + version: 7.1.1 - if: runner.os == 'macOS' && runner.arch == 'ARM64' - run: brew install ffmpeg@6 + uses: AnimMouse/setup-ffmpeg@v1 + with: + version: 711 - name: Test with dotnet run: dotnet test FFMpegCore.sln --collect "XPlat Code Coverage" --logger GitHubActions From af6587d8fedc70f236ac10040d3061eec82ce033 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:37:04 +0200 Subject: [PATCH 36/43] Reference workflow action by reference --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b7800c..f264455 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,12 +35,12 @@ jobs: run: dotnet format FFMpegCore.sln --severity warn --verify-no-changes - if: runner.os != 'macOS' || runner.arch != 'ARM64' - uses: AnimMouse/setup-ffmpeg@v1 + uses: AnimMouse/setup-ffmpeg@ae28d57 # 1.1.0 with: version: 7.1.1 - if: runner.os == 'macOS' && runner.arch == 'ARM64' - uses: AnimMouse/setup-ffmpeg@v1 + uses: AnimMouse/setup-ffmpeg@ae28d57 # 1.1.0 with: version: 711 From 99181e9f656283da6f0f1792af769ebbb8ebb606 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:37:27 +0200 Subject: [PATCH 37/43] Include github token to avoid rate limiting --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f264455..4803498 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,7 @@ jobs: uses: AnimMouse/setup-ffmpeg@ae28d57 # 1.1.0 with: version: 7.1.1 + token: ${{ github.token }} - if: runner.os == 'macOS' && runner.arch == 'ARM64' uses: AnimMouse/setup-ffmpeg@ae28d57 # 1.1.0 From fb10b78e35b6dedbb3a16cdeb6a23898893ba64f Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:37:42 +0200 Subject: [PATCH 38/43] Include github token to avoid rate limiting --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4803498..9800c70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,7 @@ jobs: uses: AnimMouse/setup-ffmpeg@ae28d57 # 1.1.0 with: version: 711 + token: ${{ github.token }} - name: Test with dotnet run: dotnet test FFMpegCore.sln --collect "XPlat Code Coverage" --logger GitHubActions From 665c9f9213b5c6be114ad6bc7234d48541e1bf3a Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:39:51 +0200 Subject: [PATCH 39/43] Use full reference --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9800c70..2cfa388 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,13 +35,13 @@ jobs: run: dotnet format FFMpegCore.sln --severity warn --verify-no-changes - if: runner.os != 'macOS' || runner.arch != 'ARM64' - uses: AnimMouse/setup-ffmpeg@ae28d57 # 1.1.0 + uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae # 1.1.0 with: version: 7.1.1 token: ${{ github.token }} - if: runner.os == 'macOS' && runner.arch == 'ARM64' - uses: AnimMouse/setup-ffmpeg@ae28d57 # 1.1.0 + uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae # 1.1.0 with: version: 711 token: ${{ github.token }} From 5ba8122d00c1963e59d66427b680f1f4be819be3 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:41:34 +0200 Subject: [PATCH 40/43] Fix specified ffmpeg version --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cfa388..bb1ac79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,13 +34,13 @@ jobs: name: Lint with dotnet run: dotnet format FFMpegCore.sln --severity warn --verify-no-changes - - if: runner.os != 'macOS' || runner.arch != 'ARM64' + - if: runner.os != 'macOS' uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae # 1.1.0 with: - version: 7.1.1 + version: 7.1 token: ${{ github.token }} - - if: runner.os == 'macOS' && runner.arch == 'ARM64' + - if: runner.os == 'macOS' uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae # 1.1.0 with: version: 711 From 7036ad6df21b83fa6c67ad382b00556ca5d61237 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:47:53 +0200 Subject: [PATCH 41/43] Switch on matrix.os instead of runner.os --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb1ac79..53dcfee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,17 +30,17 @@ jobs: with: dotnet-version: '8.0.x' - - if: runner.os == 'ubuntu-latest' + - if: matrix.os == 'ubuntu-latest' name: Lint with dotnet run: dotnet format FFMpegCore.sln --severity warn --verify-no-changes - - if: runner.os != 'macOS' + - if: matrix.os != 'macos-latest' uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae # 1.1.0 with: version: 7.1 token: ${{ github.token }} - - if: runner.os == 'macOS' + - if: matrix.os == 'macos-latest' uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae # 1.1.0 with: version: 711 From 91c162921509da639a97572bdd5f450070b36110 Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:53:09 +0200 Subject: [PATCH 42/43] Add name labels to ffmpeg install steps --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53dcfee..c0be332 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,12 +35,14 @@ jobs: run: dotnet format FFMpegCore.sln --severity warn --verify-no-changes - if: matrix.os != 'macos-latest' + name: Setup FFmpeg (non-macOS) uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae # 1.1.0 with: version: 7.1 token: ${{ github.token }} - if: matrix.os == 'macos-latest' + name: Setup FFmpeg (macOS) uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae # 1.1.0 with: version: 711 From 7e135a78d327a70be60f96850bf3b55db52b1dbc Mon Sep 17 00:00:00 2001 From: Malte Rosenbjerg Date: Thu, 16 Oct 2025 09:55:50 +0200 Subject: [PATCH 43/43] Use install step for installing ffmpeg --- .github/workflows/ci.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0be332..0da1b83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,19 +33,11 @@ jobs: - if: matrix.os == 'ubuntu-latest' name: Lint with dotnet run: dotnet format FFMpegCore.sln --severity warn --verify-no-changes - - - if: matrix.os != 'macos-latest' - name: Setup FFmpeg (non-macOS) + + - name: Setup FFmpeg uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae # 1.1.0 with: - version: 7.1 - token: ${{ github.token }} - - - if: matrix.os == 'macos-latest' - name: Setup FFmpeg (macOS) - uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae # 1.1.0 - with: - version: 711 + version: ${{ matrix.os != 'macos-latest' && '7.1' || '711' }} token: ${{ github.token }} - name: Test with dotnet