Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Anime Upscaler

A CLI tool to batch upscale anime videos using Real-CUGAN with GPU acceleration. Designed for Mac M4 (Metal via Vulkan/MoltenVK) but works on any platform with Vulkan support.

Features

  • Batch process MKV files from input directory
  • Upscale using Real-CUGAN (optimized for anime)
  • Preserve all audio tracks, subtitles, chapters, and font attachments
  • Hardware-accelerated encoding (VideoToolbox on Mac)
  • Resume interrupted jobs
  • Progress reporting with ETA
  • Optional Japanese-only audio filter

Requirements

Dependencies

# macOS
brew install ffmpeg mkvtoolnix

# Linux (Debian/Ubuntu)
sudo apt install ffmpeg mkvtoolnix

# Linux (Arch)
sudo pacman -S ffmpeg mkvtoolnix-cli

Real-CUGAN

Download the pre-built binary for your platform from: https://github.com/nihui/realcugan-ncnn-vulkan/releases

Extract and place the binary in one of these locations:

  • ~/tools/realcugan-ncnn-vulkan (recommended)
  • ~/.local/bin/realcugan-ncnn-vulkan
  • /usr/local/bin/realcugan-ncnn-vulkan
  • Or specify the path with --realcugan-path

Installation

# Clone the repository
git clone https://github.com/yourusername/anime-upscaler.git
cd anime-upscaler

# Build and install
cargo install --path .

Usage

# Basic usage
anime-upscaler -i ~/anime-input -o ~/anime-output

# With processed folder (moves originals after completion)
anime-upscaler -i ~/anime-input -o ~/anime-output -p ~/anime-processed

# 4x upscale with maximum denoise (slowest, best quality)
anime-upscaler -i ~/input -o ~/output -s 4 -n 3

# 2x upscale with no denoise (fastest)
anime-upscaler -i ~/input -o ~/output -s 2 -n -1

# Resume an interrupted job
anime-upscaler -i ~/input -o ~/output --resume

# Dry run (see what would be processed)
anime-upscaler -i ~/input -o ~/output --dry-run

# Verbose logging
anime-upscaler -i ~/input -o ~/output -v

Options

Option Default Description
-i, --input required Input directory containing MKV files
-o, --output required Output directory for upscaled files
-p, --processed none Directory to move originals after processing
-w, --work-dir system cache Working directory for temporary files
-s, --scale 2 Scale factor (2, 3, or 4)
-n, --denoise 1 Denoise level (-1=none, 0, 1, 2, 3=max)
-m, --model pro Model to use (pro=quality, se=fast)
-g, --gpu 0 GPU ID to use
-t, --tile-size 0 (auto) Tile size (256/512/1024 if memory issues)
-b, --bitrate 20M Video bitrate for output
--codec hevc_videotoolbox Video codec (use libx265 on Linux)
--japanese-only true Keep only Japanese audio tracks
--realcugan-path auto-detect Path to realcugan-ncnn-vulkan binary
--resume false Resume incomplete jobs
--dry-run false Show what would be done without processing
-v, --verbose false Enable verbose logging

Processing Pipeline

  1. Extract - Frames (PNG), audio tracks, subtitles, chapters, and font attachments
  2. Upscale - Process frames with Real-CUGAN using GPU
  3. Reassemble - Encode upscaled frames to video with hardware acceleration
  4. Mux - Combine video with preserved audio, subtitles, chapters, and fonts

Platform Notes

macOS (Apple Silicon)

Uses hevc_videotoolbox for hardware-accelerated H.265 encoding. Real-CUGAN uses Vulkan via MoltenVK for GPU acceleration.

Linux

Change the codec to libx265 for software encoding:

anime-upscaler -i ~/input -o ~/output --codec libx265

Or use VAAPI/NVENC if available:

# NVIDIA
anime-upscaler -i ~/input -o ~/output --codec hevc_nvenc

# AMD/Intel VAAPI
anime-upscaler -i ~/input -o ~/output --codec hevc_vaapi

Troubleshooting

Out of GPU memory

Reduce tile size:

anime-upscaler -i ~/input -o ~/output -t 256

Slow upscaling

Use the faster model (slightly lower quality):

anime-upscaler -i ~/input -o ~/output -m se

Resume not working

Ensure you use the same input/output directories and add --resume:

anime-upscaler -i ~/input -o ~/output --resume

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages