<?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: CompressVid</title>
    <description>The latest articles on DEV Community by CompressVid (@compressvid).</description>
    <link>https://dev.to/compressvid</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%2F4186803%2Fc9e14c52-506e-44c8-9d44-97ff07edf79f.png</url>
      <title>DEV Community: CompressVid</title>
      <link>https://dev.to/compressvid</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/compressvid"/>
    <language>en</language>
    <item>
      <title>MB vs MiB, Container Overhead and Headroom: Engineering a "Fits Under 20 MB" Guarantee</title>
      <dc:creator>CompressVid</dc:creator>
      <pubDate>Thu, 19 Nov 2026 12:00:00 +0000</pubDate>
      <link>https://dev.to/compressvid/mb-vs-mib-container-overhead-and-headroom-engineering-a-fits-under-20-mb-guarantee-17l1</link>
      <guid>https://dev.to/compressvid/mb-vs-mib-container-overhead-and-headroom-engineering-a-fits-under-20-mb-guarantee-17l1</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Disclosure: I work on &lt;a href="https://compressvid.io/" rel="noopener noreferrer"&gt;CompressVid&lt;/a&gt;. The results and the bug below are from our own testing. Sizes are as displayed by our tool, which counts in binary megabytes (MiB).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you build a "compress for Discord" feature, the spec sounds trivial: &lt;em&gt;output must be under 20 MB.&lt;/em&gt; In practice, three separate things try to push you over the line. Our Discord preset is &lt;strong&gt;19 MB, not 20&lt;/strong&gt;, and this post explains why that one megabyte exists, including the time it wasn't enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem 1: which megabyte?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MB&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;_000_000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// SI megabyte (what most upload limits and marketing use)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MiB&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;_048_576&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// binary mebibyte (what many tools and OSes display)&lt;/span&gt;

&lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;MB&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// 20,000,000 bytes&lt;/span&gt;
&lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;MiB&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// 20,971,520 bytes (4.9% more)&lt;/span&gt;
&lt;span class="mi"&gt;19&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;MiB&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// 19,922,944 bytes (still under 20,000,000)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our tool displays MiB. One concrete example: a result shown as &lt;strong&gt;9.77 MB&lt;/strong&gt; is &lt;strong&gt;10,245,113 bytes&lt;/strong&gt; on disk, so a file manager that uses SI units shows it as about 10.2 MB. If your preset says "20" and you mean MiB, while the platform means MB, you've already overshot by almost a megabyte before encoding starts. A 19 MiB ceiling stays under 20 MB in &lt;strong&gt;either&lt;/strong&gt; interpretation. That alone justifies the preset.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem 2: container overhead
&lt;/h2&gt;

&lt;p&gt;Your bitrate maths covers the elementary streams. The container adds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;moov&lt;/code&gt; box: per-sample sizes, timestamps, sync-sample tables, chunk offsets. This grows with frame count, so a long 60 fps clip carries more index than a short 24 fps one;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ftyp&lt;/code&gt;, track headers and metadata;&lt;/li&gt;
&lt;li&gt;audio framing (each AAC frame has its own entry).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's typically small, a fraction of a percent to a couple of percent, but it is never zero, and it's not in your bitrate budget unless you reserve it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem 3: rate control isn't exact
&lt;/h2&gt;

&lt;p&gt;Even two-pass ABR lands &lt;em&gt;near&lt;/em&gt; the target, not on it. VBV settings (&lt;code&gt;-maxrate&lt;/code&gt;, &lt;code&gt;-bufsize&lt;/code&gt;) allow local bursts. Single-pass modes drift more. Expect a few percent either way.&lt;/p&gt;

&lt;p&gt;Put the three together, and a budget calculation looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;safeVideoKbps&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;limitBytes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;durationSec&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;audioKbps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;128&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;overhead&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.02&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;drift&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.03&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;usableBits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;limitBytes&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;overhead&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;drift&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;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;usableBits&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;durationSec&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;audioKbps&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Discord free tier, 1-minute clip, aiming at 19 MiB rather than 20 MB:&lt;/span&gt;
&lt;span class="nf"&gt;safeVideoKbps&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;limitBytes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;_048_576&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;durationSec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt; &lt;span class="c1"&gt;// ≈ 2397 kbps&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The overhead and drift percentages above are illustrative assumptions, not measured constants. Tune them against your own encoder.&lt;/p&gt;

&lt;h2&gt;
  
  
  What our preset actually produced
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgmoj2fbg9fdm636zee2w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgmoj2fbg9fdm636zee2w.png" alt="Target size set to 19 MB with the '19 MB Free' Discord preset selected" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;80.52 MB, 1:00, 1080p MP4&lt;/td&gt;
&lt;td&gt;19 MB (Discord free)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;18.64 MB&lt;/strong&gt; in about 15 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;39.91 MB, 0:40, 1080p VP9 WebM&lt;/td&gt;
&lt;td&gt;19 MB (Discord)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;12.77 MB&lt;/strong&gt; (H.264/AAC MP4)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F57l8fk3o484sqx7rzvgj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F57l8fk3o484sqx7rzvgj.png" alt="The 'Fit to: 19 MB (Discord)' option selected in the WebM compressor" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first result used about 98% of its ceiling, close but safe. The second used about 67%, because the encoder didn't need the full budget for that content. Both are fine: a target size is a &lt;strong&gt;ceiling&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When a ceiling wasn't a ceiling: our 20.58 MB bug
&lt;/h2&gt;

&lt;p&gt;During testing, an early build turned a &lt;strong&gt;19 MB target into a 20.58 MB file&lt;/strong&gt;. That's over the preset, and in MiB terms (≈21.58 million bytes) over a 20 MB limit too. It was a bug in our own target-size handling, and it has since been fixed. Whatever the exact internal cause, the lesson is the same: a budget computed without reserves for the factors above, and without a check on the final file, will eventually overshoot.&lt;/p&gt;

&lt;p&gt;What we took away is a pattern I'd recommend to anyone shipping a size-limited export:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Compute the budget from the limit minus explicit reserves&lt;/strong&gt; (overhead + drift), not from the limit itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify the muxed output size&lt;/strong&gt;, not the estimated one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;If it's over, re-encode at a reduced bitrate&lt;/strong&gt; proportional to the overshoot, e.g. &lt;code&gt;newKbps = oldKbps × (limit / actual) × 0.97&lt;/code&gt;, instead of failing or silently shipping it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test with hard content&lt;/strong&gt; (noise, confetti, fast pans). Easy footage hides overshoot because the encoder never needs its full budget.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;encodeUnder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;limitBytes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;kbps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;attempt&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;kbps&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;byteLength&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;limitBytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;kbps&lt;/span&gt; &lt;span class="o"&gt;=&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;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;kbps&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;limitBytes&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;byteLength&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.97&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Could not fit under limit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Decide whether your limit is MB or MiB, and design for the stricter one.&lt;/li&gt;
&lt;li&gt;Reserve bits for container overhead and rate-control drift.&lt;/li&gt;
&lt;li&gt;Always verify the final file, and retry with a lower bitrate if it's over.&lt;/li&gt;
&lt;li&gt;Platform limits change over time. Keep presets in config, not in code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can see the 19 MB preset behaviour in the &lt;a href="https://compressvid.io/discord-video-compressor" rel="noopener noreferrer"&gt;Discord video compressor&lt;/a&gt;, which works online with nothing to install. If you've found other sources of overshoot in your own pipelines, I'd like to hear about them in the comments.&lt;/p&gt;

</description>
      <category>video</category>
      <category>webdev</category>
      <category>discord</category>
      <category>javascript</category>
    </item>
    <item>
      <title>La matemática del tamaño objetivo: tasa de bits MB 8 segundos (135,95 MB 7,48 MB)</title>
      <dc:creator>CompressVid</dc:creator>
      <pubDate>Mon, 16 Nov 2026 03:40:35 +0000</pubDate>
      <link>https://dev.to/compressvid/la-matematica-del-tamano-objetivo-tasa-de-bits-mb-x-8-segundos-13595-mb-748-mb-1clm</link>
      <guid>https://dev.to/compressvid/la-matematica-del-tamano-objetivo-tasa-de-bits-mb-x-8-segundos-13595-mb-748-mb-1clm</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Transparencia: formo parte del equipo de &lt;a href="https://compressvid.io/es" rel="noopener noreferrer"&gt;CompressVid&lt;/a&gt;, un compresor de video en línea. Las cifras de tamaño salen de nuestras propias pruebas (las muestra la herramienta). Las tasas de bits las calculé yo: tamaño × 8 ÷ duración.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;«Comprime este video a 24 MB» suena a una petición vaga. No lo es. El tamaño de un video comprimido lo fija, casi por completo, su &lt;strong&gt;tasa de bits&lt;/strong&gt; (bitrate). Un tamaño objetivo es solo un presupuesto, y ese presupuesto se obtiene dividiendo.&lt;/p&gt;

&lt;h2&gt;
  
  
  La fórmula
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tamaño del archivo (bits) ≈ (tasa de bits de video + tasa de bits de audio) × duración + sobrecarga del contenedor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Si despejas, el tamaño objetivo se convierte en una tasa de bits objetivo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tasa de bits de video ≈ (bytes objetivo × 8) / duración − tasa de bits de audio
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Para que la cuenta sea sencilla, en este artículo 1 MB = 1.000.000 bytes y 1 Mbps = 1.000.000 bits/s. En CompressVid los tamaños se muestran en megabytes binarios (MiB, 1.048.576 bytes, un 4,9 % más grandes), así que las tasas de bits reales de los archivos de abajo son unas 5 % más altas que las de la tabla. Las proporciones y las conclusiones no cambian. Donde sí importa la diferencia MB/MiB es cuando el límite es estricto: por eso conviene dejar margen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Un ejemplo en JavaScript
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Devuelve la tasa de bits media de video (kbps) para un tamaño objetivo.&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;videoBitrateForTarget&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;targetMB&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;durationSec&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;audioKbps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;128&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;overheadPct&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;usableBits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;targetMB&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;1e6&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;overheadPct&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&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;totalKbps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usableBits&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;durationSec&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&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;max&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;totalKbps&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;audioKbps&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="nf"&gt;videoBitrateForTarget&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;targetMB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;durationSec&lt;/span&gt;&lt;span class="p"&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="c1"&gt;// ≈ 6143 kbps&lt;/span&gt;
&lt;span class="nf"&gt;videoBitrateForTarget&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;targetMB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;durationSec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;45&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;// ≈ 4053 kbps&lt;/span&gt;
&lt;span class="nf"&gt;videoBitrateForTarget&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;targetMB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;96&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;durationSec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;180&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;// ≈ 4053 kbps&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;El 2 % de sobrecarga y los 128 kbps de audio son hipótesis para el ejemplo. En un archivo real dependen del contenedor y del número de pistas.&lt;/p&gt;

&lt;p&gt;Fíjate en las dos últimas llamadas: un objetivo de 24 MB en 45 segundos y uno de 96 MB en 3 minutos dan el mismo presupuesto de tasa de bits. Un límite de tamaño es, en el fondo, un límite de bits por segundo. El clip más largo, con el mismo techo, recibe menos bits en cada segundo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lo que ocurrió con archivos reales
&lt;/h2&gt;

&lt;p&gt;Estas cuatro pruebas son nuestras. Los tamaños de entrada y de salida son los que mostró la herramienta. Las tasas de bits son mi propia división: &lt;code&gt;tamaño × 8 / duración&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Entrada&lt;/th&gt;
&lt;th&gt;Objetivo&lt;/th&gt;
&lt;th&gt;Salida&lt;/th&gt;
&lt;th&gt;Tasa media de entrada&lt;/th&gt;
&lt;th&gt;Presupuesto&lt;/th&gt;
&lt;th&gt;Tasa media de salida&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;135,95 MB, 30 s, 1080p60 MOV&lt;/td&gt;
&lt;td&gt;24 MB&lt;/td&gt;
&lt;td&gt;7,48 MB&lt;/td&gt;
&lt;td&gt;~36,3 Mbps&lt;/td&gt;
&lt;td&gt;~6,4 Mbps&lt;/td&gt;
&lt;td&gt;~2,0 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;65,05 MB, 45 s, 1080p MP4&lt;/td&gt;
&lt;td&gt;24 MB&lt;/td&gt;
&lt;td&gt;21,08 MB&lt;/td&gt;
&lt;td&gt;~11,6 Mbps&lt;/td&gt;
&lt;td&gt;~4,3 Mbps&lt;/td&gt;
&lt;td&gt;~3,7 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;185,24 MB, 3:00, 1080p MP4&lt;/td&gt;
&lt;td&gt;96 MB&lt;/td&gt;
&lt;td&gt;32,08 MB&lt;/td&gt;
&lt;td&gt;~8,2 Mbps&lt;/td&gt;
&lt;td&gt;~4,3 Mbps&lt;/td&gt;
&lt;td&gt;~1,4 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;185,24 MB, 3:00, 1080p MP4&lt;/td&gt;
&lt;td&gt;«70 % más pequeño» (55,6 MB)&lt;/td&gt;
&lt;td&gt;23,86 MB&lt;/td&gt;
&lt;td&gt;~8,2 Mbps&lt;/td&gt;
&lt;td&gt;~2,5 Mbps&lt;/td&gt;
&lt;td&gt;~1,1 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;El clip de 45 segundos usó aproximadamente el 88 % de su presupuesto. El MOV del iPhone, apenas el 31 %. La misma herramienta, el mismo objetivo, resultados muy distintos. ¿Por qué?&lt;/p&gt;

&lt;h2&gt;
  
  
  El objetivo es un techo, no una meta
&lt;/h2&gt;

&lt;p&gt;Un tamaño objetivo es un máximo. Un codificador moderno no rellena el archivo solo para llegar al número. En modos orientados a la calidad, gasta bits solo donde la imagen los necesita:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;El video del teléfono suele ir sobrado. El MOV 1080p60 empezó en ~36 Mbps, una tasa pensada para que el teléfono comprima en tiempo real sin esforzarse. Un codificador más lento puede describir la misma escena con muchos menos bits, así que nunca necesitó los 6,4 Mbps que tenía permitidos.&lt;/li&gt;
&lt;li&gt;El contenido decide el resto. Los planos estáticos o lentos comprimen muy bien. El movimiento, el grano o la textura fina se comen los bits. El clip de 45 segundos se quedó mucho más cerca del techo.&lt;/li&gt;
&lt;li&gt;El mismo archivo, dos objetivos, ambos por debajo. El video de 3 minutos quedó en 32,08 MB con un techo de 96 MB y en 23,86 MB con uno de 55,6 MB. Las dos pruebas se mantuvieron en 1080p y conservaron los 3:00 completos.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Si el video es más largo de lo que el límite permite con buena calidad, &lt;a href="https://compressvid.io/es/cortar-video" rel="noopener noreferrer"&gt;cortarlo&lt;/a&gt; antes de comprimir sube el presupuesto de cada segundo que sí te importa. Si lo que sobra es margen negro o un encuadre demasiado amplio, &lt;a href="https://compressvid.io/es/redimensionar-video" rel="noopener noreferrer"&gt;redimensionar&lt;/a&gt; deja más bits para lo visible. Y si el sonido no hace falta, &lt;a href="https://compressvid.io/es/quitar-audio-a-un-video" rel="noopener noreferrer"&gt;quitar el audio&lt;/a&gt; libera una parte (pequeña, pero real) del presupuesto.&lt;/p&gt;

&lt;h2&gt;
  
  
  Por qué sigue haciendo falta un margen
&lt;/h2&gt;

&lt;p&gt;Aunque la cuenta esté bien, el archivo final puede pasarse un poco:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;La sobrecarga del contenedor (el índice del MP4, las tablas por muestra) crece con la duración y el número de fotogramas.&lt;/li&gt;
&lt;li&gt;El control de tasa no es exacto: en una sola pasada puede desviarse unos puntos porcentuales, y los búferes permiten ráfagas cortas.&lt;/li&gt;
&lt;li&gt;La confusión entre MB y MiB, como expliqué arriba.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Lo aprendimos por las malas. En una versión temprana, un objetivo de 19 MB produjo 20,58 MB. Eso ya está corregido, y precisamente por estos efectos existen atajos como «22 MB Gmail» para un límite de 25 MB, o «24 MB» para uno de 25 MB. Mi regla práctica: apunta un 5 % por debajo de cualquier límite duro.&lt;/p&gt;

&lt;p&gt;En la página de &lt;a href="https://compressvid.io/es/comprimir-video-para-correo" rel="noopener noreferrer"&gt;video para correo&lt;/a&gt; partimos de 22 MB para una cuenta personal de Gmail, cuya &lt;a href="https://support.google.com/mail/answer/6584?hl=es-419" rel="noopener noreferrer"&gt;ayuda oficial&lt;/a&gt; indica 25 MB de adjuntos en total. Son objetivos de la herramienta, no una garantía de envío: las políticas pueden cambiar, y hay que comprobar el archivo descargado.&lt;/p&gt;

&lt;h2&gt;
  
  
  Para llevar
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Tamaño objetivo ÷ duración = presupuesto de tasa de bits. Resta el audio y la sobrecarga, y tienes la tasa de bits de video.&lt;/li&gt;
&lt;li&gt;El mismo presupuesto puede esconderse detrás de límites que parecen distintos (24 MB en 45 s ≈ 96 MB en 3 min).&lt;/li&gt;
&lt;li&gt;Trata el objetivo como un techo. En tomas de celular con mucha tasa de bits de origen, un buen codificador suele terminar bastante por debajo.&lt;/li&gt;
&lt;li&gt;Deja siempre margen para la sobrecarga del contenedor y para el desvío del control de tasa.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Si quieres ver ese comportamiento (techo frente a resultado) en tus propios clips, el compresor de video de CompressVid te deja escribir un tamaño objetivo y muestra entrada y salida juntos. Se usa en línea, sin instalar nada; el archivo se procesa en nuestros servidores. Me interesa cuánto se acerca tu material a su presupuesto: deja tus cifras en los comentarios.&lt;/p&gt;

</description>
      <category>spanish</category>
      <category>espanol</category>
      <category>video</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Why MP4 to MOV Gets Bigger: Re-encoding vs Remuxing Explained</title>
      <dc:creator>CompressVid</dc:creator>
      <pubDate>Thu, 12 Nov 2026 12:00:00 +0000</pubDate>
      <link>https://dev.to/compressvid/why-mp4-mov-gets-bigger-re-encoding-vs-remuxing-explained-26cc</link>
      <guid>https://dev.to/compressvid/why-mp4-mov-gets-bigger-re-encoding-vs-remuxing-explained-26cc</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Disclosure: I work on &lt;a href="https://compressvid.io/" rel="noopener noreferrer"&gt;CompressVid&lt;/a&gt;. The test below is from our own MP4-to-MOV converter. Sizes are as shown by the tool (MiB). The bitrates are my own &lt;code&gt;size × 8 / duration&lt;/code&gt; arithmetic.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here's a result that looks like a bug but isn't: a 1-minute 1080p MP4 of &lt;strong&gt;80.5 MB&lt;/strong&gt; went in, and a &lt;strong&gt;144.4 MB&lt;/strong&gt; MOV came out. That's about 1.8× bigger, with the same resolution, the same length and the same codec family (H.264).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2bo64xwuihongyj40c7c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2bo64xwuihongyj40c7c.png" alt="MP4 to MOV conversion complete: 144.4 MB, about 1.8x larger" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To see why, you need to know one thing: &lt;strong&gt;MP4 and MOV are nearly the same container.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  MP4 and MOV are siblings
&lt;/h2&gt;

&lt;p&gt;MP4 (ISO/IEC 14496-14) is derived from the QuickTime File Format, which is MOV. Both use the same "atom/box" structure (&lt;code&gt;ftyp&lt;/code&gt;, &lt;code&gt;moov&lt;/code&gt;, &lt;code&gt;mdat&lt;/code&gt;, &lt;code&gt;trak&lt;/code&gt;…), and both happily carry H.264 video and AAC audio. The differences are mostly branding (&lt;code&gt;ftyp&lt;/code&gt;) and a few codec and metadata extensions.&lt;/p&gt;

&lt;p&gt;So converting H.264/AAC MP4 to MOV &lt;em&gt;can&lt;/em&gt; be close to free: just rewrap the existing streams.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Remux: copy streams, change the box. Seconds, lossless, ~same size.&lt;/span&gt;
ffmpeg &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;.mp4 &lt;span class="nt"&gt;-c&lt;/span&gt; copy &lt;span class="nt"&gt;-movflags&lt;/span&gt; +faststart out.mov
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What happened instead: a full re-encode
&lt;/h2&gt;

&lt;p&gt;Our converter's page states it plainly: the video is re-encoded as H.264 + AAC in a QuickTime MOV container. A general-purpose converter has good reasons to do this: it has to accept &lt;em&gt;any&lt;/em&gt; MP4, including HEVC, variable-frame-rate phone footage and unusual audio codecs, and still output something editors like Final Cut Pro and iMovie open reliably. The result in this test:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Input MP4&lt;/th&gt;
&lt;th&gt;Output MOV&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Size&lt;/td&gt;
&lt;td&gt;80.5 MB&lt;/td&gt;
&lt;td&gt;144.4 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Duration&lt;/td&gt;
&lt;td&gt;1:00&lt;/td&gt;
&lt;td&gt;1:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Video&lt;/td&gt;
&lt;td&gt;1080p&lt;/td&gt;
&lt;td&gt;H.264 1080p30&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Avg bitrate (calculated)&lt;/td&gt;
&lt;td&gt;~11.3 Mbps&lt;/td&gt;
&lt;td&gt;~20.2 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5r9jb4yml46v1hraej17.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5r9jb4yml46v1hraej17.png" alt="MOV output: H.264 1080p30, 1:00, ready for Final Cut Pro or iMovie" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The encoder ran with &lt;strong&gt;quality-first&lt;/strong&gt; settings. In constant-quality modes, the bitrate is an &lt;em&gt;output&lt;/em&gt; of the encode, not an input. The encoder estimates what it needs to keep the decoded source looking the same, and the source here was an already-efficient H.264 encode. Re-encoding that faithfully took roughly 1.8× the bits, for two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The new encoder can't see the original scene, only the decoded frames.&lt;/strong&gt; Compression artifacts in the source, like faint blocking and smoothed texture, now look like detail worth preserving.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quality-first settings are tuned for "don't lose anything".&lt;/strong&gt; For a file headed into an editor, that's the right bias. Editors and later exports will compress again, so you want headroom.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's also why the same pattern showed up elsewhere in our tests: an XviD AVI grew from 80.3 MB to 114.5 MB when converted to MP4.&lt;/p&gt;

&lt;h2&gt;
  
  
  When you need a re-encode (and when you don't)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Situation&lt;/th&gt;
&lt;th&gt;Remux (&lt;code&gt;-c copy&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;Re-encode&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;H.264/AAC MP4 → MOV for an Apple editor&lt;/td&gt;
&lt;td&gt;✅ usually enough&lt;/td&gt;
&lt;td&gt;only if the editor complains&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HEVC or VFR source and the editor stutters&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅ (constant frame rate, edit-friendly)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Audio codec not allowed in MOV/MP4 (e.g. Opus in some players)&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅ audio only: &lt;code&gt;-c:v copy -c:a aac&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Need a smaller file&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅, but use target-size compression, not a converter&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A partial re-encode is often the sweet spot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Keep video bits untouched, fix only the audio&lt;/span&gt;
ffmpeg &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;.mp4 &lt;span class="nt"&gt;-c&lt;/span&gt;:v copy &lt;span class="nt"&gt;-c&lt;/span&gt;:a aac &lt;span class="nt"&gt;-b&lt;/span&gt;:a 192k out.mov
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check first, decide second:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ffprobe &lt;span class="nt"&gt;-v&lt;/span&gt; error &lt;span class="nt"&gt;-select_streams&lt;/span&gt; v:0 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-show_entries&lt;/span&gt; &lt;span class="nv"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;codec_name,profile,r_frame_rate,avg_frame_rate,bit_rate &lt;span class="nt"&gt;-of&lt;/span&gt; &lt;span class="nv"&gt;default&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;nw&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="k"&gt;in&lt;/span&gt;.mp4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;codec_name=h264&lt;/code&gt; and &lt;code&gt;r_frame_rate&lt;/code&gt; equals &lt;code&gt;avg_frame_rate&lt;/code&gt; (constant frame rate), a remux to MOV will almost certainly open fine in Final Cut or iMovie.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why tools don't always remux
&lt;/h2&gt;

&lt;p&gt;If remuxing is faster and lossless, why would any converter re-encode? Because a remux only works when every stream is legal in the target container and plays well in the target app. A general-purpose online converter can't ask you whether your MP4 is HEVC with variable frame rate. So it picks the path that always produces an editor-friendly file, and accepts a bigger output. As a developer, if you control the input, remux. If you don't, re-encode and be honest with users about the size.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;MP4 and MOV share the same box structure. The container switch itself costs almost nothing.&lt;/li&gt;
&lt;li&gt;The size jump (80.5 → 144.4 MB in our test) comes from a quality-first &lt;strong&gt;re-encode&lt;/strong&gt;, where bitrate is an output.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;-c copy&lt;/code&gt; when codecs are already compatible, and an audio-only re-encode when only audio is the problem.&lt;/li&gt;
&lt;li&gt;For a smaller file, compress to a target size. Converting won't do it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you need the editor-friendly path without touching the command line, the &lt;a href="https://compressvid.io/mp4-to-mov" rel="noopener noreferrer"&gt;MP4 to MOV converter&lt;/a&gt; works online with nothing to install. Just expect the output to be larger, for the reasons above.&lt;/p&gt;

</description>
      <category>video</category>
      <category>ffmpeg</category>
      <category>macos</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Cortar antes de comprimir: por que vídeos longos do celular ficam melhores assim</title>
      <dc:creator>CompressVid</dc:creator>
      <pubDate>Wed, 11 Nov 2026 02:56:46 +0000</pubDate>
      <link>https://dev.to/compressvid/cortar-antes-de-comprimir-por-que-videos-longos-do-celular-ficam-melhores-assim-b0a</link>
      <guid>https://dev.to/compressvid/cortar-antes-de-comprimir-por-que-videos-longos-do-celular-ficam-melhores-assim-b0a</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Transparência: eu faço parte da equipe do &lt;a href="https://compressvid.io/pt-br" rel="noopener noreferrer"&gt;CompressVid&lt;/a&gt;, um compressor de vídeo online. Os exemplos abaixo usam as nossas próprias ferramentas. As taxas de bits são contas minhas (&lt;code&gt;tamanho × 8 ÷ duração&lt;/code&gt;), não medições de um laboratório.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Vídeo da apresentação da escola, da viagem, da reunião gravada no celular… e na hora de mandar, o arquivo é grande demais.&lt;/p&gt;

&lt;p&gt;A reação comum é jogar o vídeo inteiro num compressor e torcer. Funciona, mas quase sempre existe um jeito melhor: &lt;strong&gt;primeiro tirar o que não precisa, depois comprimir&lt;/strong&gt;. Neste post explico o porquê com uma conta simples.&lt;/p&gt;

&lt;h2&gt;
  
  
  O tamanho do arquivo é um orçamento
&lt;/h2&gt;

&lt;p&gt;De forma bem resumida:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tamanho do arquivo ≈ taxa de bits média × duração
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ou, invertendo, se você tem um limite fixo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;taxa de bits disponível ≈ limite (MB) × 8 ÷ duração (s)   → resultado em Mbps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pegando como exemplo um alvo de 90 MB (o atalho "90 MB WhatsApp" que usamos no teste abaixo):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Duração do vídeo&lt;/th&gt;
&lt;th&gt;Taxa de bits média que cabe em 90 MB&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;50 s&lt;/td&gt;
&lt;td&gt;≈ 14,4 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1 min&lt;/td&gt;
&lt;td&gt;≈ 12 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5 min&lt;/td&gt;
&lt;td&gt;≈ 2,4 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Mesmo limite, mas o vídeo de 5 minutos tem &lt;strong&gt;cinco vezes menos dados por segundo&lt;/strong&gt; que o de 1 minuto. É aí que cenas com muito movimento, grão e texto pequeno começam a virar blocos.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cortar primeiro aumenta o orçamento por segundo
&lt;/h2&gt;

&lt;p&gt;Se de um vídeo de 5 minutos você só quer mostrar 1 minuto, cortar esse minuto antes e depois comprimir para 90 MB dá ao trecho cerca de 5× mais taxa de bits. O mesmo arquivo final, só que muito mais nítido no que importa.&lt;/p&gt;

&lt;p&gt;O mesmo raciocínio vale para a imagem: se metade da tela é parede, borda preta ou barra de status, você está gastando orçamento com pixels que ninguém quer ver.&lt;/p&gt;

&lt;h2&gt;
  
  
  Um teste real (sem conta, como visitante)
&lt;/h2&gt;

&lt;p&gt;Para o nosso vídeo de apresentação em português, comprimimos um clipe de teste de 50 s em 1080p:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Original&lt;/th&gt;
&lt;th&gt;Depois&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Tamanho (mostrado na ferramenta)&lt;/td&gt;
&lt;td&gt;191,58 MB&lt;/td&gt;
&lt;td&gt;80,80 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Resolução&lt;/td&gt;
&lt;td&gt;1920×1080, 30 fps&lt;/td&gt;
&lt;td&gt;1920×1080, 30 fps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Taxa de bits total (calculada)&lt;/td&gt;
&lt;td&gt;~32 Mbps&lt;/td&gt;
&lt;td&gt;~13,6 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Configuração&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;Básico → "90 MB WhatsApp" (H.264)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tempo do envio até o download&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;~33 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Cerca de 58% menor e sem marca d'água. O clipe tinha grão fino de propósito; no zoom de 100–150% o grão ficou mais suave, o que é o esperado com ~14 Mbps. Com 5 minutos no mesmo alvo, o orçamento cairia para ~2,4 Mbps, e aí a diferença apareceria bem mais.&lt;/p&gt;

&lt;p&gt;O vídeo do teste completo está aqui: &lt;a href="https://youtu.be/EJqAIBqHldI" rel="noopener noreferrer"&gt;https://youtu.be/EJqAIBqHldI&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Passo a passo (funciona no navegador do celular)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Corte o tempo que sobra.&lt;/strong&gt;&lt;br&gt;
Em &lt;a href="https://compressvid.io/pt-br/cortar-video" rel="noopener noreferrer"&gt;Cortar vídeo&lt;/a&gt; você marca início e fim (até centésimos de segundo), confere na prévia e pode aplicar fade de entrada e saída no áudio. Cada processamento exporta um único trecho contínuo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Tire as bordas ou ajuste a resolução.&lt;/strong&gt;&lt;br&gt;
Se tem coisa sobrando na imagem, &lt;a href="https://compressvid.io/pt-br/recortar-video" rel="noopener noreferrer"&gt;Recortar vídeo&lt;/a&gt; mantém só a área que você escolher (16:9, 9:16, 1:1 ou 4:3). Se o vídeo vai ser visto só no celular, &lt;a href="https://compressvid.io/pt-br/redimensionar-video" rel="noopener noreferrer"&gt;Redimensionar vídeo&lt;/a&gt; para 720p costuma ajudar; lembre que redimensionar não corta a imagem: se a proporção mudar, entram bordas.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Por último, comprima até o limite.&lt;/strong&gt;&lt;br&gt;
No &lt;a href="https://compressvid.io/pt-br" rel="noopener noreferrer"&gt;compressor de vídeo do CompressVid&lt;/a&gt; você escolhe o tamanho alvo em MB (por exemplo, 90 MB) e baixa o resultado. É online, sem instalar nada.&lt;/p&gt;

&lt;p&gt;E se o que você quer mandar são só 3 ou 4 segundos em loop, sem som, &lt;a href="https://compressvid.io/pt-br/video-para-gif" rel="noopener noreferrer"&gt;Vídeo para GIF&lt;/a&gt; aceita trechos de até 15 s. Atenção: GIF costuma ficar &lt;strong&gt;maior&lt;/strong&gt; que um MP4 do mesmo trecho.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cuidados
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cortar não garante um arquivo menor.&lt;/strong&gt; O trecho é recodificado com qualidade fixa, então um pedaço curto pode até ficar maior que o original. Se existe um limite em MB, o passo 3 é o que garante o tamanho; confira o arquivo final.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Baixe logo.&lt;/strong&gt; O link de download vale por cerca de 4 horas.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guarde o original.&lt;/strong&gt; Se o resultado não agradar, refazer a partir do original fica melhor do que comprimir de novo o que já foi comprimido.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confira começo e fim&lt;/strong&gt; do trecho cortado para não cortar alguém no meio da frase.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;H.264 é o mais seguro&lt;/strong&gt; para aparelhos antigos; H.265 economiza mais, mas pode não abrir em todo lugar.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Resumo
&lt;/h2&gt;

&lt;p&gt;Com um limite fixo em MB, cada segundo e cada pixel a mais divide o mesmo orçamento. Cortar o tempo, tirar o que sobra da imagem e só então comprimir é a forma mais simples de o trecho que importa chegar nítido.&lt;/p&gt;

&lt;p&gt;Se você tiver um caso diferente (limite de e-mail, Discord, Status do WhatsApp), conta nos comentários que eu faço a conta junto.&lt;/p&gt;

</description>
      <category>portuguese</category>
      <category>brasil</category>
      <category>video</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Containers vs Codecs: Why "Convert to MP4" Can Shrink a File by 77% or Grow It by 79%</title>
      <dc:creator>CompressVid</dc:creator>
      <pubDate>Thu, 05 Nov 2026 12:00:00 +0000</pubDate>
      <link>https://dev.to/compressvid/containers-vs-codecs-why-convert-to-mp4-can-shrink-a-file-by-77-or-grow-it-by-79-3546</link>
      <guid>https://dev.to/compressvid/containers-vs-codecs-why-convert-to-mp4-can-shrink-a-file-by-77-or-grow-it-by-79-3546</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Disclosure: I work on &lt;a href="https://compressvid.io/" rel="noopener noreferrer"&gt;CompressVid&lt;/a&gt;, an online video toolkit. Every number here comes from our own test files. Sizes are as shown by the tool, which counts in MiB (1 MiB = 1,048,576 bytes). The bitrates are my own arithmetic: &lt;code&gt;size × 8 / duration&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;"Just convert it to MP4, it'll be smaller" is one of those tips that is right often enough to survive. We ran five conversions while testing our converters. Two shrank the file a lot, one shrank it moderately, and two made it &lt;strong&gt;much bigger&lt;/strong&gt;. Once you separate &lt;em&gt;containers&lt;/em&gt; from &lt;em&gt;codecs&lt;/em&gt;, the pattern makes complete sense.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two layers in every video file
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;th&gt;Examples&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Container&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The box: it interleaves streams, stores timestamps and indexes, and holds metadata&lt;/td&gt;
&lt;td&gt;MP4, MOV, MKV, WebM, AVI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Codec&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The compression algorithm for each stream&lt;/td&gt;
&lt;td&gt;H.264, HEVC (H.265), VP9, AV1, XviD; AAC, Opus, MP3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The container contributes very little to the file size, usually a small fraction of a percent for the index and headers. The bytes are in the encoded streams, so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;size ≈ (video bitrate + audio bitrate) × duration
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"Converting" can mean two very different operations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Remux:&lt;/strong&gt; copy the existing streams into a new box (&lt;code&gt;ffmpeg -i in.mkv -c copy out.mp4&lt;/code&gt;). The size barely changes, and there is no quality loss. It only works when the target container supports the codecs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transcode:&lt;/strong&gt; decode and re-encode, usually to H.264 + AAC for compatibility. Size is now set by whatever bitrate or quality the &lt;strong&gt;new encode&lt;/strong&gt; chooses.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most "convert to MP4" tools transcode, because their job is "plays everywhere", and that means H.264.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five real conversions
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Conversion&lt;/th&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;th&gt;Change&lt;/th&gt;
&lt;th&gt;Avg bitrate in → out&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;WebM (VP9/Opus) → MP4, 40 s 1080p&lt;/td&gt;
&lt;td&gt;39.9 MB&lt;/td&gt;
&lt;td&gt;9.2 MB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−77%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~8.4 → ~1.9 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HEVC MOV → H.264 MP4, 30 s&lt;/td&gt;
&lt;td&gt;50.3 MB&lt;/td&gt;
&lt;td&gt;26.0 MB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−48%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~14.1 → ~7.3 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MKV → MP4 (H.264 1080p30 + AAC), 45 s&lt;/td&gt;
&lt;td&gt;65.5 MB&lt;/td&gt;
&lt;td&gt;37.4 MB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−43%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~12.2 → ~7.0 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AVI (XviD/MP3) → MP4 (H.264 720p30 + AAC), 1:00&lt;/td&gt;
&lt;td&gt;80.3 MB&lt;/td&gt;
&lt;td&gt;114.5 MB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+43%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~11.2 → ~16.0 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MP4 → MOV (H.264 1080p30), 1:00&lt;/td&gt;
&lt;td&gt;80.5 MB&lt;/td&gt;
&lt;td&gt;144.4 MB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+79%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~11.3 → ~20.2 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F81azdaj80qfskab95ix3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F81azdaj80qfskab95ix3.png" alt="Video converter result: MKV converted to a 37.4 MB MP4" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Look at the last column. Every size change is fully explained by the change in &lt;strong&gt;average bitrate&lt;/strong&gt;. The extension didn't do anything by itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why some shrink
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The WebM&lt;/strong&gt; came from a source with a fairly generous bitrate for its content. The H.264 re-encode decided it needed far fewer bits for acceptable quality and dropped to roughly a quarter.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The HEVC MOV&lt;/strong&gt; is the interesting one. HEVC is generally more efficient than H.264, so you might expect the H.264 file to be &lt;em&gt;bigger&lt;/em&gt;. It wasn't, because phone recordings use high real-time bitrates (hardware encoders favour speed over efficiency). A slower H.264 encode at quality-oriented settings still undercut it. Codec efficiency comparisons only hold at equal quality, and the phone's file wasn't anywhere near the efficiency frontier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The MKV&lt;/strong&gt; shrank for the same reason. Its source bitrate was higher than the re-encode needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why some grow
&lt;/h2&gt;

&lt;p&gt;A transcode with quality-first settings (constant-quality modes like CRF) doesn't look at the input's bitrate. It spends whatever it takes to keep the new encode close to the decoded source. When the source was already &lt;strong&gt;compact&lt;/strong&gt;, like an old XviD AVI at a modest bitrate or an efficiently encoded MP4, the new encode can easily choose a &lt;em&gt;higher&lt;/em&gt; bitrate than the original.&lt;/p&gt;

&lt;p&gt;Two extra effects are worth knowing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Generation loss costs bits.&lt;/strong&gt; The new encoder sees the old codec's artifacts (blocking, ringing) as real detail and spends bits preserving them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quality targets are absolute; source bitrates aren't.&lt;/strong&gt; CRF 18 and CRF 23 mean "this quality level", not "this fraction of the input".&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The MP4 → MOV case gets its own post, because it's a perfect example of a conversion that didn't need to re-encode at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  A decision table for developers
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Need different codec support?  ──no──▶  remux (-c copy): same size, lossless
          │yes
          ▼
Need a specific size?  ──yes──▶  target-size compression (bitrate = size × 8 / duration)
          │no
          ▼
Transcode at constant quality: size is whatever the content needs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Checking what's inside before you convert saves surprises:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ffprobe &lt;span class="nt"&gt;-v&lt;/span&gt; error &lt;span class="nt"&gt;-show_entries&lt;/span&gt; &lt;span class="nv"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;codec_name,bit_rate,width,height &lt;span class="se"&gt;\&lt;/span&gt;
        &lt;span class="nt"&gt;-show_entries&lt;/span&gt; &lt;span class="nv"&gt;format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;duration,size,bit_rate &lt;span class="nt"&gt;-of&lt;/span&gt; compact &lt;span class="k"&gt;in&lt;/span&gt;.avi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;format=bit_rate&lt;/code&gt; is low and &lt;code&gt;codec_name&lt;/code&gt; is something old like &lt;code&gt;mpeg4&lt;/code&gt; (XviD) or &lt;code&gt;msmpeg4v3&lt;/code&gt;, expect a quality-first H.264 transcode to come out larger.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same AVI, compressed instead
&lt;/h2&gt;

&lt;p&gt;For contrast, the same 80.28 MB AVI went through a &lt;strong&gt;compressor&lt;/strong&gt; with a 10 MB target. It came out at &lt;strong&gt;9.77 MB&lt;/strong&gt; (~1.4 Mbps average) as an H.264 MP4, versus 114.5 MB from the converter. Same input, same output container, same codec family. The only difference is the bitrate the encoder was told to spend.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Containers are boxes. The size lives in the codec streams and their bitrate.&lt;/li&gt;
&lt;li&gt;"Convert" is either remux (size unchanged) or transcode (size follows the new bitrate).&lt;/li&gt;
&lt;li&gt;Transcoding a high-bitrate source usually shrinks it. Transcoding a compact source can grow it, by as much as +79% in our tests.&lt;/li&gt;
&lt;li&gt;If size is the goal, ask for a size, not a format.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you'd rather see these effects on your own files than run ffprobe, our &lt;a href="https://compressvid.io/video-converter" rel="noopener noreferrer"&gt;online video converter&lt;/a&gt; shows input and output sizes for each conversion, with nothing to install. It's a handy way to spot the "it got bigger" cases before you batch a folder.&lt;/p&gt;

</description>
      <category>video</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Target-Size Video Compression Is Just Division: The Bitrate Math (With Real Results)</title>
      <dc:creator>CompressVid</dc:creator>
      <pubDate>Thu, 29 Oct 2026 12:00:00 +0000</pubDate>
      <link>https://dev.to/compressvid/target-size-video-compression-is-just-division-the-bitrate-math-with-real-results-4ff6</link>
      <guid>https://dev.to/compressvid/target-size-video-compression-is-just-division-the-bitrate-math-with-real-results-4ff6</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Disclosure: I work on &lt;a href="https://compressvid.io/" rel="noopener noreferrer"&gt;CompressVid&lt;/a&gt;, an online video compressor. The numbers below are from our own test runs, recorded while making tutorial videos. I've noted which figures come from the tool's UI and which are my own arithmetic.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;"Compress this video to 24 MB" sounds like a fuzzy, magic request. It isn't. Because a compressed video's size is almost entirely set by its &lt;strong&gt;bitrate&lt;/strong&gt;, a target size is just a bitrate budget, and you get the budget by dividing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one formula
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;file size (bits) ≈ (video bitrate + audio bitrate) × duration + container overhead
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rearrange it, and a size target becomes a bitrate target:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;video bitrate ≈ (target bytes × 8) / duration − audio bitrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To keep the arithmetic simple, this post uses 1 MB = 1,000,000 bytes and 1 Mbps = 1,000,000 bits/s. CompressVid actually displays sizes in binary megabytes (MiB, 1,048,576 bytes, about 4.9% bigger), so the true bitrates of the files below are roughly 5% higher than the figures in the table. The ratios and conclusions don't change. The MB/MiB gap matters when a limit is hard, though, and it's one reason to leave headroom.&lt;/p&gt;

&lt;h2&gt;
  
  
  A worked example in JavaScript
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Returns the average video bitrate (kbps) needed to hit a target size.&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;videoBitrateForTarget&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;targetMB&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;durationSec&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;audioKbps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;128&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;overheadPct&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;usableBits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;targetMB&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;e6&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;overheadPct&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;totalKbps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;usableBits&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;durationSec&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&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;max&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;totalKbps&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;audioKbps&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;videoBitrateForTarget&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;targetMB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;durationSec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;  &lt;span class="c1"&gt;// ≈ 6143 kbps&lt;/span&gt;
&lt;span class="nf"&gt;videoBitrateForTarget&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;targetMB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;durationSec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;  &lt;span class="c1"&gt;// ≈ 4053 kbps&lt;/span&gt;
&lt;span class="nf"&gt;videoBitrateForTarget&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;targetMB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;96&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;durationSec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;180&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt; &lt;span class="c1"&gt;// ≈ 4053 kbps&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The 2% overhead and 128 kbps audio here are assumptions for illustration. Real overhead depends on the container and the stream count.&lt;/p&gt;

&lt;p&gt;Look at the last two calls: a 24 MB target for 45 seconds and a 96 MB target for 3 minutes give the &lt;strong&gt;same&lt;/strong&gt; bitrate budget. Size limits are really bits-per-second limits in disguise. A longer clip under the same cap simply gets fewer bits for every second.&lt;/p&gt;

&lt;p&gt;With ffmpeg, the classic way to spend a budget precisely is two-pass encoding:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ffmpeg &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;.mp4 &lt;span class="nt"&gt;-c&lt;/span&gt;:v libx264 &lt;span class="nt"&gt;-b&lt;/span&gt;:v 4053k &lt;span class="nt"&gt;-pass&lt;/span&gt; 1 &lt;span class="nt"&gt;-an&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; mp4 /dev/null
ffmpeg &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;.mp4 &lt;span class="nt"&gt;-c&lt;/span&gt;:v libx264 &lt;span class="nt"&gt;-b&lt;/span&gt;:v 4053k &lt;span class="nt"&gt;-pass&lt;/span&gt; 2 &lt;span class="nt"&gt;-c&lt;/span&gt;:a aac &lt;span class="nt"&gt;-b&lt;/span&gt;:a 128k out.mp4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What actually happened on real files
&lt;/h2&gt;

&lt;p&gt;Here are four runs from our tests. Input and output sizes are as the tool reported them. Bitrates are my own division, using &lt;code&gt;size × 8 / duration&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;th&gt;Input avg bitrate&lt;/th&gt;
&lt;th&gt;Budget&lt;/th&gt;
&lt;th&gt;Output avg bitrate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;135.95 MB, 30 s, 1080p60 MOV&lt;/td&gt;
&lt;td&gt;24 MB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;7.48 MB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~36.3 Mbps&lt;/td&gt;
&lt;td&gt;~6.4 Mbps&lt;/td&gt;
&lt;td&gt;~2.0 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;65.05 MB, 45 s, 1080p MP4&lt;/td&gt;
&lt;td&gt;24 MB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;21.08 MB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~11.6 Mbps&lt;/td&gt;
&lt;td&gt;~4.3 Mbps&lt;/td&gt;
&lt;td&gt;~3.7 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;185.24 MB, 3:00, 1080p MP4&lt;/td&gt;
&lt;td&gt;96 MB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;32.08 MB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~8.2 Mbps&lt;/td&gt;
&lt;td&gt;~4.3 Mbps&lt;/td&gt;
&lt;td&gt;~1.4 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;185.24 MB, 3:00, 1080p MP4&lt;/td&gt;
&lt;td&gt;"70% smaller" (55.6 MB)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;23.86 MB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~8.2 Mbps&lt;/td&gt;
&lt;td&gt;~2.5 Mbps&lt;/td&gt;
&lt;td&gt;~1.1 Mbps&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuxpki0ioxjtgt1lxauyf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuxpki0ioxjtgt1lxauyf.png" alt="Before and after: a 65.05 MB clip compressed to 21.08 MB with a 24 MB target" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The 45-second clip used about 88% of its budget. The iPhone MOV used about 31%. Same tool, same target, very different outcomes. Why?&lt;/p&gt;

&lt;h2&gt;
  
  
  The target is a ceiling, not a goal
&lt;/h2&gt;

&lt;p&gt;A size target is a &lt;strong&gt;maximum&lt;/strong&gt;. Modern encoders don't pad a file just to reach a number. In quality-driven modes (CRF in x264/x265, or a capped CRF with &lt;code&gt;-maxrate&lt;/code&gt;/&lt;code&gt;-bufsize&lt;/code&gt;), the encoder spends bits only where the picture needs them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Phone footage is over-provisioned.&lt;/strong&gt; The 1080p60 MOV started at ~36 Mbps, a bitrate chosen so the phone can encode in real time with little effort. A slower encoder can describe the same scene in far fewer bits, so it never needed the 6.4 Mbps it was allowed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content complexity decides the rest.&lt;/strong&gt; Static or slow-moving shots compress very well. Lots of motion, grain or fine texture eats bits. The 45-second clip sat much closer to its ceiling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Same input, different targets, both under.&lt;/strong&gt; The 3-minute file landed at 32.08 MB with a 96 MB cap and at 23.86 MB with a 55.6 MB cap. Both runs stayed at 1080p and kept the full 3:00.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F46t6uf3r6hm4merr2hi7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F46t6uf3r6hm4merr2hi7.png" alt="The '96 MB Chat' target selected for a 3-minute 1080p clip" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're building this yourself, a robust pattern is: &lt;strong&gt;compute the bitrate ceiling from the target, then let a quality-based rate control work beneath it.&lt;/strong&gt; Pure CBR or ABR will hit the number more literally, but it wastes bits on easy footage and can starve hard scenes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why you still need headroom
&lt;/h2&gt;

&lt;p&gt;Even with the maths right, the final file can overshoot slightly:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Container overhead&lt;/strong&gt; (MP4 &lt;code&gt;moov&lt;/code&gt; index, per-sample tables) grows with duration and frame count.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rate control isn't exact.&lt;/strong&gt; Single-pass ABR can drift by a few percent, and VBV buffers allow short bursts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MB vs MiB confusion&lt;/strong&gt;, as described above.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We learned this the hard way. An early build produced &lt;strong&gt;20.58 MB from a 19 MB target&lt;/strong&gt;. That has since been fixed, and the reason presets like "19 MB" for a 20 MB limit or "24 MB" for 25 MB exist at all is to leave a margin for exactly these effects. My rule of thumb: aim about 5% under any hard limit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Target size ÷ duration = bitrate budget. Subtract audio and overhead, and you have your video bitrate.&lt;/li&gt;
&lt;li&gt;Equal budgets can hide behind different-looking limits (24 MB for 45 s ≈ 96 MB for 3 min).&lt;/li&gt;
&lt;li&gt;Treat the target as a ceiling. Good encoders often finish well under it, especially on high-bitrate phone footage.&lt;/li&gt;
&lt;li&gt;Always leave headroom for container overhead and rate-control drift.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to watch the ceiling-versus-result behaviour on your own clips without writing any ffmpeg, the &lt;a href="https://compressvid.io/" rel="noopener noreferrer"&gt;CompressVid video compressor&lt;/a&gt; lets you type a target size and shows input and output sizes side by side. I'd be curious how close your footage gets to its budget. Drop your numbers in the comments.&lt;/p&gt;

</description>
      <category>video</category>
      <category>ffmpeg</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
