编译参考xvid源代码中的doc/INSTALL文件,针对其中遇到的问题:
下载NASM
http://sourceforge.net/projects/nasm (Win32版本)
解压缩后得到nasmw.exe, ndisasmw.exe,将nasmw.exe改为nasm.exe后将这两个文件拷到Microsoft Visual Studio/VC98/Bin下。
编译有可能出现以下错误: error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
如果你的VC是SP5,可以下载 Visual C++ 6.0 Processor Pack - http://msdn.microsoft.com/vstudio/downloads/tools/ppack/default.aspx 解决。
可是Visual C++ 6.0 Processor Pack 却没有针对SP6的,没有办法安装。那么就需要改xvid的源代码了。
在src/portab.h和vfw/src/status.h中
# define uint64_t unsigned __int64
改为:
# define uint64_t __int64
【不知道这样有后患吗】
网上流传的比较全面的编译版本:
作者: David Carroll,Peter Lee | |
2006-01-09 | |
OK, you've got your copy of Microsoft Visual C++ 6.0. You should be able to just download the source code, click on the project file, and a few second later, you'll have the Xvid Binary. Right? Well, unfortunately, it's not that easy. However, it's not that hard either. I. Downloading Necessary Files Xvid depends on a number of libraries and programs that do not come standard with Microsoft Visual C++ 6.0. You need: 1) Service Pack 5 for Visual Studio 6 - http://msdn.microsoft.com/vstudio/downloads/updates/sp/vs6/sp5/default.asp 2) Visual C++ 6.0 Processor Pack - http://msdn.microsoft.com/vstudio/downloads/tools/ppack/default.aspx 3) NASM - the famous Netwide Assembler - http://sourceforge.net/projects/nasm/ 4) DirectX 9.0 SDK - http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp 5) (optional) Pthreads for Win32 - http://sources.redhat.com/pthreads-win32/ II. Configuring the Compiler 1) Installing Service Pack 5 The Service Pack is easy to install since it comes with an installer. The installer's filename is "setupsp5.exe". Just find the file and double-click it. 2) Installing Visual C++ Processor PackDouble-click "vcpp5.exe" to install. 3) Installing and Configuring NASM a) Unzip the file to an easy to remember directory of your choosing (i.e., "C:/DEVELOP/NASM")
文件名一定要改成nasm.exe ,拷贝到Microsoft Visual Studio6/vc98/bin下即可 4) Installing and Configuring the DirectX SDK The DirectX SDK comes with an installer. Just double-click on the "setup.exe" file and follow the prompts. To configure the DirectX SDK:
III. Compiling XVID Now you can download the source code, click on the workspace file, and a few second later, you'll have the Xvid Binary. Just make sure you build the xvidcore first. IV. Installing XVID For Windows users, there are really only three files you have to be concerned with: 1) xvid.dll and xvid.inf - both of these files are in the "<path to Xvid source code>/vfw/bin/" directory. The "xvid.dll" file is the Xvid Video for Windows codec. This file is necessary if you wish to encode any videos using a Video for Windows compliant program (i.e., almost every video editor out there). In theory, you should be able to play back Xvid files in the Windows Media Player using this file as well although this functionality appears to be broken at this point. Therefore, if you wish to play back files in a media player, install the "xvid.ax" file (see below). The "xvid.inf" file is the setup information file. Basically, this file tells Windows how to install "xvid.dll". To install the Xvid Video for Windows codec (aka xvid.dll)
That's it, you're done. To verify that the file has been installed correctly, go to the Control Panel and select "Multimedia", then click on the "Devices" tab and finally see if "XVID" is listed under the "Video Compression Codecs" section. If you wish to uninstall the Xvid codec, select "XVID MPEG-4 CODEC" from the "Add/Remove Program" list in the Control Panel. 2) xvid.ax -This file is in the "<path to Xvid source code>/dshow/bin/" directory. The "xvid.ax" file is the Xvid DirectShow filter. Microsoft has decreed that DirectShow shall replace Video for Windows, so in theory you won't need "xvid.dll". However, this isn't true. Instead, the DirectShow filter is used mostly for playback by newer media players. Most video programs still depend on the Video for Windows codec for encoding. To install the Xvid DirectShow filter (aka xvid.ax)
That's it, you're done. There really is no easy way to verify that the DirectShow filter was properly installed other than to play a Xvid encoded video. To uninstall the DirectShow filter, go to the Start Menu and select "Run." Type "<path to Windows>/system/regsvr32 /u <path to xvid.ax>/xvid.ax" V. Troubleshooting FAQ Q. Why do I get the following error message:
A. You did not correctly install NASM. Q. What causes this error: "CXvidDecoder.obj : error LNK2001: unresolved external symbol _MEDIASUBTYPE_IYUV"? A. This is caused by an outdated strmbase.lib. You need to build a new one. The path to the project file is <path to DirectX SDK>/Samples/C++/DirectShow/BaseClasses/baseclasses.dsw. After you build the library, I recommend you copy the strmbase.lib file to <path to DirectX SDK>/lib. Q. I have ffdshow, do I need to install the XviD DirectShow filter? A. No, not really. Q. When trying to open a workspace file (.dsw), I get an "empty" workspace (i.e., there are no source files listed) and/or A. Often, this can be caused by having UNIX line breaks (LF) in the .dsw and .dsp files, as opposed to Windows line breaks (CR/LF). It is interesting to note that .dsw and .dsp files are just text files; you can open them up in any text editor. If you open the .dsw and .dsp files in a text editor that can't handle UNIX line breaks (namely Notepad) you will probably see big, black squares at the end of lines. You can "fix" this error by following this procedure.
Also, I have noticed that some "archive" utilities like Winzip will perform the UNIX -> Windows line break conversion automatically so I recommend you use those utilities. At the time of writing, archive utilities that don't perform this conversion include PowerArchiver and WinRAR. Q. I get lots of error messages similar to the following:
A. You are using an old version of NASM, download a newer version from http://sourceforge.net/projects/nasm/ Q. I get a few "fatal: unable to open include file `colorspace_mmx.inc'" errors. A. This is apparently caused by versions of NASM newer than 0.98.37. For whatever reason, NASM seems to have trouble dealing with relative paths. To fix the problem: a) Open up the project settings by pressing ALT-F7 or selecting "Settings" from the "Project" menu. Alternately, you could just downgrade back to NASM 0.98.36. Q. What does "error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64" mean? A. It means you need to install the Visual C++ Processor Pack. Q. I have Visual C++ 6.0 Standard. Microsoft says I need the Professional or Enterprise edition in order to install the Processor Pack. Does this mean I am out of luck? A. No. But it does mean you can't use the installer. Instead, you have to manually install the Processor Pack. Bascially, you have to:
Q. What causes this error: "C:/xvid/src/image/qpel.c(84) : fatal error C1083: Cannot open include file: 'C://xvid//src//image//qpel.c': No such file or directory." A. Not exactly sure why that happens - it should work. A quick fix is to open "qpel.c" and replace every instance of
|