<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Héctor David</title>
    <description>The latest articles on DEV Community by Héctor David (@davidscript87).</description>
    <link>https://dev.to/davidscript87</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4258348%2F83980c0b-01cd-467d-b90b-31c79e03a8bb.png</url>
      <title>DEV Community: Héctor David</title>
      <link>https://dev.to/davidscript87</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/davidscript87"/>
    <language>en</language>
    <item>
      <title>I built a code pipeline that makes explainer videos (Remotion + local TTS + a 21-check QA gate): 5 traps I hit</title>
      <dc:creator>Héctor David</dc:creator>
      <pubDate>Sun, 22 Nov 2026 06:43:46 +0000</pubDate>
      <link>https://dev.to/davidscript87/i-built-a-code-pipeline-that-makes-explainer-videos-remotion-local-tts-a-21-check-qa-gate-5-2cag</link>
      <guid>https://dev.to/davidscript87/i-built-a-code-pipeline-that-makes-explainer-videos-remotion-local-tts-a-21-check-qa-gate-5-2cag</guid>
      <description>&lt;p&gt;I wanted 60-second motion-graphics explainers that don't look AI-made, and I wanted them reproducible: change a script, get a new video, with the same quality every time. So I built the pipeline in code:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;brief.json → per-scene TTS → word timings → React scenes (Remotion) → render 16:9 + 1:1 → loudness master → automated QA gate.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here are the five traps that cost me the most time, and what fixed each one.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. CRF on flat motion graphics gave me a 0.24 Mbps file
&lt;/h2&gt;

&lt;p&gt;My first master used &lt;code&gt;--crf=17&lt;/code&gt;. Flat colors compress extremely well, so the file came out at &lt;strong&gt;0.24 Mbps&lt;/strong&gt;. It looks fine locally, but platforms re-encode your upload, and starving them of bits hurts. I switched to a fixed target (&lt;code&gt;--video-bitrate=8M&lt;/code&gt;), and the encoder &lt;em&gt;still&lt;/em&gt; only used about 1.3 Mbps, because there's nothing left to encode. That's when I stopped trusting bitrate as a quality metric (see trap 2).&lt;/p&gt;

&lt;h2&gt;
  
  
  2. My PSNR check was measuring chroma subsampling, not quality
&lt;/h2&gt;

&lt;p&gt;I added a fidelity check: render a lossless PNG still in Remotion, decode the same frame from the MP4, compute PSNR. It plateaued at &lt;strong&gt;36.7 dB&lt;/strong&gt; no matter what I did (CRF 12, CRF 8, 8 Mbps with the slow preset). If a metric doesn't move when you turn the knob, it's measuring something else. Here that was &lt;strong&gt;4:2:0 chroma subsampling&lt;/strong&gt; on thin colored lines, which every platform applies anyway. &lt;strong&gt;Luma-only PSNR&lt;/strong&gt; on the same frame gave 48 dB. The gate now checks luma PSNR ≥ 40 dB.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;luma&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;asarray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;convert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"RGB"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mf"&gt;0.2126&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;0.7152&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;0.0722&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. 16% of my "60-second" video was silence
&lt;/h2&gt;

&lt;p&gt;Generating TTS sentence by sentence and padding between them felt natural, until I measured it: &lt;strong&gt;9 of 56 seconds&lt;/strong&gt; were gaps of 0.3 s or more. Retention research says one deliberate pause before the key reveal, not twenty. So now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;internal pauses are clamped to 0.18 s;&lt;/li&gt;
&lt;li&gt;there are 0.12 s between scenes;&lt;/li&gt;
&lt;li&gt;exactly &lt;strong&gt;one&lt;/strong&gt; pause of ≤ 0.6 s, flagged in the brief (&lt;code&gt;"keep_pause": true&lt;/code&gt;), stays in;&lt;/li&gt;
&lt;li&gt;the QA gate fails the video if there's more than one gap of 0.3 s or more.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Removing silence speeds the pace up, so I lowered the TTS speed slightly to land back at ~150 wpm.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Animations keyed to frames drift; key them to words
&lt;/h2&gt;

&lt;p&gt;Every scene gets its own TTS clip, so scene starts are exact. Inside a scene, I look up the frame where a word is spoken:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Scene&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// &amp;lt;Counter to={59} at={at(s, 'fifty')} suffix="%" /&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the narrator says "fifty-nine percent", the counter starts counting. Change the script and everything re-syncs.&lt;/p&gt;

&lt;p&gt;One gotcha: I first triggered a counter on the word &lt;em&gt;itself&lt;/em&gt;, and at the end of the scene it showed 41% instead of 66%, because the tween had only just started. Trigger reveals one word &lt;em&gt;earlier&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. A contact sheet of stills catches layout bugs in one minute
&lt;/h2&gt;

&lt;p&gt;Before rendering (minutes), I render one still per scene near its end and tile them into a single contact sheet. In one pass that caught:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;text wrapping;&lt;/li&gt;
&lt;li&gt;a stamp covering the price;&lt;/li&gt;
&lt;li&gt;an email cut mid-sentence;&lt;/li&gt;
&lt;li&gt;labels overflowing their nodes;&lt;/li&gt;
&lt;li&gt;a 27 px font in the square format.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are 9 bugs in total that a full render would have hidden until I watched every second.&lt;/p&gt;

&lt;h2&gt;
  
  
  The QA gate (21 automated checks)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;pace (145 wpm ±10%)&lt;/li&gt;
&lt;li&gt;≤ 7 words on screen&lt;/li&gt;
&lt;li&gt;no linear easing&lt;/li&gt;
&lt;li&gt;only theme easing tokens&lt;/li&gt;
&lt;li&gt;body text ≥ 32 px at every aspect ratio&lt;/li&gt;
&lt;li&gt;≤ 2 font families and theme colors only&lt;/li&gt;
&lt;li&gt;a sourced number in the brief&lt;/li&gt;
&lt;li&gt;silence budget&lt;/li&gt;
&lt;li&gt;captions ≤ 42 chars per line, with no 1-word pages&lt;/li&gt;
&lt;li&gt;SRT exported&lt;/li&gt;
&lt;li&gt;both ratios rendered&lt;/li&gt;
&lt;li&gt;H.264 High, AAC 48 kHz, fast start&lt;/li&gt;
&lt;li&gt;luma PSNR ≥ 40 dB&lt;/li&gt;
&lt;li&gt;loudness -14 LUFS ±1 with true peak ≤ -1 dBTP&lt;/li&gt;
&lt;li&gt;no black frames&lt;/li&gt;
&lt;li&gt;one CTA&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Checks that can't be automated (does the metaphor land without sound?) stay on a human checklist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Remotion&lt;/strong&gt; for the React scenes. It's free for individuals and companies of up to 3 people; above that you need a company license.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kokoro&lt;/strong&gt; (Apache-2.0) for the local TTS voice.&lt;/li&gt;
&lt;li&gt;Remotion's bundled &lt;strong&gt;ffmpeg&lt;/strong&gt; for the two-pass &lt;code&gt;loudnorm&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A Python script for the QA gate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything renders on a laptop CPU in about 2 minutes per format.&lt;/p&gt;




&lt;p&gt;If you want the whole thing as a starting point, I packaged it as the &lt;strong&gt;Remotion Explainer Kit&lt;/strong&gt;: source, a complete demo project, the TTS pipeline and the QA gate → &lt;a href="https://payhip.com/b/l8bM3" rel="noopener noreferrer"&gt;https://payhip.com/b/l8bM3&lt;/a&gt;. If you'd rather have someone make the video, we also do that: &lt;a href="https://payhip.com/b/zFAxc" rel="noopener noreferrer"&gt;https://payhip.com/b/zFAxc&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Examples of what it renders: &lt;a href="https://drive.google.com/drive/folders/1w9K4oh6kOtWaZ6S0YHXWUV4kSQQJjT31" rel="noopener noreferrer"&gt;https://drive.google.com/drive/folders/1w9K4oh6kOtWaZ6S0YHXWUV4kSQQJjT31&lt;/a&gt;&lt;/p&gt;

</description>
      <category>remotion</category>
      <category>react</category>
      <category>video</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
