---
title: "Video Compression and File Size Calculator - CE.SDK Glossary"
description: "Video compression stores a full picture now and then and only what changes between them. Compare H.264, H.265 and AV1, and estimate file size from bitrate."
url: "https://img.ly/glossary/video-compression/"
type: "page"
---

> This is the markdown version of [Video Compression and File Size Calculator - CE.SDK Glossary](https://img.ly/glossary/video-compression/). For all pages in one file, see [llms-full.txt](https://img.ly/llms-full.txt). For an index of all available pages, see [llms.txt](https://img.ly/llms.txt).

---

# Video Compression

## What Is Video Compression?

Video compression makes a video smaller by storing a full picture only now and then and, for the frames in between, only what changed, then rounding off detail that viewers are unlikely to miss. A codec does the work: its encoder compresses the video, and the decoder in a player or browser rebuilds each frame for playback.

Uncompressed, 1080p video at 30 frames per second runs to about 746 Mbps in 8-bit 4:2:0 color, while CE.SDK's Auto setting exports it at a bitrate of 8 Mbps, about 1% of that. The diagram shows six frames from one of our test exports, where the keyframe takes 210 KB and each frame after it a fraction of that.

## How Do You Calculate Video File Size?

Take the bitrate in Mbps, multiply it by the length in seconds and divide by 8 to get megabytes, then add the audio, which at 128 kbps, CE.SDK's default, comes to about 1 MB a minute.

When we exported one 9.7-second CE.SDK edit at bitrates from 2 to 50 Mbps, every file landed within half a percent of that sum. Below 2 Mbps the files came out larger: asking for 0.5 Mbps gave 1.46 MB instead of 0.77 MB, because the browser's encoder did not go that low for this edit.

### Bitrate × seconds ÷ 8 = megabytes

At 8 Mbps with 128 kbps audio, one minute of video comes to about 61 MB.

## Which Bitrate Should You Use?

Start from where the video is going. In our test edit, each halving of the bitrate cost about 3 dB of PSNR, a standard score for how closely frames match a reference, here a 50 Mbps export of the same edit. The moving water in the edit went soft long before the title text and flat shapes did.

- **Fit under a size limit**: Video bitrate: Limit × 8 ÷ seconds, minus the audio, Example: A 30-second clip under 25 MB can use up to 6.5 Mbps

- **Web or social clip**: Video bitrate: 1 to 2 Mbps (CE.SDK compress guide), Example: Our test edit at 2 Mbps: 2.6 MB, with the moving water visibly softer

- **HD video to download**: Video bitrate: 8 to 12 Mbps (CE.SDK compress guide), Example: The same edit at 8 Mbps: 9.9 MB, with the water crisp

- **Upload to YouTube at 1080p**: Video bitrate: 8 Mbps at 30 fps, 12 Mbps at 60 fps (YouTube), Example: CE.SDK's Auto setting uses the same 8 Mbps for 1080p at 30 fps

## How Does Video Compression Work?

An encoder such as H.264 takes every frame through four steps, and only one of them throws information away.

1. **Predict each frame from the ones around it** (Between frames): The encoder looks for blocks that already appeared in an earlier frame, perhaps shifted a little, and records a motion vector instead of the pixels. Frames built this way are P-frames, and B-frames may also borrow from a later frame. Every so often it stores a whole frame on its own, an I-frame, so a player has a place to start.

2. **Turn blocks of pixels into frequencies** (Within a frame): Whatever prediction could not explain is cut into small blocks, and a transform, usually a discrete cosine transform, rewrites each block as a few values for broad shapes and many for fine detail. In natural images most of the energy sits in the broad ones.

3. **Round off the fine detail** (The lossy step): Quantization stores those values with less precision and drops many of the fine ones to zero. A lower bitrate means coarser rounding, which is where blocky, smeared or banded video comes from. Lossless codecs skip this rounding, so their files come out several times larger.

4. **Give common values the shortest codes** (Packing): Entropy coding, such as the CABAC method in H.264, writes the most frequent values with the fewest bits. Nothing is lost here; the data is only packed more tightly.

## How Do H.264, H.265 and AV1 Compare?

All three follow the steps above. The newer ones predict and code more elaborately, so they reach the same quality at a lower bitrate but need more computing to encode.

### CE.SDK imports and exports: H.264 (AVC)

Published by the ITU in 2003, it plays in every major browser and many devices decode it in hardware, so it remains the safe choice for web and social video. Commercial use is licensed through a patent pool.

### CE.SDK imports: H.265 (HEVC)

Published in 2013, it reaches the same quality as H.264 with 25% to 50% less data, at the cost of heavier encoding. Its patents are split across more than one licensing pool.

### CE.SDK imports on the web: AV1

The Alliance for Open Media released it in 2018 as an open, royalty-free format. In a 2018 Facebook test it needed about half the bitrate of H.264 for similar quality, with much slower encoding. Safari plays it only on recent Apple hardware.

## How Video Compression Works in CE.SDK

[CE.SDK video editing](https://img.ly/products/video-sdk.md) exports H.264 video in an MP4 file on Web, iOS, Android and Server. Your app sets each export's size, frame rate and bitrate, and in the browser the encoding runs through the browser's own video encoder.

### Step 01: Pick a bitrate, or let Auto pick one

Each export sets its bitrate either as a number of bits per second or as one of two modes. Auto chooses a bounded rate from the size and frame rate: 5 Mbps at 720p, 8 at 1080p and 40 at 4K, all at 30 fps, and 12 at 1080p and 60 fps. The default, System, leaves the choice to the browser, which can pick a near-lossless rate that runs long exports out of memory. In our Chrome test, Auto at 1080p produced a file byte for byte identical to an 8 Mbps export, while System settled on about 4 Mbps. To see the size and frame rate choices Auto works from, open the [Video Export Options demo](https://img.ly/demos/video-export-options.md).

### Step 02: Show users the file size before they export

CE.SDK's compress guide recommends showing an estimated size before export, so users can weigh quality against upload time and storage. The formula above is enough for it, since our exports from 2 to 50 Mbps matched it within half a percent. For a bitrate under 2 Mbps, leave a margin or raise the bitrate.

### Step 03: Accept H.265 and AV1, deliver H.264

Users can bring in H.264 and H.265 footage on every platform, and AV1 and VP9 in the browser. Exports come out as H.264 MP4 with the Main profile by default, with Baseline for mobile-friendly playback and High for desktop and professional work. In our Chrome export, the browser's encoder placed a keyframe every 150 frames, which is 5 seconds at 30 fps, and used no B-frames.

## FAQs

### Video Compression

**Q: Is all video compression lossy?**

A: No. Lossless codecs rebuild every frame exactly, but they typically shrink video only 5 to 12 times, against 20 to 200 times for lossy H.264. That is why video streamed on the web and in apps is lossy, while lossless files stay in editing and archives.

**Q: What is a good bitrate for 1080p video?**

A: It depends on where the video goes. YouTube recommends uploading at 8 Mbps for 24 to 30 fps and 12 Mbps for 48 to 60 fps. The CE.SDK compress guide suggests 8 to 12 Mbps for HD downloads and 1 to 2 Mbps for web or social clips, and CE.SDK picks 8 Mbps when its Auto setting exports 1080p at 30 fps.

**Q: Why is my video file bigger than its bitrate suggests?**

A: Check the audio first: a 128 kbps track adds about 1 MB a minute. At very low bitrates the encoder may also stop short of the target, and in our test of a CE.SDK export in Chrome, asking for 0.5 Mbps produced a file almost twice the estimate.

**Q: Does H.265 make smaller files than H.264?**

A: At the same quality, yes: H.265 needs 25% to 50% less data. It takes more processing to encode, and not every device plays it. CE.SDK reads H.265 files on all its platforms but writes H.264, the codec every major browser plays.

**Q: What is a keyframe in video compression?**

A: A keyframe, or I-frame, is a frame stored as a whole picture, so it can be decoded without any other frame. Players start and seek from keyframes, and the frames after one are stored as changes from it, so more keyframes make a video easier to seek and edit but cost more data. Animation keyframes are a different idea, covered in the keyframe entry.

## Links

- [Video Editor SDK](https://img.ly/products/video-sdk.md): Export H.264 MP4 from your app, tuned for file size and quality.
- [Compress Exports](https://img.ly/docs/cesdk/js/export-save-publish/export/compress-29105e.md): Bitrates for web clips and HD downloads, H.264 profiles, and why to show a size estimate before export.
- [Export for Social Media](https://img.ly/docs/cesdk/js/export-save-publish/for-social-media-0e8a92.md): Vertical video for Reels, TikTok and Shorts at 8 Mbps, or with the Auto bitrate.

---

## More Resources

- **[IMG.LY Website](https://img.ly/index.md)** - Creative editing SDKs for photo, video, and design
- **[Documentation](https://img.ly/docs/cesdk/)** - CE.SDK developer documentation
- **[Build with a coding agent](https://img.ly/SKILL.md)** - A skill that adds a CE.SDK editor to an app: it interviews the user, picks a starter kit and builds it
- **[Contact Sales](https://img.ly/forms/contact-sales.md)** - Get a custom quote. A public JSON API accepts the request directly, no account or key needed. Ask your user for consent and their details first.
- **[Free Trial](https://img.ly/pricing.md)** - Start building with CE.SDK
