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

来源:互联网 发布:ubuntu 安装povray 编辑:程序博客网 时间:2024/06/06 08:52

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

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

2. Write the source code for yourapplication, or, for testing, just copy the code from an existing sampleapplication into the source file that VC has already created for you. Forexample, you can copy `output_example.c' from the FFmpeg distribution.

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


Figure4-1 Additional Include Directories

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


Figure4-2 Additional Library Directories


Figure4-3 Additional Dependencies

5. Now, select "C/C++ / CodeGeneration" 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 surethat "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 arefundamental for FFMPEG. Get msinttypes from msinttypes-r21.zipand extract it in VC's include directory (i.e. ` C:/Program Files/MicrosoftVisual Studio 8/VC/include ').

8. VC also does not understand the inlinekeyword used by FFMPEG, so you must add this line before #includeing libav*.Moreover, some functions, such as snprintf etc, must be added ‘_’ before initialcharacter. 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 folderencapsulating executable file after building completely, and then run it.

 

原创粉丝点击