From 9007883d762de97391db8f062711dd1513b924bc Mon Sep 17 00:00:00 2001 From: Benedikt Bertsch <38132773+BenediktBertsch@users.noreply.github.com> Date: Sat, 8 Jun 2024 14:58:18 +0200 Subject: [PATCH 1/5] Feat: add av1 support for smaller snapshots and videos --- FFMpegCore/FFMpeg/Enums/Enums.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/FFMpegCore/FFMpeg/Enums/Enums.cs b/FFMpegCore/FFMpeg/Enums/Enums.cs index 4974b44..cd4486b 100644 --- a/FFMpegCore/FFMpeg/Enums/Enums.cs +++ b/FFMpegCore/FFMpeg/Enums/Enums.cs @@ -17,6 +17,7 @@ public static class VideoCodec 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 AudioCodec From 06b966799160b2ffe863c83e083fef0e955897e1 Mon Sep 17 00:00:00 2001 From: Ashish <156739271+alahane-techtel@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:18:34 +1000 Subject: [PATCH 2/5] >24hr Duration handling added in FFMpegArgumentProcessor --- FFMpegCore.Test/FFProbeTests.cs | 2 ++ FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/FFMpegCore.Test/FFProbeTests.cs b/FFMpegCore.Test/FFProbeTests.cs index a507078..bb7aec8 100644 --- a/FFMpegCore.Test/FFProbeTests.cs +++ b/FFMpegCore.Test/FFProbeTests.cs @@ -80,6 +80,8 @@ public void PacketAnalysisAudioVideo_Sync() [DataRow("05:12:59.177", 0, 5, 12, 59, 177)] [DataRow("149:07:50.911750", 6, 5, 7, 50, 911)] [DataRow("00:00:00.83", 0, 0, 0, 0, 830)] + [DataRow("24:00:00.83", 1, 0, 0, 0, 830)] + [DataRow("240:00:00.83", 10, 0, 0, 0, 830)] public void MediaAnalysis_ParseDuration(string duration, int expectedDays, int expectedHours, int expectedMinutes, int expectedSeconds, int expectedMilliseconds) { var ffprobeStream = new FFProbeStream { Duration = duration }; diff --git a/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs b/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs index 27237d8..4382fcb 100644 --- a/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs +++ b/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs @@ -263,7 +263,7 @@ private void ErrorData(object sender, string msg) return; } - var processed = TimeSpan.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture); + var processed = MediaAnalysisUtils.ParseDuration(match.Groups[1].Value); _onTimeProgress?.Invoke(processed); if (_onPercentageProgress == null || _totalTimespan == null) From 745fe2a8ccfe67e06effda951c7de8ef50eb4fed Mon Sep 17 00:00:00 2001 From: Ashish <156739271+alahane-techtel@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:24:06 +1000 Subject: [PATCH 3/5] removed unnecessary usings --- FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs b/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs index 4382fcb..3a58704 100644 --- a/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs +++ b/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using System.Globalization; using System.Text.RegularExpressions; using FFMpegCore.Enums; using FFMpegCore.Exceptions; From 8d7d37a30814ed29c0a2b44caa6b2293f81b0597 Mon Sep 17 00:00:00 2001 From: Ashish <156739271+alahane-techtel@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:26:00 +1000 Subject: [PATCH 4/5] removed unnecessary tests --- FFMpegCore.Test/FFProbeTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/FFMpegCore.Test/FFProbeTests.cs b/FFMpegCore.Test/FFProbeTests.cs index bb7aec8..a507078 100644 --- a/FFMpegCore.Test/FFProbeTests.cs +++ b/FFMpegCore.Test/FFProbeTests.cs @@ -80,8 +80,6 @@ public void PacketAnalysisAudioVideo_Sync() [DataRow("05:12:59.177", 0, 5, 12, 59, 177)] [DataRow("149:07:50.911750", 6, 5, 7, 50, 911)] [DataRow("00:00:00.83", 0, 0, 0, 0, 830)] - [DataRow("24:00:00.83", 1, 0, 0, 0, 830)] - [DataRow("240:00:00.83", 10, 0, 0, 0, 830)] public void MediaAnalysis_ParseDuration(string duration, int expectedDays, int expectedHours, int expectedMinutes, int expectedSeconds, int expectedMilliseconds) { var ffprobeStream = new FFProbeStream { Duration = duration }; From f86d9990351071c93b5711902bf3df981b74d4a6 Mon Sep 17 00:00:00 2001 From: Kaaybi Date: Wed, 18 Sep 2024 12:08:16 +0200 Subject: [PATCH 5/5] feat: add video-stream level to ffprobe analysis --- FFMpegCore.Test/FFProbeTests.cs | 1 + FFMpegCore/FFProbe/FFProbeAnalysis.cs | 3 +++ FFMpegCore/FFProbe/MediaAnalysis.cs | 1 + FFMpegCore/FFProbe/VideoStream.cs | 1 + 4 files changed, 6 insertions(+) diff --git a/FFMpegCore.Test/FFProbeTests.cs b/FFMpegCore.Test/FFProbeTests.cs index a507078..99f6ac2 100644 --- a/FFMpegCore.Test/FFProbeTests.cs +++ b/FFMpegCore.Test/FFProbeTests.cs @@ -123,6 +123,7 @@ public void Probe_Success() Assert.AreEqual(1, info.PrimaryVideoStream.SampleAspectRatio.Width); Assert.AreEqual(1, info.PrimaryVideoStream.SampleAspectRatio.Height); Assert.AreEqual("yuv420p", info.PrimaryVideoStream.PixelFormat); + Assert.AreEqual(31, info.PrimaryVideoStream.Level); Assert.AreEqual(1280, info.PrimaryVideoStream.Width); Assert.AreEqual(720, info.PrimaryVideoStream.Height); Assert.AreEqual(25, info.PrimaryVideoStream.AvgFrameRate); diff --git a/FFMpegCore/FFProbe/FFProbeAnalysis.cs b/FFMpegCore/FFProbe/FFProbeAnalysis.cs index e88f461..de3134a 100644 --- a/FFMpegCore/FFProbe/FFProbeAnalysis.cs +++ b/FFMpegCore/FFProbe/FFProbeAnalysis.cs @@ -83,6 +83,9 @@ public class FFProbeStream : ITagsContainer, IDispositionContainer [JsonPropertyName("pix_fmt")] public string PixelFormat { get; set; } = null!; + [JsonPropertyName("level")] + public int Level { get; set; } + [JsonPropertyName("sample_rate")] public string SampleRate { get; set; } = null!; diff --git a/FFMpegCore/FFProbe/MediaAnalysis.cs b/FFMpegCore/FFProbe/MediaAnalysis.cs index 887baeb..b8cf732 100644 --- a/FFMpegCore/FFProbe/MediaAnalysis.cs +++ b/FFMpegCore/FFProbe/MediaAnalysis.cs @@ -87,6 +87,7 @@ private VideoStream ParseVideoStream(FFProbeStream stream) Width = stream.Width ?? 0, Profile = stream.Profile, PixelFormat = stream.PixelFormat, + Level = stream.Level, Rotation = MediaAnalysisUtils.ParseRotation(stream), Language = stream.GetLanguage(), Disposition = MediaAnalysisUtils.FormatDisposition(stream.Disposition), diff --git a/FFMpegCore/FFProbe/VideoStream.cs b/FFMpegCore/FFProbe/VideoStream.cs index b41bb62..6d8cda1 100644 --- a/FFMpegCore/FFProbe/VideoStream.cs +++ b/FFMpegCore/FFProbe/VideoStream.cs @@ -13,6 +13,7 @@ public class VideoStream : MediaStream public int Height { get; set; } public double FrameRate { get; set; } public string PixelFormat { get; set; } = null!; + public int Level { get; set; } public int Rotation { get; set; } public double AverageFrameRate { get; set; }