Compare commits

..

12 commits

Author SHA1 Message Date
Malte Rosenbjerg
a3a3144aac Bump codecov/codecov-action and set CODECOV_TOKEN 2024-12-04 21:38:41 +02:00
Malte Rosenbjerg
cf8f7cc674 Call MoveNext before accessing Current 2024-12-04 21:29:37 +02:00
Malte Rosenbjerg
0cd4e076ff Bump test packages 2024-12-04 20:55:31 +02:00
Malte Rosenbjerg
d4dcf86a36 Use macos-13 runner 2024-12-04 20:51:12 +02:00
Malte Rosenbjerg
dc165f9eae Bump workflow actions 2024-12-04 20:48:59 +02:00
Malte Rosenbjerg
63fe3a6e3d Set ProduceReferenceAssembly to true 2024-12-04 20:46:29 +02:00
Malte Rosenbjerg
79ea2a9797 Bump System.Text.Json to 9.0.0 2024-12-04 20:44:05 +02:00
Malte Rosenbjerg
410e940b7e Use .NET 8 for Examples and Test 2024-12-04 20:43:47 +02:00
Malte Rosenbjerg
cf513aac0f Use .NET 8 in workflows 2024-12-04 20:43:32 +02:00
Malte Rosenbjerg
b1d908971c
Merge branch 'main' into bump-system-text-json-v8.0.4 2024-12-04 19:32:13 +01:00
Malte Rosenbjerg
cefc8efe95
Merge pull request #498 from Tomiscout/main
Add HDR color properties support in FFProbe analysis
2024-12-04 19:28:52 +01:00
Tomas Gužauskas
ef08fd93a9 Add HDR color properties support in FFProbe analysis
Add hdr video test
2024-01-30 00:52:25 +02:00
14 changed files with 59 additions and 20 deletions

View file

@ -22,23 +22,23 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [windows-latest, ubuntu-latest, macos-latest] os: [windows-latest, ubuntu-latest, macos-13]
timeout-minutes: 7 timeout-minutes: 7
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Prepare .NET - name: Prepare .NET
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v4
with: with:
dotnet-version: '7.0.x' dotnet-version: '8.0.x'
- name: Lint with dotnet - name: Lint with dotnet
run: dotnet format FFMpegCore.sln --severity warn --verify-no-changes run: dotnet format FFMpegCore.sln --severity warn --verify-no-changes
- name: Prepare FFMpeg - name: Prepare FFMpeg
uses: FedericoCarboni/setup-ffmpeg@v2 uses: FedericoCarboni/setup-ffmpeg@v3
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@ -47,7 +47,8 @@ jobs:
- if: matrix.os == 'windows-latest' - if: matrix.os == 'windows-latest'
name: Upload coverage reports to Codecov name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v5
with: with:
fail_ci_if_error: true
directory: FFMpegCore.Test/TestResults directory: FFMpegCore.Test/TestResults
fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }}

View file

@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Prepare .NET - name: Prepare .NET
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v4
with: with:
dotnet-version: '7.0.x' dotnet-version: '8.0.x'
- name: Build solution - name: Build solution
run: dotnet pack FFMpegCore.sln -c Release run: dotnet pack FFMpegCore.sln -c Release

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>

View file

@ -9,6 +9,7 @@
</PackageReleaseNotes> </PackageReleaseNotes>
<PackageTags>ffmpeg ffprobe convert video audio mediafile resize analyze muxing skiasharp</PackageTags> <PackageTags>ffmpeg ffprobe convert video audio mediafile resize analyze muxing skiasharp</PackageTags>
<Authors>Malte Rosenbjerg, Vlad Jerca, Max Bagryantsev, Dimitri Vranken</Authors> <Authors>Malte Rosenbjerg, Vlad Jerca, Max Bagryantsev, Dimitri Vranken</Authors>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -9,6 +9,7 @@
</PackageReleaseNotes> </PackageReleaseNotes>
<PackageTags>ffmpeg ffprobe convert video audio mediafile resize analyze muxing</PackageTags> <PackageTags>ffmpeg ffprobe convert video audio mediafile resize analyze muxing</PackageTags>
<Authors>Malte Rosenbjerg, Vlad Jerca, Max Bagryantsev</Authors> <Authors>Malte Rosenbjerg, Vlad Jerca, Max Bagryantsev</Authors>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -1,25 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<Nullable>disable</Nullable> <Nullable>disable</Nullable>
<LangVersion>default</LangVersion> <LangVersion>default</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0"> <PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="FluentAssertions" Version="6.12.0" /> <PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3"> <PackageReference Include="GitHubActionsTestLogger" Version="2.4.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" /> <PackageReference Include="MSTest.TestAdapter" Version="3.6.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" /> <PackageReference Include="MSTest.TestFramework" Version="3.6.4" />
<PackageReference Include="SkiaSharp" Version="2.88.6" /> <PackageReference Include="SkiaSharp" Version="2.88.6" />
</ItemGroup> </ItemGroup>
@ -54,6 +54,9 @@
<None Update="Resources\input_audio_only_10sec.mp4"> <None Update="Resources\input_audio_only_10sec.mp4">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Update="Resources\input_hdr.mov">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\input_video_only_3sec.mp4"> <None Update="Resources\input_video_only_3sec.mp4">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>

View file

@ -173,6 +173,18 @@ public async Task Probe_Success_FromStream_Async()
Assert.AreEqual(3, info.Duration.Seconds); 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)] [TestMethod, Timeout(10000)]
public async Task Probe_Success_Subtitle_Async() public async Task Probe_Success_Subtitle_Async()
{ {

View file

@ -5,6 +5,7 @@ public static class TestResources
public static readonly string Mp4Video = "./Resources/input_3sec.mp4"; public static readonly string Mp4Video = "./Resources/input_3sec.mp4";
public static readonly string Mp4VideoRotation = "./Resources/input_3sec_rotation_90deg.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 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 Mp4WithoutVideo = "./Resources/input_audio_only_10sec.mp4";
public static readonly string Mp4WithoutAudio = "./Resources/input_video_only_3sec.mp4"; public static readonly string Mp4WithoutAudio = "./Resources/input_video_only_3sec.mp4";
public static readonly string RawAudio = "./Resources/audio.raw"; public static readonly string RawAudio = "./Resources/audio.raw";

Binary file not shown.

View file

@ -27,7 +27,7 @@ public string GetStreamArguments()
public async Task WriteAsync(Stream outputStream, CancellationToken cancellationToken) public async Task WriteAsync(Stream outputStream, CancellationToken cancellationToken)
{ {
if (_sampleEnumerator.Current != null) if (_sampleEnumerator.MoveNext() && _sampleEnumerator.Current != null)
{ {
await _sampleEnumerator.Current.SerializeAsync(outputStream, cancellationToken).ConfigureAwait(false); await _sampleEnumerator.Current.SerializeAsync(outputStream, cancellationToken).ConfigureAwait(false);
} }

View file

@ -18,7 +18,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Instances" Version="3.0.0" /> <PackageReference Include="Instances" Version="3.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.4" /> <PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -94,6 +94,18 @@ public class FFProbeStream : ITagsContainer, IDispositionContainer
[JsonPropertyName("side_data_list")] [JsonPropertyName("side_data_list")]
public List<Dictionary<string, JsonValue>> SideData { get; set; } = null!; 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 public class Format : ITagsContainer

View file

@ -87,6 +87,10 @@ private VideoStream ParseVideoStream(FFProbeStream stream)
Width = stream.Width ?? 0, Width = stream.Width ?? 0,
Profile = stream.Profile, Profile = stream.Profile,
PixelFormat = stream.PixelFormat, PixelFormat = stream.PixelFormat,
ColorRange = stream.ColorRange,
ColorSpace = stream.ColorSpace,
ColorTransfer = stream.ColorTransfer,
ColorPrimaries = stream.ColorPrimaries,
Rotation = MediaAnalysisUtils.ParseRotation(stream), Rotation = MediaAnalysisUtils.ParseRotation(stream),
Language = stream.GetLanguage(), Language = stream.GetLanguage(),
Disposition = MediaAnalysisUtils.FormatDisposition(stream.Disposition), Disposition = MediaAnalysisUtils.FormatDisposition(stream.Disposition),

View file

@ -15,6 +15,10 @@ public class VideoStream : MediaStream
public string PixelFormat { get; set; } = null!; public string PixelFormat { get; set; } = null!;
public int Rotation { get; set; } public int Rotation { get; set; }
public double AverageFrameRate { 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); public PixelFormat GetPixelFormatInfo() => FFMpeg.GetPixelFormat(PixelFormat);
} }