A tool to make snapshots of a video file.
This tool supports a lot of video formats and works in a console mode.
- Contents
- Input (Video) Formats
- Output (Image) Formats
- Building
- Installing
- Usage
- Version & Dependency
- Build Information
- Feedback
This tool supports all the video formats, supported by the FFmpeg
library.
However, sometimes there may be some difficulty with specific format, as the
FFmpeg
library is known to use the most default decoders for video files.
This tool uses libvpx-vp9
decoder for Google's VP9 video files to decode
transparency correctly. Some other decoders may detect video stream index and
pixel format incorrectly. For such cases this tool provides a method to set
stream index and pixel format manually. More information about this is
provided in the Usage
section of this file.
This tool can export snapshots as PNG's and JPEG's. More information about
output image formats is provided in the description of the Writer
parameter
in the Usage
section of this file.
-
Install the latest version of CMake tool.
-
Install one or more IDEs with support for CMake:
Visual Studio
by Microsoft.- CMake support in Visual Studio must be installed as a separate feature.
CLion
by JetBrains;- CMake support is already built into CLion.
-
Get the stable shared library of the
FFmpeg
project. -
Update all FFmpeg-related files from the downloaded FFmpeg build.
- DLL libraries, H (header) files and LIB files for:
- AVCodec,
- AVFormat,
- AVUtil,
- SWScale.
- They should be located in the
ffmpeg
folder.
- DLL libraries, H (header) files and LIB files for:
-
Get the
libjpeg
library.- https://ijg.org/
- Or use the provided
get-libjpeg.bat
script.
-
Get the
libpng
library.- http://www.libpng.org/pub/png/libpng.html
- Or use the provided
get-libpng.bat
script.
-
Get the
stb
library.- https://github.com/nothings/stb
- Or use the provided
get-stb.bat
script.
-
Get the
zlib
library.- https://www.zlib.net/
- Or use the provided
get-zlib.bat
script.
-
Build the project using Visual Studio directly or via CLion.
Why ? There are many reasons. The first one is because MinGW is not able to
properly read object files (.obj
) built for Microsoft Windows systems. -
Versions of dependencies are described in Version & Dependency section.
- Open CMake GUI, set folders, configure & generate files for Visual Studio.
- Install the CMake feature for Visual Studio.
- Open the created solution in Visual Studio and build it.
- Install Microsoft Visual Studio 2022 (Community Edition).
- Install CLion and open the project in it.
- Open:
Settings -> Build, Execution, Deployment -> Toolchains
.- Add the Visual Studio toolchain and make it default.
- Open:
Settings -> Build, Execution, Deployment -> CMake
.- Disable all the profiles related to MinGW.
- Add two profiles for Visual Studio: Release & Debug.
- Click:
Tool -> CMake -> Reset Cache and Reload Project
.- In case of an error about
CMAKE_MAKE_PROGRAM
which is not found:- Install MinGW, including its version of the
make
tool, - Add MinGW's
bin
folder to your system'sPATH
environment variable.
- Install MinGW, including its version of the
- In case of an error about
- Build the project.
-
Make DLL files of
FFmpeg
library accessible to the program:- either install the shared version of
FFmpeg
and add it'sbin
folder toPATH
environment variable - or copy its DLL files into the program's directory
- either install the shared version of
-
Make DLL files of
libpng
library accessible to the program:- either install the
libpng
library and make it visible viaPATH
environment variable - or copy its DLL files into the program's directory
- either install the
-
Make DLL files of
zlib
library accessible to the program:- either install the
zlib
library and make it visible viaPATH
environment variable - or copy its DLL files into the program's directory
- either install the
List of required DLL files is described in Version & Dependency section.
The program works in console mode and requires six (6) command line arguments:
<executable> <input_file> <stream_index> <pixel_format_id> <output_folder> <writer> <nth>
-
Input Video File.
Path to the video file from which you want to make snapshots. -
Video Stream Index.
This parameter is optional and means an index of a video stream to capture.
Numbers are starting from 0, i.e. stream #1 is index 0.
Hint:-1
meansauto
, values >= 0 set an exact stream index.
In most cases the automatic-1
is enough. -
Pixel Format ID.
This parameter is optional and means an ID of pixel format.
The list of possible IDs is available in header files of FFmpeg.
Hint:-1
meansauto
, values >= 0 set an exact pixel format.
In most cases the automatic-1
is enough. -
Output Folder.
Path to the folder where you want your snapshots to be placed.
Names of the snapshots will be in formatN.xxx
,
whereN
is the frame number andxxx
is the file extension. -
Writer.
Image encoder.
Possible values are following:libpng
- PNG format with the best compression and alpha channel
libjpeg
- JPEG format with the best quality (100)
stb
- PNG format with no compression, but with an alpha channel
-
N-th.
N-th frames to capture.
If set as 0 or 1, all the frames will be captured.
If set to N, where N is > 1, then each N-th frame will be captured.
For example, if N = 10, then frames 10, 20, 30, ... will be captured.
Note that the first frame is always captured independently of the setting.
Usage Example
MakeVideoSnapshot.exe D:\Videos\video.mp4 -1 -1 D:\Pictures libpng 10
This tool does not have its own strict versioning.
This tool was built using following libraries.
-
FFmpeg version
6.1
DLL Files: avcodec-60.dll, avformat-60.dll, avutil-58.dll, swscale-7.dll. -
libjpeg version
9e
DLL Files: none, it is built-into as a static library. -
libpng version
1.6.40
DLL Files: libpng16.dll. -
zlib version
1.3
DLL Files: zlib.dll. -
stb, no versioning
DLL Files: none.
Link.
If you have found a bug, have comments or want to suggest a new feature to be implemented, feel free to open an issue in this GitHub repository.