win7+MinGW编译ffmpeg遇到的问题总结

1、编译x264的时候老是不通过,用mingw编译最新的x264,./configure 时出现“No working C compiler found”,

原因:找不到c编译器。

解决办法:首先请确认你的已经正确安装c编译器,其次MinGW\msys\1.0\etc目下的fstab文件,如果不存在fstab,请复制一份fstab.sample,然后改名为:fstab,再修改其内容为:C:/mingw /mingw,也即为MinGW的安装路径。

2、集成ffmpeg/x264:ERROR: libx264 not found的问题

原因:找不到x264.h,

解决办法:--extra-cflags=-I/c:/x264/include --extra-ldflags=-L/c:x264/lib,这两句话是关键,一定要指向x264的包含目录和库目录。

3、出现如下错误:

  1. libavcodec/x86/h264_qpel_mmx.c:1294: Error: operand type mismatch for `cmp'  
  2. libavcodec/x86/h264_qpel_mmx.c:1294: Error: operand type mismatch for `cmp'  
  3. libavcodec/x86/h264_qpel_mmx.c:1298: Error: operand type mismatch for `cmp'  
  4. libavcodec/x86/h264_qpel_mmx.c:1298: Error: operand type mismatch for `cmp'  
  5. libavcodec/x86/h264_qpel_mmx.c:964: Error: operand type mismatch for `cmp'  
  6. libavcodec/x86/h264_qpel_mmx.c:964: Error: operand type mismatch for `cmp'  
  7. libavcodec/x86/h264_qpel_mmx.c:964: Error: operand type mismatch for `cmp'  

解决办法:把libavcodec/x86/h264_qpel_mmx.c中的"g"替换为“rm”即可解决!

4、unrecongnized command line option '-mno-cygwin'

原因:在GCC 4版本里去除了这个参数。

解决方法:把xvidcore\build\generic\configure里的删除-mno-cygwin。

5、libavcodec/libxvidff.c:implicit declaration of function 'tempnam'

原因:出现类似于“implicit declaration of function ***”这种错误,多半是由于没有正确添加头文件造成的。

解决方法:在libxvidff.c里加入#include<stdio.h>并加上extern  char *tempnam(const char *dir, const char *pfx);

6、在ffmpeg make install 中报“unable to rename '..../avformat-52.93.0.dll';reason:File exists”

解决方法:使劲make install。

7、编译FFMPEG时,出现了 ffmpeg yasm not found, use --disable-yasm for a crippled build

原因: FFMPEG了提高编译速度,使用了汇编指令,如果系统中没有yasm指令的话,就会出现上述的问题。

解决办法是:

A 如果是Windows系统, 从网上下载一个 yasm.exe 并安装在mingw/bin下面,重新编译,就不会出现该错误了;

B 如果是Linux系统,则更简单,直接在终端输入 sudo apt-get install yasm ,安装好后,重新编译就 OK了。

8、In file include from libavutil/file.c:27:0:c:\mingw\include\unistd.h:83:1: error: expected ',' or ';' before 'int'-------

c:\mingw\include\unistd.h:157:12:error:expected '=', ',', ';', 'asm' or '__attpribute__' before 'ftruncate'

解决方案:

把unistd.h里的内容替换为:

#ifndef _UNISTD_H
/*
 * This file is part of the Mingw32 package.
 *
 * unistd.h maps (roughly) to io.h
 * Other headers included by unistd.h may be selectively processed;
 * __UNISTD_H_SOURCED__ enables such selective processing.
 */
#define _UNISTD_H
#define __UNISTD_H_SOURCED__ 1


#include <io.h>
#include <process.h>
#include <getopt.h>


/* These are also defined in stdio.h. */
#ifndef SEEK_SET
#define SEEK_SET 0
#endif


#ifndef SEEK_CUR
#define SEEK_CUR 1
#endif


#ifndef SEEK_END
#define SEEK_END 2
#endif


#ifdef __cplusplus
extern "C" {
#endif


#if !defined __NO_ISOCEXT
#include <sys/types.h> /* For useconds_t. */


int __cdecl __MINGW_NOTHROW usleep(useconds_t useconds);
#endif  /* Not __NO_ISOCEXT */


/* This is defined as a real library function to allow autoconf
   to verify its existence. */
int ftruncate(int, off_t);
#ifndef __NO_INLINE__
__CRT_INLINE int ftruncate(int __fd, off_t __length)
{
  return _chsize (__fd, __length);
}
#endif


#ifdef __cplusplus
}
#endif


#undef __UNISTD_H_SOURCED__
#endif /* _UNISTD_H */

9.提示cpuid.o  emms.o  float_dsp.o  lls.o pixelutils.o  找不到

原因:应该是yasm.exe版本不合适.

解决方案:直接在./configure 里 --disable-yasm。

10、编译出来的ffmpeg和ffplay和ffprobe不输出任何信息。

原因:查看ffmpeg的config.mak文件发现:

CFLAGS-ffplay=-I/usr/local/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -mwindows 
ZLIB=-lz 
LIB_INSTALL_EXTRA_CMD=$$(RANLIB) "$(LIBDIR)/$(LIBNAME)" 
EXTRALIBS=-lavicap32 -lws2_32 -liconv -L/usr/local/lib -lmingw32 -lSDLmain -lSDL -mwidnows -lx264 -lm -pthread -lpsapi -ladvapi32 -lshell32 

注意红色标记的参数,-mwindows是windows窗口APP所需的参数,而要在控制台下输出信息必须是windows控制台程序。

解决方案1:删除-mwindows、重新make。

解决办法2:另外一种解决办法,修改sdl-config,将文件中的-mwindows删除。但须重新运行configure

11、variable 'xxx' has initializer but incomplete type

原因:xxx前面的类型定义没找到。

解决方案:正确包含xxx类型的头文件,或者自己把xxx类型的定义加上。

12、编译faac-1.28出错
 mpeg4ip_win32.h:66:29: error: 'int snprintf(char *buffer, size_t count, const char 


*format,...)' was declared 'extern' and later 'static' [-fpermissiver]
删除 static




 mpeg4ip_win32.h:70:36: error:'_TRUNCATE' was not declared in this scope ret = vsnprintf_s


(buffer, count, _TRUNCATE, format, ap);


 mpeg4ip_win32.h:70:57: error:'vsnprintf_s' was not declared in this scope ret = vsnprintf_s


(buffer, count, _TRUNCATE, format, ap);


http://pan.baidu.com/share/link?shareid=877671096&uk=1275400178
这是缺少faac的补丁,下载faac-1.28.diff,然后将其复制到faac-1.28目录中,执行下面的命令
patch -p1 < faac-1.28.diff


然后再make

13、../libavutil/libm.h:62: error: static declaration of 'lrint' follows non-static declaration

类似的错误:

  1. ../libavutil/libm.h:62: error: static declaration of 'lrint' follows non-static declaration  
  2. ../libavutil/libm.h:69: error: static declaration of 'lrintf' follows non-static declaration  
  3. ../libavutil/libm.h:76: error: static declaration of 'round' follows non-static declaration  
  4. ../libavutil/libm.h:83: error: static declaration of 'roundf' follows non-static declaration  
  5.   
  6. ./libavutil/libm.h:90: error: static declaration of 'truncf' follows non-static declaration 

解决办法在config.h搜索lrint、lrintf、round、roundf等对于的字符

  1. #define HAVE_LLRINT 1  
  2. #define HAVE_LLRINTF 1  
  3. #define HAVE_LRINT 1  
  4. #define HAVE_LRINTF 1  
  5. #define HAVE_ROUND 1  
  6. #define HAVE_ROUNDF 1  

将对于的值改为1即可

14、编译sdl2-2.0.3,出现错误:error: winapifamily.h: No such file or directory

这是2.0.3的bug,解决方案参照http://stackoverflow.com/questions/22446008/winapifamily-h-no-such-file-or-directory-when-compiling-sdl-in-codeblocks。

其实就是把SDL_platform.h的这几行:

#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
/* Try to find out if we're compiling for WinRT or non-WinRT */
/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */
#if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_)	/* _MSC_VER==1700 for MSVC 2012 */
#include <winapifamily.h>

替换为:

#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT or non-WinRT */
/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */
#if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_)	/* _MSC_VER==1700 for MSVC 2012 */
#include <winapifamily.h>

15、编译libaacplus的时候报错

configure: error: You need unzip utility to prepare sources.

原因:确实unzip。

解决方案:下载http://downloads.sourceforge.net/gnuwin32/unzip-5.51-1-bin.zip,解压bin/unzip.exe到/mingw/bin下。

16、libaacplus

configure: error: You need downloader utility to download sources (wget, fetch or curl).

原因:没有下载器。

解决方案:http://gd.tuwien.ac.at/gnu/mingw/wget-1.9.1-mingwPORT.tar.bz2,解压wget.exe到/mingw/bin下

17、编译python出错

./Modules/posixmodule.c:6200:14: error: 'F_SETFL' undeclared (first use in thisfunction)

解决方案:在makefile里找到编译这个文件那一行,打开-D_GNU_SOURCE开关。

做法:

把Modules/posixmodule.o: $(srcdir)/Modules/posixmodule.c; $(CC)  $(PY_CFLAGS)  -c $(srcdir)/Modules/posixmodule.c -o Modules/posixmodule.o 

改为Modules/posixmodule.o: $(srcdir)/Modules/posixmodule.c; -D_GNU_SOURCE $(CC)  $(PY_CFLAGS)  -c $(srcdir)/Modules/posixmodule.c -o Modules/posixmodule.o 

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dancing_night

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值