First of all, according to the "FFmpeg development in action: from zero to short video on the line" book chapter 1 "1.3 Windows system to install FFmpeg," the introduction, the compiled FFmpeg library is installed to the personal computer's E:\msys64\usr\local\ffmpeg (). This installation directory can be replaced with the actual installation path of your computer, note that once you change the installation directory of FFmpeg, all the FFmpeg installation path configurations should be changed as well).
Open the pre-installed Visual Studio 2022 again and create a C++-based console application project. Wait for Visual Studio to open the new project, right-click on the project name in the Solution Explorer window on the right side of the main interface, and select the Properties option at the bottom of the context menu. In the pop-up properties page, select the list item on the left: Configuration Properties → VC++ Catalog, and select the list item on the right side of the properties page: General → External Include Catalog → Edit. Add the following header file directory in the External Include Directory pop-up window (the exact path is adjusted according to the ffmpeg installation path on your computer):
Confirm the addition of the above two header file directories by clicking the OK button in the lower right corner of the External Include Directory window.
Next, select the list item on the left side of the property page: Configuration Properties → Linker → General, and select the list item on the right side of the page: Additional Library Directory → Edit. Add the following library directory to the Additional Library Directory window that pops up (the exact path is adjusted according to the path of the sdl2 installation on your computer):
Confirm the addition of the above two library file directories by clicking the OK button in the lower right corner of the Additional Library Directories window.
Next, select the list items on the left side of the properties page in order: Configuration Properties → Linker → Input and select the list items on the right side of the page in order: Additional Dependencies → Edit. Add the following list of lib files to the Additional Dependencies pop-up window:
The Additional Dependencies window with the added lib file configuration is shown below. Click the OK button in the lower right corner of the Additional Dependencies window to confirm the addition of the above list of lib files.
Then click the OK button at the bottom right corner of the property page to complete the FFmpeg and SDL2 dependency library import settings.
Go back to the main interface of Visual Studio 2022, fill in the following FFmpeg test code in the code editor window on the left, which mainly calls the av_log function of FFmpeg framework to output "Hello World".
After saving the test code, select the top menu: Debug→Start Execution, Visual Studio will start to compile the test program, compilation is complete, the console window pops up and outputs a line of the log "Hello World", which indicates that the FFmpeg library has been successfully integrated into Visual Studio's C++ project. FFmpeg library in Visual Studio's C++ project.
For more details on FFmpeg development see