Skip to content

Commit 0bbdcb9

Browse files
authored
First stab at a HDR test page. (#111)
* removed qscale that wasnt needed. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Making it clearer why images are missing. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Adding some HDR tests as a WIP. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> --------- Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>
1 parent 6f95e38 commit 0bbdcb9

File tree

11 files changed

+303
-48
lines changed

11 files changed

+303
-48
lines changed

ColorPreservation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ comparisontest:
4949
```
5050
ffmpeg -y -i ../sourceimages/chip-chart-1080-noicc.png \
5151
-pix_fmt yuv444p10le -vf "colormatrix=bt470bg:bt709" \
52-
-c:v libx264 -preset placebo -qp 0 -x264-params "keyint=15:no-deblock=1" -qscale:v 1 \
52+
-c:v libx264 -preset placebo -qp 0 -x264-params "keyint=15:no-deblock=1" \
5353
-color_range tv -colorspace bt709 -color_primaries bt709 -color_trc iec61966-2-1 \
5454
./chip-chart-yuvconvert/spline444colormatrix2.mp4
5555
```
@@ -81,7 +81,7 @@ comparisontest:
8181
```
8282
ffmpeg -y -i ../sourceimages/chip-chart-1080-noicc.png \
8383
-pix_fmt yuv444p10le -vf "colorspace=bt709:iall=bt601-6-625:fast=1" \
84-
-c:v libx264 -preset placebo -qp 0 -x264-params "keyint=15:no-deblock=1" -qscale:v 1 \
84+
-c:v libx264 -preset placebo -qp 0 -x264-params "keyint=15:no-deblock=1" \
8585
-color_range tv -colorspace bt709 -color_primaries bt709 -color_trc iec61966-2-1 \
8686
./chip-chart-yuvconvert/spline444colorspace.mp4
8787
```
@@ -114,7 +114,7 @@ comparisontest:
114114
```
115115
ffmpeg -y -i ../sourceimages/chip-chart-1080-noicc.png \
116116
-pix_fmt yuv444p10le -vf "zscale=m=709:min=709:rangein=full:range=limited" \
117-
-c:v libx264 -preset placebo -qp 0 -x264-params "keyint=15:no-deblock=1" -qscale:v 1 \
117+
-c:v libx264 -preset placebo -qp 0 -x264-params "keyint=15:no-deblock=1" \
118118
-color_range tv -colorspace bt709 -color_primaries bt709 -color_trc iec61966-2-1 \
119119
./chip-chart-yuvconvert/spline444out_color_matrix.mp4
120120
```
@@ -146,7 +146,7 @@ comparisontest:
146146
ffmpeg -y -i ../sourceimages/chip-chart-1080-noicc.png \
147147
-pix_fmt yuv444p10le \
148148
-vf "scale=in_range=full:in_color_matrix=bt709:out_range=tv:out_color_matrix=bt709" \
149-
-c:v libx264 -preset placebo -qp 0 -x264-params "keyint=15:no-deblock=1" -qscale:v 1 \
149+
-c:v libx264 -preset placebo -qp 0 -x264-params "keyint=15:no-deblock=1" \
150150
-color_range tv -colorspace bt709 -color_primaries bt709 -color_trc iec61966-2-1 \
151151
./chip-chart-yuvconvert/spline444out_color_matrix.mp4
152152
```

hdr/HDR-Calculator.xlsx

107 KB
Binary file not shown.

hdr/HDR-Test_chart_v3.nknc

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

hdr/README

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Firstly we convert the test image, which should have a "Bad Image" in full rec2020 red, and a background which should be a rec709 red. I think the resulting image should be just red when tonemapped properly.
2+
3+
ffmpeg -y -i hdr_test_chart_v3_pq.tif -c:v libx265 -crf 18 -pix_fmt yuv420p10le -c:v libx265 -crf 18 -pix_fmt yuv420p10le -x265-params " \
4+
colorprim=bt2020: \
5+
transfer=smpte2084: \
6+
colormatrix=bt2020nc: \
7+
master-display=G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(10000000,1): \
8+
max-cll=2000,50 " \
9+
-color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -movflags faststart -tag:v hvc1 output_hdr10.mp4
10+
11+
ffmpeg -y -i hdr_test_chart_v3_pq.tif -c:v libx265 -crf 18 -pix_fmt yuv420p10le \-c:v libx265 -crf 18 -pix_fmt yuv420p10le -x265-params " \
12+
colorprim=bt2020: \
13+
transfer=smpte2084: \
14+
colormatrix=bt2020nc: \
15+
master-display=G(15000,30000)B(7500,3000)R(32000,16500)WP(15635,16450)L(1000000,1): \
16+
max-cll=100,50 \
17+
" -movflags faststart -tag:v hvc1 output_hdr10_rec709.mp4
18+
19+
ffmpeg -y -i hdr_test_chart_v3_pq.tif -c:v libx265 -crf 18 -pix_fmt yuv420p10le \-c:v libx265 -crf 18 -pix_fmt yuv420p10le -x265-params " \
20+
colorprim=bt2020: \
21+
transfer=smpte2084: \
22+
colormatrix=bt2020nc: \
23+
master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=2000,400 " -movflags faststart -tag:v hvc1 output_hdr10_p3.mp4
24+
25+
# Trying to tonemap with zscale
26+
ffmpeg -y -i output_hdr10_rec709.mp4 -vf "zscale=t=linear:npl=100,tonemap=tonemap=hable:desat=0,zscale=p=bt709:t=bt709:m=bt709:r=tv,format=yuv420p10le" -color_primaries bt709 -color_trc bt709 -colorspace bt709 -c:v libx265 -crf 18 -preset medium -c:a copy -tag:v hvc1 output_srgb.mov
27+
28+
# Trying to tonemap with libplacebo, which needs vulkan
29+
#ffmpeg -y -i output_hdr10_rec709.mp4 -vf "libplacebo=tonemapping=bt.2390:color_primaries=bt709:color_trc=bt709:colorspace=bt709" -color_primaries bt709 -color_trc bt709 -colorspace bt709 -c:v libx265 -crf 18 -preset medium -c:a copy output_srgb.mp4
30+
31+
32+
ffmpeg -y -i gamut_test_chart_v2_rec2020.tif -c:v libx265 -crf 18 -pix_fmt yuv420p10le -c:v libx265 -crf 18 -pix_fmt yuv420p10le -x265-params " \
33+
colorprim=bt2020: \
34+
transfer=bt709: \
35+
colormatrix=bt2020nc " \
36+
-color_primaries bt2020 -color_trc bt709 -colorspace bt2020nc -movflags faststart -tag:v hvc1 output_gamut.mp4

hdr/hdr_test.exr

110 KB
Binary file not shown.

hdr/hdr_test_pq1000.png

98.4 KB
Loading

hdr/index.html

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>HDR Video Comparison</title>
7+
<style>
8+
body {
9+
background-color: black;
10+
color: #e0e0e0;
11+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
12+
margin: 0;
13+
padding: 20px;
14+
}
15+
.grid-container {
16+
display: flex;
17+
flex-wrap: wrap;
18+
gap: 20px;
19+
justify-content: center; /* Centers items if they don't fill the row */
20+
}
21+
.video-card {
22+
flex: 0 0 600px; /* Fixed width of 600px */
23+
display: flex;
24+
flex-direction: column;
25+
align-items: center;
26+
background-color: #1a1a1a;
27+
padding: 10px;
28+
border-radius: 8px;
29+
box-sizing: border-box;
30+
}
31+
video {
32+
width: 100%;
33+
height: auto;
34+
border-radius: 4px;
35+
}
36+
.filename {
37+
margin-top: 10px;
38+
font-family: monospace;
39+
font-size: 0.9em;
40+
word-break: break-all;
41+
}
42+
#capabilities {
43+
margin-top: 40px;
44+
padding: 20px;
45+
background-color: #111;
46+
border-top: 2px solid #333;
47+
text-align: center;
48+
border-radius: 8px;
49+
}
50+
.cap-item {
51+
margin: 10px 0;
52+
font-size: 1.1em;
53+
}
54+
.highlight {
55+
color: #4caf50;
56+
font-weight: bold;
57+
}
58+
</style>
59+
</head>
60+
<body>
61+
62+
<div class="grid-container">
63+
<!-- Video 1 -->
64+
<div class="video-card">
65+
<video autoplay muted playsinline loop>
66+
<source src="output_hdr10.mp4" type="video/mp4">
67+
Your browser does not support the video tag.
68+
</video>
69+
<div class="filename">No display-master parameters specified, should show full HDR rec2020 if available..</div>
70+
</div>
71+
72+
<!-- Video 2 -->
73+
<div class="video-card">
74+
<video autoplay muted playsinline loop>
75+
<source src="output_hdr10_rec709.mp4" type="video/mp4">
76+
Your browser does not support the video tag.
77+
</video>
78+
<div class="filename">Configured to only show rec709 using the display-master, if you see the full HDR, then the tonemapping isnt working correctly.</div>
79+
</div>
80+
81+
<!-- Video 3 -->
82+
<div class="video-card">
83+
<video autoplay muted playsinline loop>
84+
<source src="output_hdr10_p3.mp4" type="video/mp4">
85+
Your browser does not support the video tag.
86+
</video>
87+
<div class="filename">Full 2000 nit HDR, but with p3 gamut display master.</div>
88+
</div>
89+
90+
<!-- Video 4 -->
91+
<div class="video-card">
92+
<video autoplay muted playsinline loop>
93+
<source src="output_srgb.mov" type="video/quicktime">
94+
<source src="output_srgb.mov" type="video/mp4">
95+
Your browser does not support the video tag.
96+
</video>
97+
<div class="filename">Reference HDR converted to sRGB using tonemapping, this gives you a sense of what you should see if tonemapping is working correctly.</div>
98+
</div>
99+
</div>
100+
101+
<div id="capabilities">
102+
<h2>System Display Capabilities</h2>
103+
<div class="cap-item" id="gamut-info">Detected Gamut: Checking...</div>
104+
<div class="cap-item" id="hdr-info">HDR Support: Checking...</div>
105+
</div>
106+
107+
<script>
108+
function checkCapabilities() {
109+
const gamutInfo = document.getElementById('gamut-info');
110+
const hdrInfo = document.getElementById('hdr-info');
111+
112+
// 1. Detect Color Gamut
113+
let gamut = [];
114+
if (window.matchMedia('(color-gamut: srgb)').matches) gamut.push('sRGB');
115+
if (window.matchMedia('(color-gamut: p3)').matches) gamut.push('P3');
116+
if (window.matchMedia('(color-gamut: rec2020)').matches) gamut.push('Rec.2020');
117+
118+
if (gamut.length > 0) {
119+
// The last one is usually the widest supported
120+
gamutInfo.innerHTML = `Detected Gamut: <span class="highlight">${gamut[gamut.length - 1]}</span> (Support: ${gamut.join(', ')})`;
121+
} else {
122+
gamutInfo.textContent = 'Detected Gamut: Unknown';
123+
}
124+
125+
// 2. Detect HDR
126+
let isHDR = false;
127+
let hdrText = 'SDR (Standard Dynamic Range)';
128+
129+
// Check 'dynamic-range' (screen capabilities)
130+
if (window.matchMedia('(dynamic-range: high)').matches) {
131+
isHDR = true;
132+
hdrText = 'HDR (High Dynamic Range)';
133+
}
134+
135+
// Check 'video-dynamic-range' (specifically for video plane)
136+
let videoHDR = '';
137+
if (window.matchMedia('(video-dynamic-range: high)').matches) {
138+
videoHDR = ' [Video Plane: HDR Supported]';
139+
}
140+
141+
hdrInfo.innerHTML = `Dynamic Range: <span class="highlight">${hdrText}</span>${videoHDR}`;
142+
}
143+
144+
// Run initially
145+
checkCapabilities();
146+
147+
// Listen for changes (e.g. moving window to another monitor)
148+
const queries = [
149+
'(color-gamut: srgb)',
150+
'(color-gamut: p3)',
151+
'(color-gamut: rec2020)',
152+
'(dynamic-range: high)',
153+
'(video-dynamic-range: high)'
154+
];
155+
156+
queries.forEach(q => {
157+
try {
158+
window.matchMedia(q).addEventListener('change', checkCapabilities);
159+
} catch (e) {
160+
// old browser support
161+
try {
162+
window.matchMedia(q).addListener(checkCapabilities);
163+
} catch (e2) {}
164+
}
165+
});
166+
</script>
167+
</body>
168+
</html>

hdr/output_hdr10.mp4

18.1 KB
Binary file not shown.

hdr/output_hdr10_p3.mp4

18.1 KB
Binary file not shown.

hdr/output_hdr10_rec709.mp4

18.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)