/cuvista

Gpu Accelerated Video Stabilizer, Cuda, OpenCL

Primary LanguageC++GNU General Public License v3.0GPL-3.0

GitHub Release GitHub Downloads (all assets, all releases)

CUVISTA - Gpu accelerated Video Stabilizer

Check the projects GitHub Page

A simple, easy to use Application to stabilize shaky video footage preferably using GPU acceleration via Cuda or OpenCL platforms when available. The software will run on CPU power alone, which will be significantly slower but produces the exact same outcome.

I put in great effort to ensure that on all platforms the stabilization results are absolutely equal. By that I mean floating point equal, to the bit. So far I tested on Windows 11 and Ubuntu 24.04 with MSVC and GCC compilers.

Have a look at a sample video comparing an original recording side by side to the stabilized version:

Cuvista Demo

GPU Support

For Cuda acceleration a device with Compute Version 5 or later is required. For OpenCL the device must support at least version 2.

Typical Performance

On a RTX 3060 graphics card a typical video in FullHD resolution (1920 x 1080) should be processed at around 100 frames per second, including decoding, stabilizing and encoding.

Using CUVISTA

For Windows you can get the latest version from the Releases page. Just download, unzip and run either cuvista.exe on the command line or cuvistaGui.exe for a windowed user interface.

Have a look at available options on the command line via cuvista -h or cuvista -help, in the GUI version a subset of most important options is available.

In a fresh Windows environment the the Microsoft Visual C/C++ Runtime Libraries might be missing, so when prompted with a message like MSVCP140.dll not found, download and install the latest redistributable https://aka.ms/vs/17/release/vc_redist.x64.exe

Building CUVISTA

Get the repository and submodules to your computer, then proceed below according to your system

Building on Windows

Tested on Windows 11

Main Dependencies

Building

in a command line window, starting from the project main directory, where this readme and the top level CMakeLists.txt is located, exectute the following commands

It is recommended to build in a subdirectory:

mkdir build
cd build

prepare the locations of Cuda, Qt, FFMPEG and provide them to cmake as outlined. Better use forward slashes / to separate folders. Adapt locations to your system:

cmake .. -D CMAKE_PREFIX_PATH=C:/Qt/6.7.2/msvc2019_64;C:/CUDA/version -D FFMPEG_PATH=C:/ffmpeg
cmake --build . --config Release

Upon successfull completion you will get the files

cuvistaCli/Release/cuvista.exe
cuvistaGui/Release/cuvistaGui.exe

Those programs will run right away if all necessary runtime dependencies are on the system path. Optionally continue with:

cmake --install .

This will put together the libraries for Qt and ffmpeg, you will then get everything packed together in the subfolder install

Building on Linux

Tested on Ubuntu 24.04

Main Dependencies

More Libraries

Execute commands in a Linux Terminal to download and install additional components if not already available on your system

Cmake, the build tool:

sudo apt install -y cmake

FFmpeg shared libraries:

sudo apt install -y libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev

Nvidia Video encoder - I wonder why that library carries the name ffmpeg...

sudo apt install -y libffmpeg-nvenc-dev

Google Cpu Features:

sudo apt install -y libcpu-features-dev

Seems to be needed for the Qt stuff:

sudo apt install -y libxkbcommon-dev

Building

Finally, in a terminal session, starting from the project main directory, where this readme and the top level CMakeLists.txt is located

It is recommended to build in a subdirectory:

mkdir build
cd build

tell cmake where to find Cuda and Qt, adapt locations to your system - alternatively those paths can be provided directly to cmake via -D option:

export CMAKE_PREFIX_PATH=~/Qt/6.7.2/gcc_64:/usr/local/cuda

Execute the build process:

cmake ..
cmake --build .

Upon successfull completion you will find the executables which should execute right away

cuvistaCli/cuvista
cuvistaGui/cuvistaGui

Future Ideas

  • Improve performance on all devices
  • Improve quality and robustness of stabilization - very likely degrading performace
  • Look into more advanced algorithms like 3D stabilization - but I currently lack information on the fundamental math of suchs approaches
  • Use this codebase to remove duplicate frames from videos
  • Possibly improve performace by using multiple GPUs - dont know if anyone would need that though
  • Some more issues

Built and Tested on following Tools and versions

  • Windows 11 64bit
  • Ubuntu 24.04
  • Visual Studio 2022
  • Nvidia Cuda 12.5
  • Nvidia Video Codec SDK 12.2.72
  • FFmpeg 7.0
  • Qt 6.7.2
  • Cmake 3.28.3