From 69b01c91c61cf1878ca5f5e99b3056266a456adb Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Wed, 17 May 2023 11:40:20 +1200 Subject: [PATCH 1/3] Add CopyCodecArgument --- FFMpegCore/FFMpeg/Arguments/CopyCodecArgument.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 FFMpegCore/FFMpeg/Arguments/CopyCodecArgument.cs diff --git a/FFMpegCore/FFMpeg/Arguments/CopyCodecArgument.cs b/FFMpegCore/FFMpeg/Arguments/CopyCodecArgument.cs new file mode 100644 index 0000000..8ea3484 --- /dev/null +++ b/FFMpegCore/FFMpeg/Arguments/CopyCodecArgument.cs @@ -0,0 +1,10 @@ +namespace FFMpegCore.Arguments +{ + /// + /// Represents a copy codec parameter + /// + public class CopyCodecArgument : IArgument + { + public string Text => $"-codec copy"; + } +} From 643952db7bf11e611e7e50c786fc105813fa02e3 Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Wed, 17 May 2023 11:40:40 +1200 Subject: [PATCH 2/3] Add "WithCopyCodec" option --- FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs b/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs index 4930b52..6a6586c 100644 --- a/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs +++ b/FFMpegCore/FFMpeg/FFMpegArgumentOptions.cs @@ -77,6 +77,7 @@ public FFMpegArgumentOptions DeselectStreams(IEnumerable streamIndices, int public FFMpegArgumentOptions WithAudibleActivationBytes(string activationBytes) => WithArgument(new AudibleEncryptionKeyArgument(activationBytes)); public FFMpegArgumentOptions WithTagVersion(int id3v2Version = 3) => WithArgument(new ID3V2VersionArgument(id3v2Version)); public FFMpegArgumentOptions WithGifPaletteArgument(int streamIndex, Size? size, int fps = 12) => WithArgument(new GifPaletteArgument(streamIndex, fps, size)); + public FFMpegArgumentOptions WithCopyCodec() => WithArgument(new CopyCodecArgument()); public FFMpegArgumentOptions WithArgument(IArgument argument) { From 6c2311c86904a87339dc542160ae6b5ece18b24c Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Wed, 17 May 2023 11:41:13 +1200 Subject: [PATCH 3/3] Update "SaveM3U8Stream" method to use "WithCopyCodec" option --- FFMpegCore/FFMpeg/FFMpeg.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FFMpegCore/FFMpeg/FFMpeg.cs b/FFMpegCore/FFMpeg/FFMpeg.cs index a8de12b..820d9fb 100644 --- a/FFMpegCore/FFMpeg/FFMpeg.cs +++ b/FFMpegCore/FFMpeg/FFMpeg.cs @@ -333,7 +333,10 @@ public static bool SaveM3U8Stream(Uri uri, string output) } return FFMpegArguments - .FromUrlInput(uri) + .FromUrlInput(uri, options => + { + options.WithCopyCodec(); + }) .OutputToFile(output) .ProcessSynchronously(); }