Skip to content

Commit 6d16ff7

Browse files
committed
HDR data transfer: Added MaxCLL/MaxFALL support
1 parent 4e11aec commit 6d16ff7

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

ff-utils-winforms/Data/VideoColorData.cs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,11 @@ public class VideoColorData
2424
public string WhiteY { get; set; } = "";
2525
public string LumaMin { get; set; } = "";
2626
public string LumaMax { get; set; } = "";
27+
public string MaxCll { get; set; } = "";
28+
public string MaxFall { get; set; } = "";
2729

2830
public override string ToString()
2931
{
30-
//return
31-
//$"Color transfer: {ColorTransfer}" +
32-
//$"\nColor matrix coefficients: {ColorMatrixCoeffs}" +
33-
//$"\nColor primaries: {ColorPrimaries}" +
34-
//$"\nColor range: {ColorRange}" +
35-
//$"\nRed color coordinate x: {RedX}" +
36-
//$"\nRed color coordinate y: {RedY}" +
37-
//$"\nGreen color coordinate x: {GreenX}" +
38-
//$"\nGreen color coordinate y: {GreenY}" +
39-
//$"\nBlue color coordinate y: {BlueX}" +
40-
//$"\nBlue color coordinate x: {BlueY}" +
41-
//$"\nWhite color coordinate y: {WhiteX}" +
42-
//$"\nWhite color coordinate x: {WhiteY}" +
43-
//$"\nMaximum luminance: {LumaMax}" +
44-
//$"\nMinimum luminance: {LumaMin}";
45-
4632
List<string> lines = new List<string>();
4733

4834
try
@@ -57,6 +43,8 @@ public override string ToString()
5743
if (!string.IsNullOrWhiteSpace(WhiteX) && !string.IsNullOrWhiteSpace(WhiteY)) lines.Add($"White color coordinates X/Y: {WhiteX}/{WhiteY}");
5844
if (!string.IsNullOrWhiteSpace(LumaMin)) lines.Add($"Minimum luminance: {LumaMin}");
5945
if (!string.IsNullOrWhiteSpace(LumaMax)) lines.Add($"Maximum luminance: {LumaMax}");
46+
if (!string.IsNullOrWhiteSpace(MaxCll)) lines.Add($"Maximum Content Light Level: {MaxCll}");
47+
if (!string.IsNullOrWhiteSpace(MaxFall)) lines.Add($"Maximum Frame-Average Light Level: {MaxFall}");
6048
}
6149
catch { }
6250

ff-utils-winforms/Utils/ColorDataUtils.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ public static async Task<VideoColorData> GetColorData(string path)
6666

6767
else if (line.Contains("min_luminance="))
6868
data.LumaMin = line.Contains("/") ? FractionToFloat(line.Split('=').Last()) : line.Split('=').Last();
69+
70+
else if (line.Contains("max_content="))
71+
data.MaxCll = line.Contains("/") ? FractionToFloat(line.Split('=').Last()) : line.Split('=').Last();
72+
73+
else if (line.Contains("max_average="))
74+
data.MaxFall = line.Contains("/") ? FractionToFloat(line.Split('=').Last()) : line.Split('=').Last();
6975
}
7076

7177
string infoMkvinfo = await AvProcess.RunMkvInfo($"{path.Wrap()}");
@@ -117,6 +123,12 @@ public static async Task<VideoColorData> GetColorData(string path)
117123

118124
else if (line.Contains("+ Minimum luminance:"))
119125
data.LumaMin = ValidateNumber(line.Split(':')[1]);
126+
127+
else if (line.Contains("+ Maximum content light:"))
128+
data.MaxCll = ValidateNumber(line.Split(':')[1]);
129+
130+
else if (line.Contains("+ Maximum frame light:"))
131+
data.MaxFall = ValidateNumber(line.Split(':')[1]);
120132
}
121133
}
122134

@@ -147,7 +159,8 @@ public static async Task SetColorData(string path, VideoColorData d)
147159
$"--max-luminance 0:{d.LumaMax} " +
148160
$"--min-luminance 0:{d.LumaMin} " +
149161
$"--chromaticity-coordinates 0:{d.RedX},{d.RedY},{d.GreenX},{d.GreenY},{d.BlueX},{d.BlueY} " +
150-
$"--white-colour-coordinates 0:{d.WhiteX},{d.WhiteY} " +
162+
$"--max-content-light 0:{d.MaxCll} " +
163+
$"--max-frame-light 0:{d.MaxFall} " +
151164
$"{path.Wrap()}";
152165

153166
await AvProcess.RunMkvMerge(args, true);

0 commit comments

Comments
 (0)