Skip to content

Commit

Permalink
docs(book): added the docs.video2x.org mdBook source files and pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: k4yt3x <i@k4yt3x.com>
  • Loading branch information
k4yt3x committed Nov 22, 2024
1 parent a77cf9e commit 180f752
Show file tree
Hide file tree
Showing 22 changed files with 517 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Docs

on:
push:
branches: ["master"]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install mdBook
run: |
version="$(curl https://api.github.com/repos/rust-lang/mdBook/releases/latest | jq -r '.tag_name')"
curl -sSL "https://github.com/rust-lang/mdBook/releases/download/$version/mdbook-$version-x86_64-unknown-linux-musl.tar.gz" | tar -xz
sudo mv mdbook /usr/local/bin/
- name: Build Docs with mdBook
run: mdbook build -d "$PWD/build/docs/book" docs/book

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "build/docs/book"

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions docs/book/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
11 changes: 11 additions & 0 deletions docs/book/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[book]
authors = ["k4yt3x"]
language = "en"
multilingual = false
title = "Video2X Documentation"

[output.html]
default-theme = "ayu"
preferred-dark-theme = "ayu"
git-repository-url = "https://github.com/k4yt3x/video2x"
edit-url-template = "https://github.com/k4yt3x/video2x/edit/master/docs/guide/{path}"
13 changes: 13 additions & 0 deletions docs/book/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Introduction

<p align="center">
<img src="https://github.com/user-attachments/assets/5cd63373-e806-474f-94ec-6e04963bf90f"/>
</p>

This site hosts the documentations for the Video2X project, a machine learning-based lossless video super resolution & frame interpolation framework.

The project's homepage is located on GitHub at: [https://github.com/k4yt3x/video2x](https://github.com/k4yt3x/video2x).

If you have any questions, suggestions, or found any issues in the documentations, please [open an issue](https://github.com/k4yt3x/video2x/issues/new/choose) on GitHub.

> 🚧 Some pages are still under construction.
35 changes: 35 additions & 0 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Summary

[Introduction](README.md)

# Building

- [Building](building/README.md)
- [Windows](building/windows.md)
- [Windows (Qt6)](building/windows-qt6.md)
- [Linux](building/linux.md)

# Installing

- [Installing](installing/README.md)
- [Windows (Command Line)](installing/windows.md)
- [Windows (Qt6 GUI)](installing/windows-qt6.md)
- [Linux](installing/linux.md)

# Running

- [Running](running/README.md)
- [Desktop](running/desktop.md)]
- [Command Line](running/command-line.md)
- [Container](running/container.md)

# Developing

- [Developing](developing/README.md)
- [Architecture](developing/architecture.md)
- [libvideo2x](developing/libvideo2x.md)

# Other

- [Other](other/README.md)
- [History](other/history.md)
3 changes: 3 additions & 0 deletions docs/book/src/building/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Building

Instructions for building the project.
50 changes: 50 additions & 0 deletions docs/book/src/building/linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Linux

Instructions for building this project on Linux.

## Arch Linux

Arch users can build the latest version of the project from the AUR package `video2x-git`. The project's repository also contains another PKGBUILD example at `packaging/arch/PKGBUILD`.

```bash
# Build only
git clone https://aur.archlinux.org/video2x-git.git
cd video2x-git
makepkg -s
```

To build manually from the source, follow the instructions below.

```bash
# Install build and runtime dependencies
# See the PKGBUILD file for the list of up-to-date dependencies
pacman -Sy ffmpeg ncnn vulkan-driver opencv spdlog boost-libs
pacman -Sy git cmake make clang pkgconf vulkan-headers openmp boost

# Clone the repository
git clone --recurse-submodules https://github.com/k4yt3x/video2x.git
cd video2x

# Build the project
make build
```

The built binaries will be located in the `build` directory.

## Ubuntu

Ubuntu users can use the `Makefile` to build the project automatically. The `ubuntu2404` and `ubuntu2204` targets are available for Ubuntu 24.04 and 22.04, respectively. `make` will automatically install the required dependencies, build the project, and package it into a `.deb` package file. It is recommended to perform the build in a container to ensure the environment's consistency and to avoid leaving extra build packages on your system.

```bash
# make needs to be installed manually
sudo apt-get update && sudo apt-get install make

# Clone the repository
git clone --recurse-submodules https://github.com/k4yt3x/video2x.git
cd video2x

# Build the project
make ubuntu2404
```

The built `.deb` package will be located under the current directory.
55 changes: 55 additions & 0 deletions docs/book/src/building/windows-qt6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Windows (Qt6)

Instructions for building the Qt6 GUI of this project on Windows.

## 1. Prerequisites

These dependencies must be installed before building the project. This tutorial assumes that Qt6 has been installed to the default location (`C:\Qt`).

- [Visual Studio 2022](https://visualstudio.microsoft.com/vs/)
- Workload: Desktop development with C++
- [winget-cli](https://github.com/microsoft/winget-cli)
- [Qt6](https://www.qt.io/download)
- Component: Qt6 with MSVC 2022 64-bit
- Component: Qt Creator

## 1. Clone the Repository

```bash
# Install Git if not already installed
winget install -e --id=Git.Git

# Clone the repository
git clone --recurse-submodules https://github.com/k4yt3x/video2x-qt6.git
cd video2x-qt6
```

## 2. Install Dependencies

You need to have the `libvideo2x` shared library built before building the Qt6 GUI. Put the built binaries in `third_party/libvideo2x-shared`.

```bash
# Versions of manually installed dependencies
$ffmpegVersion = "7.1"

# Download and extract FFmpeg
curl -Lo ffmpeg-shared.zip "https://github.com/GyanD/codexffmpeg/releases/download/$ffmpegVersion/ffmpeg-$ffmpegVersion-full_build-shared.zip"
Expand-Archive -Path ffmpeg-shared.zip -DestinationPath third_party
Rename-Item -Path "third_party/ffmpeg-$ffmpegVersion-full_build-shared" -NewName ffmpeg-shared
```

## 3. Build the Project

1. Open the `CMakeLists.txt` file in Qt Creator as the project file.
2. Click on the hammer icon at the bottom left of the window to build the project.
3. Built binaries will be located in the `build` directory.

After the build finishes, you will need to copy the Qt6 DLLs and other dependencies to the build directory to run the application. Before you run the following commands, remove everything in the release directory except for `video2x-qt6.exe` and the `.qm` files as they are not required for running the application. Then, run the following command to copy the Qt6 runtime DLLs:

```bash
C:\Qt\6.8.0\msvc2022_64\bin\windeployqt.exe --release --compiler-runtime .\build\Desktop_Qt_6_8_0_MSVC2022_64bit-Release\video2x-qt6.exe
```

You will also need to copy the `libvideo2x` shared library to the build directory. Copy all files under `third_party/libvideo2x-shared` to the release directory except for `include`, `libvideo2x.lib`, and `video2x.exe`.

Now you should be able to run the application by double-clicking on `video2x-qt6.exe`.
56 changes: 56 additions & 0 deletions docs/book/src/building/windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Windows

Instructions for building this project on Windows.

## 1. Prerequisites

The following tools must be installed manually:

- [Visual Studio 2022](https://visualstudio.microsoft.com/vs/)
- Workload: Desktop development with C++
- [winget-cli](https://github.com/microsoft/winget-cli)

## 2. Clone the Repository

```bash
# Install Git if not already installed
winget install -e --id=Git.Git

# Clone the repository
git clone --recurse-submodules https://github.com/k4yt3x/video2x.git
cd video2x
```

## 3. Install Dependencies

```bash
# Install CMake
winget install -e --id=Kitware.CMake

# Install Vulkan SDK
winget install -e --id=KhronosGroup.VulkanSDK

# Versions of manually installed dependencies
$ffmpegVersion = "7.1"
$ncnnVersion = "20240820"

# Download and extract FFmpeg
curl -Lo ffmpeg-shared.zip "https://github.com/GyanD/codexffmpeg/releases/download/$ffmpegVersion/ffmpeg-$ffmpegVersion-full_build-shared.zip"
Expand-Archive -Path ffmpeg-shared.zip -DestinationPath third_party
Rename-Item -Path "third_party/ffmpeg-$ffmpegVersion-full_build-shared" -NewName ffmpeg-shared

# Download and extract ncnn
curl -Lo ncnn-shared.zip "https://github.com/Tencent/ncnn/releases/download/$ncnnVersion/ncnn-$ncnnVersion-windows-vs2022-shared.zip"
Expand-Archive -Path ncnn-shared.zip -DestinationPath third_party
Rename-Item -Path "third_party/ncnn-$ncnnVersion-windows-vs2022-shared" -NewName ncnn-shared
```

## 4. Build the Project

```bash
cmake -S . -B build -DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DUSE_SYSTEM_BOOST=OFF `
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=build/libvideo2x-shared
cmake --build build --config Release --parallel --target install
```

The built binaries will be located in `build/libvideo2x-shared`.
3 changes: 3 additions & 0 deletions docs/book/src/developing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Developing

Development-related instructions and guidelines for this project.
38 changes: 38 additions & 0 deletions docs/book/src/developing/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Architecture

The basic working principals of Video2X and its historical architectures.

## Video2X <=4.0.0 (Legacy)

Below is the earliest architecture of Video2X. It extracts all of the frames from the video using FFmpeg, processes all frames, and stores them into a folder before running FFmpeg again to convert all of the frames back into a video. The drawbacks of this approach are apparent:

- Storing all frames of the video on disk twice requires a huge amount of storage, often hundreds of gigabytes.
- A lot of disk I/O (reading from/writing to disks) operations occur, which is inefficient. Each step stores its processing results to disk, and the next step has to read them from disk again.

![Video2Xv4](https://github.com/user-attachments/assets/976a93ff-efad-418f-a3e2-272e84db2d74)\
_Video2X architecture before version 5.0.0_

## Video2X 5.0.0 (Legacy)

Video2X 5.0.0's architecture was designed to address the inefficient disk I/O issues. This version uses frame serving and streamlines the process. All stages are started simultaneously, and frames are passed between stages through stdin/stdout pipes. However, this architecture also has several issues:

- At least two instances of FFmpeg will be started, three in the case of Anime4K.
- Passing frames through stdin/stdout is unstable. If frame sizes are incorrect, FFmpeg will hang waiting for the next frame.
- The frames entering and leaving each stage must be RGB24, even if they don't need to be. For instance, if the upscaler used is Anime4K, yuv420p is acceptable, but the frame is first converted by the decoder to RGB24, then converted back into YUV colorspace for libplacebo.

![Video2Xv5](https://github.com/user-attachments/assets/d1f38034-a5d3-4c7e-92bf-a5b30fa9ac72)\
_Video2X 5.x.x architecture_

## Video2X 6.0.0 (Current)

Video2X 6.0.0 (Current)

The newest version of Video2X's architecture addresses the issues of the previous architecture while improving efficiency.

- Frames are only decoded once and encoded once with FFmpeg's libavformat.
- Frames are passed as `AVFrame` structs. Their pixel formats are only converted when needed.
- Frames always stay in RAM, avoiding bottlenecks from disk I/O and pipes.
- Frames always stay in the hardware (GPU) unless they need to be downloaded to be processed by software (partially implemented).

![Video2Xv6 drawio](https://github.com/user-attachments/assets/c5d5fc3b-8688-4d50-b7c0-3b5d825a8c69)\
_Video2X 6.0.0 architecture_
5 changes: 5 additions & 0 deletions docs/book/src/developing/libvideo2x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# libvideo2x

Instructions for using libvideo2x's C API in your own projects.

libvideo2x's API is still highly volatile. This document will be updated as the API stabilizes.
3 changes: 3 additions & 0 deletions docs/book/src/installing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Installing

Instructions for installing this project.
19 changes: 19 additions & 0 deletions docs/book/src/installing/linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Linux

Instructions for installing this project on Linux systems.

## Arch Linux

Arch users can install the project from the AUR.

```bash
yay -S video2x-git
```

## Ubuntu

Ubuntu users can download the `.deb` packages from the [releases page](https://github.com/k4yt3x/video2x/releases/latest). Install the package with the APT package manager:

```bash
apt-get install ./video2x-linux-ubuntu2404-amd64.deb
```
7 changes: 7 additions & 0 deletions docs/book/src/installing/windows-qt6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Windows (Qt6)

You can download the installer for Video2X Qt6 from the [releases page](https://github.com/k4yt3x/video2x/releases/latest). The installer file's name is `video2x-qt6-windows-amd64-installer.exe`.

Download then double-click the installer to start the installation process. The installer will guide you through the installation process. You can choose the installation directory and whether to create a desktop shortcut during the installation.

After the installation is complete, you can start Video2X Qt6 by double-clicking the desktop shortcut.
12 changes: 12 additions & 0 deletions docs/book/src/installing/windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Windows

You can download the latest version of the Windows build from the [releases page](https://github.com/k4yt3x/video2x/releases/latest). Here are the steps to download and install the pre-built binaries to `%LOCALAPPDATA%\Programs`.

```bash
$latestTag = (Invoke-RestMethod -Uri https://api.github.com/repos/k4yt3x/video2x/releases/latest).tag_name
curl -LO "https://github.com/k4yt3x/video2x/releases/download/$latestTag/video2x-windows-amd64.zip"
New-Item -Path "$env:LOCALAPPDATA\Programs\video2x" -ItemType Directory -Force
Expand-Archive -Path .\video2x-windows-amd64.zip -DestinationPath "$env:LOCALAPPDATA\Programs\video2x"
```

You can then add `%LOCALAPPDATA%\Programs\video2x` to your `PATH` environment variable to run `video2x` from the command line.
1 change: 1 addition & 0 deletions docs/book/src/other/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Other
Loading

0 comments on commit 180f752

Please sign in to comment.