Files
2025-12-07 22:04:44 -05:00

174 lines
8.1 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>tonemap_hdr_sdr</title>
<meta name="generator" content="Jekyll v3.10.0" />
<meta property="og:title" content="tonemap_hdr_sdr" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="The friendly multilateral video toolkit built for artists by artists." />
<meta property="og:description" content="The friendly multilateral video toolkit built for artists by artists." />
<link rel="canonical" href="http://localhost:4000/videobeaux/programs/utilities/tonemap_hdr_sdr.html" />
<meta property="og:url" content="http://localhost:4000/videobeaux/programs/utilities/tonemap_hdr_sdr.html" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="tonemap_hdr_sdr" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebPage","description":"The friendly multilateral video toolkit built for artists by artists.","headline":"tonemap_hdr_sdr","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"http://localhost:4000/videobeaux/assets/img/videobeaux.png"}},"url":"http://localhost:4000/videobeaux/programs/utilities/tonemap_hdr_sdr.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/videobeaux/assets/css/style.css?v=5e23701ed3967d38bab12937d79f95fae74b2a53">
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->
<!-- start custom head snippets, customize with your own _includes/head-custom.html file -->
<!-- Setup Google Analytics -->
<!-- You can set your favicon here -->
<!-- link rel="shortcut icon" type="image/x-icon" href="/videobeaux/favicon.ico" -->
<!-- end custom head snippets -->
</head>
<body>
<div class="wrapper">
<header>
<h1><a href="http://localhost:4000/videobeaux/">videobeaux</a></h1>
<img src="/videobeaux/assets/img/videobeaux.png" alt="Logo" />
<p>The friendly multilateral video toolkit built for artists by artists.</p>
<p class="view"><a href="https://github.com/schwwaaa/videobeaux">View the Project on GitHub <small>schwwaaa/videobeaux</small></a></p>
</header>
<section>
<h1 id="tonemap_hdr_sdr">tonemap_hdr_sdr</h1>
<h2 id="description">Description</h2>
<p>Converts HDR footage (PQ/HLG) to SDR using tunable tonemapping curves, preserving highlight detail and color accuracy.</p>
<h2 id="purpose">Purpose</h2>
<p>Convert HDR content into display-safe SDR while preserving highlight detail, proper color relationships, and controlled contrast.
This module applies filmic or mathematical tonemap curves to ensure smooth highlight rolloff and SDR-safe luminance.</p>
<h2 id="how-it-works">How It Works</h2>
<ol>
<li><strong>Linearization</strong><br />
HDR content is converted to linear light using:<br />
<code class="language-plaintext highlighter-rouge">zscale=transfer=linear:npl=PEAK</code></li>
<li><strong>Tonemap Curve Application</strong><br />
The selected operator (<code class="language-plaintext highlighter-rouge">hable</code>, <code class="language-plaintext highlighter-rouge">mobius</code>, <code class="language-plaintext highlighter-rouge">reinhard</code>, or <code class="language-plaintext highlighter-rouge">clip</code>) is applied via:<br />
<code class="language-plaintext highlighter-rouge">tonemap=algo:desat=value</code></li>
<li><strong>SDR Color-Space Mapping</strong><br />
After tonemap, the video is explicitly converted to:
<ul>
<li>BT.709 primaries</li>
<li>BT.709 transfer</li>
<li>BT.709 matrix</li>
</ul>
</li>
<li><strong>Dithering &amp; Pixel Format</strong><br />
Dithering prevents banding; pixel format ensures compatibility.</li>
<li><strong>Encoding</strong><br />
Output is encoded using libx264 unless overridden.</li>
</ol>
<h2 id="program-template">Program Template</h2>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>videobeaux -P tonemap_hdr_sdr \
-i input.mp4 \
-o output.mp4 \
--outfile VALUE \
--algo VALUE \
--desat VALUE \
--peak VALUE \
--dither VALUE \
--pix_fmt VALUE \
--x264_preset VALUE \
--crf VALUE \
--copy_audio VALUE
</code></pre></div></div>
<h2 id="arguments">Arguments</h2>
<ul>
<li><strong>outfile</strong> — Required SDR output file path.</li>
<li><strong>algo</strong> — Tonemap operator (<code class="language-plaintext highlighter-rouge">hable</code>, <code class="language-plaintext highlighter-rouge">mobius</code>, <code class="language-plaintext highlighter-rouge">reinhard</code>, <code class="language-plaintext highlighter-rouge">clip</code>).</li>
<li><strong>desat</strong> — Highlight desaturation amount (0.01.0).</li>
<li><strong>peak</strong> — Nominal HDR peak brightness in nits (e.g., 400, 600, 1000).</li>
<li><strong>dither</strong> — Dithering mode applied during zscale processing.</li>
<li><strong>pix_fmt</strong> — Output pixel format (e.g., <code class="language-plaintext highlighter-rouge">yuv420p</code>, <code class="language-plaintext highlighter-rouge">yuv422p10le</code>).</li>
<li><strong>x264_preset</strong> — Encoding speed/quality preset (<code class="language-plaintext highlighter-rouge">slow</code>, <code class="language-plaintext highlighter-rouge">medium</code>, <code class="language-plaintext highlighter-rouge">fast</code>, etc.).</li>
<li><strong>crf</strong> — Constant Rate Factor controlling video quality (lower = higher quality).</li>
<li><strong>copy_audio</strong> — When set, audio is copied instead of re-encoded.</li>
</ul>
<h2 id="real-world-example">Real World Example</h2>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>videobeaux -P tonemap_hdr_sdr \
-i myvideo.mp4 \
-o tonemap_hdr_sdr_styled.mp4 \
--outfile EXAMPLE \
--algo EXAMPLE \
--desat EXAMPLE \
--peak EXAMPLE \
--dither EXAMPLE \
--pix_fmt EXAMPLE \
--x264_preset EXAMPLE \
--crf EXAMPLE \
--copy_audio EXAMPLE
</code></pre></div></div>
<h2 id="technical-notes">Technical Notes</h2>
<ul>
<li>zscale handles linearization and SDR color mapping with high accuracy.</li>
<li>Explicit BT.709 tagging avoids incorrect interpretation by media players.</li>
<li><code class="language-plaintext highlighter-rouge">--peak</code> significantly affects highlight rolloff; adjust depending on source mastering.</li>
<li>Dithering is essential for avoiding banding when outputting 8-bit formats.</li>
<li>10-bit pixel formats increase headroom for gradients and grading workflows.</li>
</ul>
<h2 id="recommended-usage">Recommended Usage</h2>
<ul>
<li>Creating SDR masters from HDR originals.</li>
<li>Preparing high-quality web deliverables (YouTube, Vimeo, TikTok).</li>
<li>Producing SDR screeners or festival submissions that disallow HDR.</li>
<li>Generating SDR previews for HDR editing environments.</li>
</ul>
<h2 id="quality-tips">Quality Tips</h2>
<ul>
<li>Use CRF <strong>1418</strong> for high-quality SDR output.</li>
<li><code class="language-plaintext highlighter-rouge">hable</code> generally provides the best filmic highlight rolloff.</li>
<li>For oversaturated HDR highlights, increase <code class="language-plaintext highlighter-rouge">--desat</code> to 0.150.35.</li>
<li>Use <strong>yuv422p10le</strong> when creating grading intermediates.</li>
<li>Combine with <code class="language-plaintext highlighter-rouge">gamma_fix</code> for refined SDR brightness/contrast normalization.</li>
</ul>
</section>
<footer>
<p>This project is maintained by <a href="https://github.com/schwwaaa">schwwaaa</a></p>
<p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
</footer>
</div>
<script src="/videobeaux/assets/js/scale.fix.js"></script>
</body>
</html>