Convert any video to an ultra-lightweight WebM that blends seamlessly into web pages.
Project description
airclip
Convert any video to an ultra-lightweight WebM that blends seamlessly into web pages.
30 seconds of video → ~50-200 KB without visible quality loss.
Why
Embedding videos on the web usually means large files, slow loads, and visible player chrome. airclip solves this for animation and diagram content:
| Metric | Before | After |
|---|---|---|
| 30s video | ~1-3 MB | ~50-200 KB |
| Format | MP4 (H.264) | WebM (VP9) |
| FPS | 60 | 24 |
| Resolution | 1080p | 720p |
| Audio | Included | Stripped |
The output blends into dark backgrounds — no borders, no player UI, just content that looks native to the page.
How it works
- VP9 encoding — modern codec designed for web, much better compression than H.264
- High CRF — animation content (solid backgrounds, vector shapes) compresses extremely well at CRF 35-45
- Reduced framerate — 24fps is visually identical to 60fps for slides and diagrams
- Downscale to 720p — on web, nobody notices the difference from 1080p
- Two-pass encoding — analyzes content first, then allocates bits where they matter
- No audio — animations don't need it, saves ~30% file size
Install
pip install imageio-ffmpeg
Or have ffmpeg available on your PATH.
Usage
# Single file
python -m airclip video.mp4
# Entire directory
python -m airclip videos/
# Custom settings
python -m airclip video.mp4 --fps 15 --crf 42 --height 480
# Fast mode (skip 2-pass, ~2x faster)
python -m airclip video.mp4 --no-2pass
# Output to a different directory
python -m airclip videos/ --outdir dist/
As a library
from airclip import convert_lightweight
result = convert_lightweight(
"input.mp4",
output_path="output.webm",
target_fps=24,
crf=38,
max_height=720,
)
print(f"{result['input_kb']:.0f} KB → {result['output_kb']:.0f} KB")
print(f"{result['ratio']:.1f}x smaller")
Options
| Flag | Default | Description |
|---|---|---|
--fps |
24 | Target framerate. Use 15 for near-static content. |
--crf |
38 | Quality level. Higher = smaller. 35-45 works well for animations. |
--height |
720 | Max output height in pixels. |
--no-2pass |
off | Skip 2-pass encoding (faster, slightly larger output). |
--outdir |
same as input | Output directory for converted files. |
CRF guide
| CRF | Quality | Best for |
|---|---|---|
| 30-34 | High | Live action, complex motion |
| 35-38 | Good | Animations with fine detail |
| 39-42 | Small | Diagrams, slides, code demos |
| 43-50 | Tiny | Static content, simple shapes |
Embedding on web
The output is designed to look native on dark-themed pages:
<video autoplay muted loop playsinline>
<source src="animation.webm" type="video/webm">
<source src="animation.mp4" type="video/mp4"> <!-- fallback -->
</video>
video {
width: 100%;
background: transparent;
border: none;
border-radius: 12px;
}
For autoplay-on-scroll:
const observer = new IntersectionObserver((entries) => {
entries.forEach(e => {
e.isIntersecting ? e.target.play() : e.target.pause();
});
}, { threshold: 0.5 });
document.querySelectorAll('video').forEach(v => observer.observe(v));
Best results when
- Background is a solid or near-solid color (dark themes work great)
- Content is vector-like: shapes, text, diagrams, code
- Motion is smooth and predictable (not chaotic)
- No audio needed
Results
Across 6 test videos: ~1.2 MB → ~93 KB average (12x compression). No visible quality loss in browser playback.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file airclip-0.1.0.tar.gz.
File metadata
- Download URL: airclip-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e3d9484bc4502e3467c0ad246ece42507b16a977dca6480f17b0a31536a8b78
|
|
| MD5 |
314c33196c73e0275622ae395d99e287
|
|
| BLAKE2b-256 |
2bad04ea99ee5dbe53412df3359720724c33e935498c3b2badd6f1ede697f17f
|
File details
Details for the file airclip-0.1.0-py3-none-any.whl.
File metadata
- Download URL: airclip-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a570509c2b802557c0f344b97e98e206ae5b815646b64e69bf4e88ce7166190
|
|
| MD5 |
e85b803b0dfc8f15ca025012bb71e879
|
|
| BLAKE2b-256 |
d2f4493fe7383958955864c4c974ae4872f82d428e8a81508e4a1b2d966c50e0
|