Skip to content

Commit

Permalink
Merge branch 'main' into hagfjall/fix-509-snapshot-rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
rosenbjerg authored Dec 4, 2024
2 parents fe4b79e + cefc8ef commit 8636817
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions FFMpegCore.Test/FFMpegCore.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
<None Update="Resources\input_audio_only_10sec.mp4">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\input_hdr.mov">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\input_video_only_3sec.mp4">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
12 changes: 12 additions & 0 deletions FFMpegCore.Test/FFProbeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,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()
{
Expand Down
1 change: 1 addition & 0 deletions FFMpegCore.Test/Resources/TestResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public static class TestResources
public static readonly string Mp4VideoRotation = "./Resources/input_3sec_rotation_90deg.mp4";
public static readonly string Mp4VideoRotationNegative = "./Resources/input_3sec_rotation_negative_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";
Expand Down
Binary file added FFMpegCore.Test/Resources/input_hdr.mov
Binary file not shown.
12 changes: 12 additions & 0 deletions FFMpegCore/FFProbe/FFProbeAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ public class FFProbeStream : ITagsContainer, IDispositionContainer

[JsonPropertyName("side_data_list")]
public List<Dictionary<string, JsonValue>> 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
Expand Down
4 changes: 4 additions & 0 deletions FFMpegCore/FFProbe/MediaAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ private VideoStream ParseVideoStream(FFProbeStream stream)
Width = stream.Width ?? 0,
Profile = stream.Profile,
PixelFormat = stream.PixelFormat,
ColorRange = stream.ColorRange,
ColorSpace = stream.ColorSpace,
ColorTransfer = stream.ColorTransfer,
ColorPrimaries = stream.ColorPrimaries,
Rotation = MediaAnalysisUtils.ParseRotation(stream),
Language = stream.GetLanguage(),
Disposition = MediaAnalysisUtils.FormatDisposition(stream.Disposition),
Expand Down
4 changes: 4 additions & 0 deletions FFMpegCore/FFProbe/VideoStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class VideoStream : MediaStream
public string PixelFormat { get; set; } = null!;
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);
}
Expand Down

0 comments on commit 8636817

Please sign in to comment.