Communitygithub.com

Video Upscale CPU — General Video Enhancement Chain

A pure CPU ffmpeg repair chain for upscaling video to 2K, removing color banding, and fixing blurriness — works universally for motion graphics, 2D/3D animation, live action, screencasts, and movie clips. Zero VRAM, zero downloads, no AI, no registration.

What is Video Upscale CPU — General Video Enhancement Chain?

This skill provides a comprehensive, CPU-only ffmpeg repair chain designed to upscale any video to 2K while correcting common compression artifacts. It sequentially applies: deband to remove color banding, hqdn3d to reduce compression noise, lanczos scaling to 2560×1440, and CAS sharpening at 0.6. The chain runs entirely on CPU with no GPU dependency, making it suitable for any environment. It is triggered when users request "upscale", "fix blur", "remove banding", or "enhance resolution". The skill includes a one-click Python script that automates source probing, processing, and integrity checks, and also provides the equivalent manual ffmpeg command. It supports all video types: motion graphics, 2D/3D animation, live action, screencasts, and movie clips. For live action footage wanting maximum texture reconstruction, users can optionally layer AI super-resolution on top. Key caveats include correct lanczos syntax, waiting for moov index completion, and avoiding re-encoded sources from messengers. Validation uses frame-by-frame 1:1 comparison with edge energy ratio reporting.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/3378925604-a11y/video-upscale-cpu/tree/HEAD/.agents/skills/video-upscale-cpu

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

video-upscale-cpu — Video Upscaler (Pure CPU Universal Chain)

A battle-tested ffmpeg repair chain: deband → hqdn3d → lanczos scale to 2560×1440 → CAS 0.6 sharpening, x264 crf15, audio stream copy. Pure CPU, zero VRAM, speed about RTF 1~3 (161 seconds of footage runs in minutes). Universal for any video — motion graphics, animation, live action, screencasts, movie clips, all work.

Three Typical Artifacts Fixed

  1. Banding on dark backgrounds/gradients — deband treats it, common in animation and dark live action
  2. Blurry small text and edges from compression — lanczos+CAS treats it, benefits infographics, screencasts, subtitles
  3. Compression noise and general fuzziness — hqdn3d treats it

One-Click Script (wraps all gotchas)

python scripts/upscale2k.py <source video> [output path]

Dependencies: ffmpeg/ffprobe in PATH (download or winget install Gyan.FFmpeg); Pillow + numpy optional (only affects auto-validation comparison images).

The script automatically does: ffprobe source probe → target dimension calculation (if source height ≥1440, only repair, no upscale) → run chain → integrity check (moov readable / duration aligned / audio start_time=0) → output same-frame 1:1 comparison image (old version nearest neighbor resize to same size vs new version) + edge energy ratio report.

Manual Command (equivalent)

ffmpeg -y -i <source> -vf "deband,hqdn3d=1.5:1.5:6:6,scale=2560:1440:flags=lanczos,cas=0.6"   -c:v libx264 -crf 15 -preset medium -c:a copy <output>

Per-Content-Type Tweaks (optional, works without)

ContentSuggested Tweak
Motion graphics / infographics (dark bg, small text)Default works; if text too sharp, lower cas=0.6 to 0.4
2D animationDefault works; if banding heavy, stack one more deband
Live actionLower first two params of hqdn3d to 1 (preserve film grain); for pore-level texture reconstruction, optionally layer AI super-resolution
Screencast / tutorialDefault; if text blurry, focus on CAS

🔴 Three Hard Gotchas (all hit in practice)

  1. lanczos is not a standalone filter — must write scale=2560:1440:flags=lanczos; writing lanczos=2560:1440 gives Invalid argument.
  2. mp4 moov index written only at end of transcoding — opening output mid-run gives "Invalid data / cannot open"; it's not broken, wait for completion.
  3. Re-encoded copies cannot be used as source — WeChat/QQ etc. re-encodes and drops frames (measured 4842→4830 frames) + timestamp damage; pairing its video track with original audio causes audio/video desync (silent first few seconds). Desync check: ffprobe -select_streams a:0 -show_entries stream=start_time + silencedetect to check audio start.

Validation Criteria

  • Same-frame 1:1 pixel comparison: old version uses flags=neighbor resize to same size, edge energy ratio (new/old) in 1.05~1.15 is normal gain; significantly below 1.0 = chain working backward, check params.
  • Visually confirm small text edges and dark background banding in the comparison image; quantitative metrics are only supporting evidence.
  • Audio: output start_time=0 + volumedetect shows loudness in the first 3 seconds.

Related Skills