Sign inSign up

ricardolima1989/postfily-upscale

By ricardolima1989

Updated 7 months ago

Image
0

926

ricardolima1989/postfily-upscale repository overview

postfily-upscale

Pre-built Real-ESRGAN + FFmpeg image for rented, ephemeral GPU instances (Vast.ai and similar). It exists so a 4K video upscale job starts in about 30 seconds instead of spending roughly 10 minutes installing CUDA wheels on every new instance.

docker pull ricardolima1989/postfily-upscale:v1

Tag v1 — 4.98 GB, linux/amd64.

What is inside

LayerVersion
Basenvidia/cuda:12.1.1-runtime-ubuntu22.04
Python3.10 (Ubuntu 22.04 native)
PyTorchCUDA 12.1 wheels (cu121 index)
Upscalerrealesrgan + basicsr
WeightsRealESRGAN_x4plus.pth baked in at /workspace/upscale/
Videoffmpeg
Accesssshd started by CMD, keys injected by the host

Why Python 3.10 and not 3.13

basicsr still imports torchvision.transforms.functional_tensor, which newer torchvision builds no longer ship. On a Python 3.13 base the dependency solver lands on a torchvision that breaks Real-ESRGAN at import time, so the job dies on the first frame rather than at build time. Staying on the Ubuntu 22.04 native Python 3.10 avoids that whole class of resolution conflicts.

Why the weights are baked in

RealESRGAN_x4plus.pth (about 64 MB) is fetched at build time, not at boot. Rented instances are ephemeral and their egress to GitHub releases is frequently slow or rate-limited; downloading the checkpoint on boot was the most common cause of a stalled run. The build also writes /workspace/.ready, so an orchestrator can distinguish "provisioned" from "still installing" without guessing.

Usage

The container starts sshd and waits. Drive it over SSH:

ffmpeg -i input.mp4 -vsync 0 frames/%08d.png

python3 -m realesrgan.inference_realesrgan \
  -n RealESRGAN_x4plus \
  --model_path /workspace/upscale/RealESRGAN_x4plus.pth \
  -i frames -o frames_4k -s 4

ffmpeg -r 30 -i frames_4k/%08d.png -c:v libx264 -crf 16 out_4k.mp4

Tested on RTX 3090, RTX 4090, A6000, A100 and H100.

Who maintains it

Built and run in production by FalconVid, a service that generates and publishes long-form YouTube videos. This image is the 4K upscale stage of that pipeline. It is public because the build recipe is not the valuable part, and re-deriving the basicsr/torchvision conflict costs everyone the same afternoon.

Measured per-call cost data from the same pipeline is published as an open dataset: how much AI video costs to produce (526 production runs, 176,558 model API calls).

Licences

Contents follow their upstream projects: Real-ESRGAN (BSD-3-Clause), BasicSR (Apache-2.0), PyTorch (BSD-style), FFmpeg (LGPL or GPL depending on the build), CUDA runtime under the NVIDIA Deep Learning Container licence.

Tag summary

Content type

Image

Digest

sha256:dafc12dcf

Size

4.6 GB

Last updated

7 months ago

docker pull ricardolima1989/postfily-upscale:v1