FFmpeg Understanding(4. How to compile and run testing files utilizing FFMPEG in VC?)

本文介绍如何在Visual C++环境中编译并运行FFMPEG测试文件,包括创建控制台应用程序、配置项目属性、添加必要的库文件及依赖项等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

rel="File-List" href="file:///C:/DOCUME%7E1/MICROS%7E1/LOCALS%7E1/Temp/msoclip1/01/clip_filelist.xml"> rel="Edit-Time-Data" href="file:///C:/DOCUME%7E1/MICROS%7E1/LOCALS%7E1/Temp/msoclip1/01/clip_editdata.mso">

4. How to compile and run testing files utilizing FFMPEG in VC?

1. Create a new console application ("File / New / Project") and then select "Win32 Console Application". On the appropriate page of the Application Wizard, uncheck the "Precompiled headers" option.

2. Write the source code for your application, or, for testing, just copy the code from an existing sample application into the source file that VC has already created for you. For example, you can copy `output_example.c' from the FFmpeg distribution.

3. Open the "Project / Properties" dialog box. In the "Configuration" combo box, select "All Configurations" so that the changes you make will affect both debug and release builds. In the tree view on the left hand side, select "C/C++ / General", then edit the "Additional Include Directories" setting to contain the path where the FFMPEG is installed. Please refer Figure 4-1, and the“C:/Source Code/ffmpeg” is used in this instance.


Figure 4-1 Additional Include Directories

4. Still in the "Project / Properties" dialog box, select "Linker / General" from the tree view and edit the "Additional Library Directories" setting to contain the `lib' directory where FFMPEG was installed(referring Figure 4-2). Then select "Linker / Input" from the tree view, and add the files ‘avcodec-52.lib avdevice-52.lib avformat-52.lib avutil-49.lib’ to the end of "Additional Dependencies". Please refer to Figure 4-3.


Figure 4-2 Additional Library Directories


Figure 4-3 Additional Dependencies

5. Now, select "C/C++ / Code Generation" from the tree view. Select "Debug" in the "Configuration" combo box. Make sure that "Runtime Library" is set to "Multi-threaded Debug DLL". Then, select "Release" in the "Configuration" combo box and make sure that "Runtime Library" is set to "Multi-threaded DLL".

6. Click "OK" to close the "Project / Properties" dialog box.

7. VC lacks some C99 header files that are fundamental for FFMPEG. Get msinttypes from msinttypes-r21.zip and extract it in VC's include directory (i.e. ` C:/Program Files/Microsoft Visual Studio 8/VC/include ').

8. VC also does not understand the inline keyword used by FFMPEG, so you must add this line before #includeing libav*. Moreover, some functions, such as snprintf etc, must be added ‘_’ before initial character. For instance, changing snprintf to _snprintf.

#define inline _inline

9. Compile the testing files and copy ‘avcodec-52.dll avdevice-52.dll avformat-52.dll avutil-49.dll’ into folder encapsulating executable file after building completely, and then run it.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值