Skip to content

Repository files navigation

DaSiWa True Video Enhancer

StarWatchFork

OSGPUPythonGoLicense

AMD / Intel / Apple Silicon / CPU-only inference are not supported — see the support matrix.

A local, NVIDIA-first video upscaling and frame-interpolation application. The Go server provides a browser UI; a uv-managed Python runtime runs the AI and FFmpeg pipeline.

It is designed for one video job at a time: select a local source, choose a target scale/FPS, and write a new encoded file. Nothing is uploaded.

DaSiWa True Video Enhancer Preview

Contents

What it does

  • AI video upscaling with bundled/downloadable Safetensors and ONNX models.
  • True 2x→4x processing: a native 2x model runs twice; the second pass is not a normal resize.
  • RIFE v4.26 frame interpolation for an arbitrary higher target FPS, including fractional conversions such as 24→60.
  • Bounded FFmpeg rawvideo decode → AI → encode streaming. It does not write a full PNG frame sequence.
  • TensorRT acceleration for CUDA upscalers, with tiled fallback when a full-frame engine cannot compile.
  • Local file browsing/search, runtime install/health checks, model downloads, live JPEG progress previews, output preview generation, and job cancellation.
  • Container-aware FFmpeg encoding with optional audio/subtitle copying or transcoding.

For architecture, model routing, limits, and encoder behavior, see docs/TECHNICAL_GUIDE.md.

Requirements

The supported inference runtime is NVIDIA CUDA on Linux:

  • NVIDIA GPU and working driver (nvidia-smi)
  • FFmpeg and FFprobe available on PATH
  • Network access on first runtime/model installation
  • Disk space for the uv Python environment, models, TensorRT cache, and output video

The app installs Python 3.12 (falls back to 3.11) and the project-pinned CUDA 13.2 PyTorch/TensorRT dependencies through uv. A CUDA-capable NVIDIA system is required for the shipped runtime; the Go web server itself is portable, but AMD, Intel, Apple Silicon, and CPU-only inference are not supported configurations.

Getting started

Clone and build the Go binary, then start it:

git clone https://github.com/darksidewalker/TrueVideoEnhancer.git
cd TrueVideoEnhancer
go build -o dasiwa-true-video-enhancer ./cmd/dasiwa-true-video-enhancer
./dasiwa-true-video-enhancer

Open http://127.0.0.1:8612 in your browser. The first run installs the Python runtime and models on demand — see Using the app for the in-app steps, and Configuration for the environment variables that control port, browser launch, and the TensorRT upscaler cache.

Run in a container

The container is the supported route for Docker, Podman, and Windows through Docker Desktop's Linux/WSL2 GPU backend. Native Windows is not supported by the pinned CUDA 13.2 PyTorch/TensorRT packages.

Prerequisites: an NVIDIA driver with GPU container support, then either Docker with NVIDIA Container Toolkit or Podman with NVIDIA CDI configured. Verify the host first with nvidia-smi.

./scripts/run.sh

run.sh detects the available engine, builds dasiwa/tve:latest when needed, and opens the service at http://127.0.0.1:8612. It uses --gpus all for Docker and --device nvidia.com/gpu=all for Podman. Set CONTAINER_ENGINE to force one engine, TVE_BUILD=1 to rebuild, TVE_PORT=8620 to change the host port, or TVE_GPU=0 for a CPU-only diagnostic start.

The launcher creates persistent host directories next to the repository: models/ for downloaded model weights and the upscaler TensorRT cache, cache/ for RIFE TensorRT engines and preview scratch files, and data/ for media paths used inside the container. In the UI, browse or enter paths below /app/data (for example /app/data/input.mp4).

For a CPU-only compose start, use docker compose up or podman compose up. The compose file intentionally contains no GPU syntax; GPU flags differ by engine and are applied by run.sh.

Using the app

The app works one video at a time. On first use:

  1. Open Runtime and install or check the runtime. This downloads Python 3.12 and the pinned CUDA 13.2 PyTorch/TensorRT packages into the portable runtime/venv/.
  2. Open Models and download any model your job needs. Built-in models are pre-listed; see Model selection.
  3. In the main form, pick a local input file, content type, scale, target FPS, and output path.
  4. Click Run. Progress, the current processed frame, and a live log appear in the job panel. Cancel any time.

The app reads local files directly — it never uploads video. After a job finishes, a 20-second 480px-wide MP4 proxy preview is generated for the browser.

Configuration

All settings are environment variables read at startup; no config file.

VariableDefaultEffect
DASIWA_PORT8612Port the web UI listens on.
DASIWA_NO_BROWSER(unset)Set to 1 to stop the automatic browser launch.
RVE_UPSCALER_TRT_ENGINE_CACHE1 (on)Gate for the persistent TensorRT upscaler engine cache.
FORCE_COLOR(unset)Set to 1 to force colored job logs even when piped.

RVE_UPSCALER_TRT_ENGINE_CACHE — persistent upscaler engine cache

When enabled (the default), compiled TensorRT upscaler engines are written to models/.tensorrt-engine-cache/ next to the model file and reused on the next job, turning a ~39-second compile into a ~16-second cache hit. Cache entries are safe on torch_tensorrt 2.13.0+, which refits cached engines by rebuilding the weight mapping from the graph.

Set it to a falsy value to fall back to a fresh engine compile per job:

RVE_UPSCALER_TRT_ENGINE_CACHE=0 ./dasiwa-true-video-enhancer

Accepted falsy values: 0, false, no, off (case-insensitive). Anything else — including unset — keeps the cache on.

The RIFE frame-interpolation and ONNX upscaler TensorRT caches are separate, always-on paths and are not affected by this variable.

Support matrix

CapabilityStatusNotes
NVIDIA CUDA inferencePyTorch CUDA; TensorRT is preferred when available.
TensorRT Safetensors upscalingStatic full-frame or tiled engine; smaller tiles are retried after compile failure.
ONNX Runtime / TensorRT upscalingRequires TensorRT Execution Provider to activate; silent CPU fallback is rejected.
Safetensors upscalersLoaded through Spandrel; model scale is detected from the descriptor.
ONNX upscalersFixed-shape ONNX models run using their declared input shape.
2x and 4x outputA native 2x model selected for 4x runs two real AI passes.
Output up to 8K UHDHard maximum is 33,177,600 output pixels (7680×4320).
Output above 8K UHDRejected before worker start to protect host memory.
RIFE v4.26 general interpolationRuns only when target FPS is higher than source FPS.
RIFE Heavy / alternate interpolation modelsNot exposed by the current built-in model list.
Arbitrary higher target FPSTimestamp-driven scheduler supports non-integer ratios.
AI denoise / restoration-only pipelineNo dedicated denoise stage is implemented.
HDR processing / tone mappingThe UI flag is accepted but the backend has no HDR transform path.
Scene detectionUI options exist, but no scene-detection branch is executed by the current backend.
Batch folder queueJobs are submitted per input video; there is no folder/batch scheduler.
Local file browse and filename searchThe app reads local paths; it does not upload videos.
Job cancel and SSE progress eventsCancels the worker context and streams job state/logs.
Live processed-frame previewPeriodic JPEG preview while a job runs.
Post-job browser previewGenerates a 20-second, 480px-wide MP4 proxy.
MP4, MKV, WebM, MOV, AVI, FLV, TS, M4V outputFFmpeg/container compatibility still determines the actual codec.
WebM codec safety conversionIncompatible video/audio/subtitle choices are normalized to WebM-safe formats.
NVENC H.264 / HEVC / AV1Used only when the installed FFmpeg and GPU support the encoder.
CPU x264/x265, SVT-AV1, VP9, ProRes, FFV1Availability depends on the local FFmpeg build.
AMD / ROCm inferenceNot implemented.
Intel / oneAPI inferenceNot implemented.
Apple Silicon / MPS inferenceNot a supported shipped runtime.
CPU-only inferenceNot a supported configuration.

Model selection

Choose Auto for the normal path. The UI selects a built-in model by content type and requested model scale; a manual model selection overrides Auto.

Content typeBuilt-in 2x choicesBuilt-in 4x choices
AnimeAnimeJaNai Compact; AnimeSharp variantsNomosUni SPAN; HFA2k LUDVAE; optional HAT-L Sharp
MixedAnimeJaNai Compact; NomosUni SPANNomosUni SPAN; UltraSharpV2-Lite
RealismRealPLKSR Restoration; optional RealPLKSR GANClearRealityV1; Nomos WebPhoto; optional HAT-L

Models are scale-specific. Selecting a native 2x model at a 4x target invokes two AI passes. Selecting a native 4x model invokes one pass. Manual model selection can therefore change both output appearance and memory/throughput behavior.

Safe 4x operation

4x is much more expensive than 2x: with a 2x model, pass two consumes the first pass's 2x-sized output. The pipeline protects the desktop by rejecting output above 8K UHD, estimating bounded host-memory needs before it starts, and automatically using 256-core tiles (then 128 if compilation fails) for automatic iterative 2x→4x jobs.

A 1080p source at 4x produces 7680×4320 and is within the limit. A 4K source at 4x produces 15360×8640 and is intentionally rejected. Use 2x or a smaller source in that case.

Encoding and media tracks

The default Auto video encoder checks the local FFmpeg build and chooses a container-compatible encoder. Audio and subtitles are copied unless you choose a transcode option. For WebM, incompatible H.264/H.265, AAC/MP3, and subtitle choices are converted before the expensive render begins.

Output codec support is a property of the installed FFmpeg and hardware, not a promise that every encoder is present on every machine.

Changelog

See docs/CHANGELOG.md for the full release history. Recent notable changes:

  • 2026-08-30 — Fixed the TensorRT upscaler engine-cache refit corruption (issue #2) by upgrading the runtime to torch_tensorrt 2.13.0; the engine cache is now safe and ON by default, with RVE_UPSCALER_TRT_ENGINE_CACHE=0 as the off-switch.
  • 2026-08-10 — Sequential job queue with a visible queue UI.
  • 2026-07-17 — 4x host-memory guard, persistent TensorRT engine cache, bundled AnimeJaNai Compact base upscaler.
  • 2026-07-12 — Bounded FFmpeg rawvideo streaming replaces serial PNG frame sequences.

Credits

  • AnimeJaNai HD V3 Compact 2x — the bundled 2x-AnimeJaNai_HD_V3_Compact.safetensors model is credited to the AnimeJaNai project. It remains subject to its upstream license and terms.
  • Real-Video-Enhancer by TNTwise — a valuable reference project for video-enhancement workflows and model integration. DaSiWa True Video Enhancer is an independent implementation and is not affiliated with or endorsed by Real-Video-Enhancer.

Development checks

runtime/venv/bin/python -m pytest backend/tests -q
go test ./...
go build ./cmd/dasiwa-true-video-enhancer

The backend source changed between jobs is picked up by the next spawned Python worker. Rebuild the Go binary when Go code or embedded web assets change.

License

DaSiWa True Video Enhancer is free software licensed under the GNU General Public License v3.0. The bundled 2x-AnimeJaNai_HD_V3_Compact.safetensors model and any model you download remain under their own upstream licenses — see Credits.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages