FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It’s not difficult to write your own simple video editor with it.
This post will give you a guide, how to write a program with FFmpeg on Windows, with Visual Studio.
In general, for an Open Source library, we may usually need build one from source code. And on Windows, it could be kind of confusing.
Luckily, there is a nice hacker, who has built FFmpeg on Windows for us.
We can find them on https://ffmpeg.zeranoe.com/builds/.
What we need is two linking type files on Windows. So, for “Architecture”, Windows-32bits or Windows-64bits. And in linking, we need dev and shared. Shared library can proivde runtime for the compiled program, meanwhile, in dev, we will have header files and exported symbol information to use during development.
Create a new Visual C++ project, do not use precompiled header file.
Then, right click on the project to open Property panel.
ffmpeg-<version>-win64-shared\bin into your system PATH.
ffmpeg-<version>-win64-dev\include into VC++ Directory -> Include directory.
ffmpeg-<version>-win64-dev\lib into VC++ Directory -> Reference directory.
postproc.lib into Linker -> Input -> Addons.
This code comes from FFmpeg samples, it works as a video decoder but it just gets and prints video meta information.
To run it in Visual Studio, in
debugging, add the path of your video into command line arguments.
And right click on the green triangle.
In the terminal, you should be able to see the meta information like this: