Create Image Gallery from a Video

🎞️ The application I created with C++ and FFmpeg to make it easier to remember parts of videos.


Create Image Gallery from a Video


I tend to watch a lot of movies. Although I watch many online, there are others that I download from the internet, often because the streaming provider I use doesn’t have a specific title I want available.

And I always create an image gallery using software. But there are times when I save movies, watch them, and later want to remember a specific part to confirm if I’ve really watched it.

When there are many movies and I want to create galleries, I needed to do it manually via a graphical interface, which took a lot of time. That’s when I got the idea to create: vig.

vig is a command-line utility written in C++ that uses the libraries: FFmpeg and stb.

It creates galleries easily and quickly. I used to use Totem because it had command-line capabilities, but they removed the terminal utility a few years ago. I even made this post in 2015 showing how to use it, not to mention it has many limitations, such as only creating galleries with a maximum of 30 images and other details.

With vig, no: you can create the quantity and combination you want: 1x1 (1 image), 4x4 (16 images), 5x3 (15 images), 10x10 (100 images), and so on.

Currently, it’s only available for Unix-like systems, but in the near future I will create a version for Windows using ffpp. But Windows has a nice alternative, if I’m not mistaken the name is: MPC-HC, but I don’t know if it also works via command line.

Below we’ll see how to compile and install it on your machine!


Dependencies

Obviously, first of all you will need some basic dependencies, besides C++23, Git, and CMake, the basics really.

What you really need is to use your package manager to install: FFmpeg. The stb library is not needed as it’s already incorporated into the code.

Examples:

APT:

sudo apt update
sudo apt install \
    libavformat-dev \
    libavcodec-dev \
    libavutil-dev \
    libswscale-dev \
    libswresample-dev \
    libavdevice-dev

Pacman:

sudo pacman -S ffmpeg

Compile and Install

Then just use CMake to compile and install:

After cloning the project!

git clone https://github.com/terroo/vig
cd vig
cmake . -B build
cmake --build build
sudo cmake --install build
cd ..
rm -rf vig

Usage

Below are simple examples to generate your galleries.

The images are generated in the same directory where you executed vig, with the following filename format:

gallery-[date]-[time]-[video-name].jpg

Examples:

# Basic
vig video.mp4

# Generate 4 cols and rows = 16 frames
vig --res=4x4 video.mp4

# Generate 5 cols x 3 rows = 15 frames
vig --res=5x3 video.mp4

# Help
vig --help

If you want to uninstall, just run:

sudo rm $(which vig)

Oh! And don’t forget to leave your ⭐ on the vig repository on GitHub.


cpp ffmpeg tips commands


Share


YouTube channel

Subscribe


Marcos Oliveira

Marcos Oliveira

Software developer
https://github.com/terroo