Go Image & Video Upscaler

Project link: https://github.com/nalexand/video_upscaler

This project is a high-performance, command-line tool written in Go for upscaling images and videos. It utilizes a custom, pre-trained model to perform a 3x upscale, with a focus on unblurring and denoising the source material. The processing is done in parallel to leverage multi-core CPUs for significant speed improvements.

Features

  • 3x Image Upscaling: Enhance the resolution of images (PNG) by a factor of 3.
  • 3x Video Upscaling: Process videos by extracting frames, upscaling them individually, and reassembling them into a high-resolution video file.
  • Unblur & Denoise: The included model is trained not just to enlarge, but also to correct common imperfections like blur and noise.
  • High Performance: Leverages Go's concurrency features to process image rows or video frames in parallel across all available CPU cores.
  • Command-Line Interface: Simple and clear flags for easy operation on local files.
  • Self-Contained Model: Uses a pre-trained model stored in a .gob file, which is Go's native binary format, download here: https://huggingface.co/datasets/nalexand/upscaler_unblur/tree/main

Prerequisites

Before using this tool, you must have the following software installed on your system:

  1. Go: The Go programming language (version 1.18 or newer recommended). You can download it from golang.org.
  2. FFmpeg: A powerful multimedia framework used to extract frames from the input video and reassemble them with audio.
    • Installation instructions can be found on the official FFmpeg website.
    • Ensure that both ffmpeg and ffprobe are available in your system's PATH. You can verify this by running ffmpeg -version and ffprobe -version in your terminal.

Installation & Setup

  1. Clone the Repository
    git clone <repository-url>
    cd <repository-directory>
  2. Get the Model File

    This program requires the model file unblur_denoice_shared_model_x3_20.gob to be present in the same directory as the executable. You can dowmload it here: https://huggingface.co/datasets/nalexand/upscaler_unblur/tree/main

  3. Build the Executable

    Create a binary from the source code. This command will produce an executable file (e.g., unblur_server_binary on Linux/macOS or unblur_server_binary.exe on Windows).

    go build -o unblur_server_binary .

Usage

The tool is operated via command-line flags. The primary mode is upscale.

Image Upscaling

To upscale a single image:

./unblur_server_binary -mode=upscale -lr=input.png -out=output_upscaled.png
  • -mode=upscale: Specifies the operation mode.
  • -lr=<path>: Path to the low-resolution input image.
  • -out=<path>: Path for the resulting high-resolution output image.

Video Upscaling

To upscale a video file:

./unblur_server_binary -mode=upscale -videoin=my_video.mp4 -videoout=my_video_upscaled.mp4
  • -videoin=<path>: Path to the low-resolution input video.
  • -videoout=<path>: Path for the resulting high-resolution output video.

The tool will automatically handle:

  • Creating a temporary directory for frames.
  • Extracting all frames from the input video using ffmpeg.
  • Upscaling each frame in parallel.
  • Reassembling the upscaled frames into a new video.
  • Copying the audio track from the original video to the final output.

Using a Different Model

You can specify a different model file using the -model flag:

./unblur_server_binary -mode=upscale -lr=input.jpg -model=another_model.gob -out=output.png

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Dataset used to train nalexand/image_video_upscaler