diff --git a/FFMpegCore.Test/FFMpegCore.Test.csproj b/FFMpegCore.Test/FFMpegCore.Test.csproj index 7c4b888..8562139 100644 --- a/FFMpegCore.Test/FFMpegCore.Test.csproj +++ b/FFMpegCore.Test/FFMpegCore.Test.csproj @@ -54,6 +54,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/FFMpegCore.Test/FFProbeTests.cs b/FFMpegCore.Test/FFProbeTests.cs index 99f6ac2..2458c1b 100644 --- a/FFMpegCore.Test/FFProbeTests.cs +++ b/FFMpegCore.Test/FFProbeTests.cs @@ -174,6 +174,18 @@ public async Task Probe_Success_FromStream_Async() Assert.AreEqual(3, info.Duration.Seconds); } + [TestMethod, Timeout(10000)] + public void Probe_HDR() + { + var info = FFProbe.Analyse(TestResources.HdrVideo); + + Assert.IsNotNull(info.PrimaryVideoStream); + Assert.AreEqual("tv", info.PrimaryVideoStream.ColorRange); + Assert.AreEqual("bt2020nc", info.PrimaryVideoStream.ColorSpace); + Assert.AreEqual("arib-std-b67", info.PrimaryVideoStream.ColorTransfer); + Assert.AreEqual("bt2020", info.PrimaryVideoStream.ColorPrimaries); + } + [TestMethod, Timeout(10000)] public async Task Probe_Success_Subtitle_Async() { diff --git a/FFMpegCore.Test/Resources/TestResources.cs b/FFMpegCore.Test/Resources/TestResources.cs index b958b80..280a051 100644 --- a/FFMpegCore.Test/Resources/TestResources.cs +++ b/FFMpegCore.Test/Resources/TestResources.cs @@ -5,6 +5,7 @@ public static class TestResources public static readonly string Mp4Video = "./Resources/input_3sec.mp4"; public static readonly string Mp4VideoRotation = "./Resources/input_3sec_rotation_90deg.mp4"; public static readonly string WebmVideo = "./Resources/input_3sec.webm"; + public static readonly string HdrVideo = "./Resources/input_hdr.mov"; public static readonly string Mp4WithoutVideo = "./Resources/input_audio_only_10sec.mp4"; public static readonly string Mp4WithoutAudio = "./Resources/input_video_only_3sec.mp4"; public static readonly string RawAudio = "./Resources/audio.raw"; diff --git a/FFMpegCore.Test/Resources/input_hdr.mov b/FFMpegCore.Test/Resources/input_hdr.mov new file mode 100644 index 0000000..3fdeea1 Binary files /dev/null and b/FFMpegCore.Test/Resources/input_hdr.mov differ diff --git a/FFMpegCore/FFProbe/FFProbeAnalysis.cs b/FFMpegCore/FFProbe/FFProbeAnalysis.cs index de3134a..9f8e880 100644 --- a/FFMpegCore/FFProbe/FFProbeAnalysis.cs +++ b/FFMpegCore/FFProbe/FFProbeAnalysis.cs @@ -97,6 +97,18 @@ public class FFProbeStream : ITagsContainer, IDispositionContainer [JsonPropertyName("side_data_list")] public List> SideData { get; set; } = null!; + + [JsonPropertyName("color_range")] + public string ColorRange { get; set; } = null!; + + [JsonPropertyName("color_space")] + public string ColorSpace { get; set; } = null!; + + [JsonPropertyName("color_transfer")] + public string ColorTransfer { get; set; } = null!; + + [JsonPropertyName("color_primaries")] + public string ColorPrimaries { get; set; } = null!; } public class Format : ITagsContainer diff --git a/FFMpegCore/FFProbe/MediaAnalysis.cs b/FFMpegCore/FFProbe/MediaAnalysis.cs index b8cf732..9976c05 100644 --- a/FFMpegCore/FFProbe/MediaAnalysis.cs +++ b/FFMpegCore/FFProbe/MediaAnalysis.cs @@ -88,6 +88,10 @@ private VideoStream ParseVideoStream(FFProbeStream stream) Profile = stream.Profile, PixelFormat = stream.PixelFormat, Level = stream.Level, + ColorRange = stream.ColorRange, + ColorSpace = stream.ColorSpace, + ColorTransfer = stream.ColorTransfer, + ColorPrimaries = stream.ColorPrimaries, 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 6d8cda1..377b2d0 100644 --- a/FFMpegCore/FFProbe/VideoStream.cs +++ b/FFMpegCore/FFProbe/VideoStream.cs @@ -16,6 +16,10 @@ public class VideoStream : MediaStream public int Level { get; set; } public int Rotation { get; set; } public double AverageFrameRate { get; set; } + public string ColorRange { get; set; } = null!; + public string ColorSpace { get; set; } = null!; + public string ColorTransfer { get; set; } = null!; + public string ColorPrimaries { get; set; } = null!; public PixelFormat GetPixelFormatInfo() => FFMpeg.GetPixelFormat(PixelFormat); }