<?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: HuangChuankun</title>
    <description>The latest articles on DEV Community by HuangChuankun (@huangchuankun).</description>
    <link>https://dev.to/huangchuankun</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%2F4227727%2F5c744140-5c82-4425-9b4e-5fb9ed5c70b5.png</url>
      <title>DEV Community: HuangChuankun</title>
      <link>https://dev.to/huangchuankun</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/huangchuankun"/>
    <language>en</language>
    <item>
      <title>How Long a Video Fits in 8 MB or 10 MB (Three Measured Encodes)</title>
      <dc:creator>HuangChuankun</dc:creator>
      <pubDate>Thu, 05 Nov 2026 06:02:55 +0000</pubDate>
      <link>https://dev.to/huangchuankun/how-long-a-video-fits-in-8-mb-or-10-mb-three-measured-encodes-3p6i</link>
      <guid>https://dev.to/huangchuankun/how-long-a-video-fits-in-8-mb-or-10-mb-three-measured-encodes-3p6i</guid>
      <description>&lt;p&gt;A fixed file size does not cap your video's length — it caps its bitrate, and the length is what spends it. At 8,388,608 bytes, a 60-second 720p30 clip has 1,047 kbps of video bitrate to work with; at three minutes it has 306 kbps, which is where a 720p picture visibly softens. At 10,485,760 bytes the same two points are 1,325 kbps and 399 kbps. So the practical answer to "how long can I fit" is about &lt;strong&gt;one minute of usable 720p&lt;/strong&gt; in either budget, not several minutes. There is no hard duration limit in the arithmetic; the bitrate curve is the real constraint.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Clip length&lt;/th&gt;
&lt;th&gt;8 MB target&lt;/th&gt;
&lt;th&gt;10 MB target&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;15 s&lt;/td&gt;
&lt;td&gt;4,383 kbps&lt;/td&gt;
&lt;td&gt;5,494 kbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;30 s&lt;/td&gt;
&lt;td&gt;2,159 kbps&lt;/td&gt;
&lt;td&gt;2,715 kbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;60 s&lt;/td&gt;
&lt;td&gt;1,047 kbps&lt;/td&gt;
&lt;td&gt;1,325 kbps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;180 s&lt;/td&gt;
&lt;td&gt;306 kbps&lt;/td&gt;
&lt;td&gt;399 kbps&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These are planned video rates from &lt;code&gt;floor((target_bytes × 0.994 × 8 ÷ duration_s ÷ 1000) − 64)&lt;/code&gt;. The &lt;code&gt;0.994&lt;/code&gt; is a 0.6% reserve for MP4 container bytes; the &lt;code&gt;64&lt;/code&gt; is a 64 kbps audio allowance used below a 12 MB target. They are formula outputs, not measurements of every possible clip, and they are not a visual-quality benchmark. A clip with no audio track simply does not grow one — the allowance stays unused.&lt;/p&gt;

&lt;p&gt;That distinction matters because a target size is a byte budget, not a quality setting. Two clips that both land near 8 MB can look completely different if one is 15 seconds and the other is three minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three encodes that actually ran
&lt;/h2&gt;

&lt;p&gt;Most writing about target-size compression stops at the formula. Here are three runs through a browser FFmpeg.wasm build, with the byte counts, elapsed times and bitrates that came out of them.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Pass 1&lt;/th&gt;
&lt;th&gt;Retry&lt;/th&gt;
&lt;th&gt;Final output&lt;/th&gt;
&lt;th&gt;Elapsed&lt;/th&gt;
&lt;th&gt;Measured video bitrate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;10 MB (10,485,760 B)&lt;/td&gt;
&lt;td&gt;15,942,580 B, 1280x720 @ 30 fps, no audio&lt;/td&gt;
&lt;td&gt;8,274 kbps → 10,880,120 B (394,360 B over)&lt;/td&gt;
&lt;td&gt;7,032 kbps → 9,253,520 B (1,232,240 B under)&lt;/td&gt;
&lt;td&gt;9,253,520 B&lt;/td&gt;
&lt;td&gt;140 s&lt;/td&gt;
&lt;td&gt;7,399,220 bps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8 MB (8,388,608 B)&lt;/td&gt;
&lt;td&gt;15,942,580 B, 1280x720 @ 30 fps, no audio&lt;/td&gt;
&lt;td&gt;6,606 kbps → 8,685,880 B (297,272 B over)&lt;/td&gt;
&lt;td&gt;5,615 kbps → 7,345,513 B (1,043,095 B under)&lt;/td&gt;
&lt;td&gt;7,345,513 B&lt;/td&gt;
&lt;td&gt;223 s (117 + 106)&lt;/td&gt;
&lt;td&gt;5,872,840 bps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3 MB (3,145,728 B)&lt;/td&gt;
&lt;td&gt;5,407,489 B, 1920x1080 @ 60 fps, AAC stereo&lt;/td&gt;
&lt;td&gt;2,437 kbps → 3,138,651 B (9,077 B under)&lt;/td&gt;
&lt;td&gt;none needed&lt;/td&gt;
&lt;td&gt;3,138,651 B&lt;/td&gt;
&lt;td&gt;150 s&lt;/td&gt;
&lt;td&gt;2,432,889 bps video + 63,940 bps audio&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every final output landed at or under its target. The third run is the only one with an audio track and the only one that needed a single pass. The first two share the same input file, which makes them a direct comparison: dropping the ceiling from 10 MB to 8 MB lowered the first-attempt video bitrate from 8,274 to 6,606 kbps and the measured output bitrate from 7,399,220 to 5,872,840 bps.&lt;/p&gt;

&lt;p&gt;The elapsed times belong to one Windows / Node 22 machine with no GPU. They are a property of that machine, not a promise about yours, and they are included because a two-pass retry is not free: the 8 MB run took 223 seconds for a ten-second clip.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why one pass is not enough
&lt;/h2&gt;

&lt;p&gt;Two of the three runs overshot on the first attempt. x264 at a high bitrate can spend more than you asked for — 8,274 kbps produced 10,880,120 bytes against a 10,485,760-byte ceiling, and 6,606 kbps produced 8,685,880 bytes against 8,388,608. In both cases the retry tightened the video bitrate by exactly 15% (8,274 → 7,032 and 6,606 → 5,615) and landed under with headroom to spare.&lt;/p&gt;

&lt;p&gt;The useful lesson is not "lower the bitrate". It is that a target printed before encoding is a guess. The only thing that tells you the result is measuring the bytes after the encode and retrying once when the miss is outside tolerance. The 8 MB run's second pass came in 1,043,095 bytes under target — 12.4% of the budget left unused — which is the cost of a blunt 15% retry step, not a precision claim.&lt;/p&gt;

&lt;p&gt;Notice also that the 8 MB first attempt used 6,606 kbps, which is exactly what the formula gives for a ten-second clip at that target. The published arithmetic and the shipped encoder agree; what the formula cannot predict is how many bytes x264 actually writes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the 0.6% reserve comes from
&lt;/h2&gt;

&lt;p&gt;An MP4 is not only media. It carries headers and a &lt;code&gt;moov&lt;/code&gt; index of every frame, and those bytes come out of the budget whether you plan for them or not. Two earlier encodes at 3 MB and 2.8 MB targets landed 0.43% and 0.44% over their target with no reserve in the formula. The same 3 MB run came in 0.22% under once the reserve was added. That is the entire reason the constant exists — it is a measured correction for container overhead, not a fudge factor.&lt;/p&gt;

&lt;p&gt;Renaming a file or repackaging its container cannot do this job, because neither changes the byte count. Getting under a fixed ceiling requires re-encoding at a lower bitrate when the source is larger, and a source already below the ceiling should be handed back untouched rather than degraded.&lt;/p&gt;

&lt;h2&gt;
  
  
  What these three runs do not prove
&lt;/h2&gt;

&lt;p&gt;This is a check on the arithmetic, not a validation suite. All three clips are ten seconds long. Only two distinct input files appear: one 720p30 source without audio, and one 1080p60 source with it. There is no systematic set across durations, resolutions, frame rates, codecs or container conditions, and no independent third-party reproduction. Consistent target-size performance across the range of media people actually upload is &lt;strong&gt;not established&lt;/strong&gt; by this data.&lt;/p&gt;

&lt;p&gt;That is worth saying plainly because the numbers above are easy to over-read. A single 3 MB run with an audio track does not characterise how audio behaves at 8 MB. A ten-second clip says nothing about the three-minute row in the first table beyond what the formula computes. And a retry that worked twice is not evidence that it works for every source.&lt;/p&gt;

&lt;p&gt;The raw run records, ffprobe output and the script that rebuilds the CSVs are in &lt;a href="https://github.com/HuangChuankun/discord-video-size-data" rel="noopener noreferrer"&gt;discord-video-size-data&lt;/a&gt;, archived as &lt;a href="https://doi.org/10.5281/zenodo.23904986" rel="noopener noreferrer"&gt;10.5281/zenodo.23904986&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>webassembly</category>
      <category>ffmpeg</category>
    </item>
  </channel>
</rss>
