Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3515755
  • 博文数量: 1805
  • 博客积分: 135
  • 博客等级: 入伍新兵
  • 技术积分: 3345
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-19 20:01
文章分类

全部博文(1805)

文章存档

2017年(19)

2016年(80)

2015年(341)

2014年(438)

2013年(349)

2012年(332)

2011年(248)

分类: LINUX

2013-10-10 10:22:16

编译ffmpeg无法生成ffplay的问题解决


好多人问编译ffmpeg时无法生成ffplay,其具体原因多数是由于没有SDL或者SDL版本不正确所导致。

解决办法如下:

安装正确的SDL库既可解决


点击(此处)折叠或打开

  1. wget http://libsdl.org/release/SDL-1.2.15.tar.gz
  2. tar zxvf SDL-1.2.15.tar.gz
  3. cd SDL-1.2.15
  4. ./configure --prefix=/usr
  5. make -j16
  6. sudo make install

安装完成后,再次编译ffmpeg既可解决


原因分析:

打开configure分析一下内容既可看到如下内容:



点击(此处)折叠或打开

  1. SDL_CONFIG="${cross_prefix}sdl-config"
  2. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3.     check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  4.     check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  5.     enable sdl
  6. else
  7.   if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  8.     sdl_cflags=$("${SDL_CONFIG}" --cflags)
  9.     sdl_libs=$("${SDL_CONFIG}" --libs)
  10.     check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  11.     check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  12.     check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  13.     enable sdl
  14.   fi
  15. fi
  16. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs

这里比较关键,首先判断SDL.h中的版本对应的值在通过计算后是否在0x010201至0x010300之间,如果是的话SDL版本才会正确的被执行,否则这个测试项将会出现错误,生成的config.log中有对应的错误记录

当没有安装SDL库时,config.log中相关的错误信息如下


点击(此处)折叠或打开

  1. check_pkg_config sdl SDL_events.h SDL_PollEvent
  2. false --exists --print-errors sdl

当安装的SDL版本库不对应时,config.log中对应的错误信息如下


点击(此处)折叠或打开

  1. check_pkg_config sdl SDL_events.h SDL_PollEvent
  2. false --exists --print-errors sdl
  3. check_func_headers SDL_version.h SDL_Linked_Version -I/usr/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE -L/usr/lib -lSDL2
  4. check_ld cc -I/usr/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE -L/usr/lib -lSDL2
  5. check_cc -I/usr/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE -L/usr/lib
  6. BEGIN /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.NYPJoPCV.c
  7.     1 #include <SDL_version.h>
  8.     2 long check_SDL_Linked_Version(void) { return (long) SDL_Linked_Version; }
  9.     3 int main(void) { return 0; }
  10. bbs.chinaffmpeg.com 孙悟空
  11. END /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.NYPJoPCV.c
  12. gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -std=c99 -mdynamic-no-pic -fomit-frame-pointer -fPIC -I/usr/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE -L/usr/lib -c -o /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.q6QhmvUN.o /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.NYPJoPCV.c
  13. /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.NYPJoPCV.c: In function 'check_SDL_Linked_Version':
  14. /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.NYPJoPCV.c:2: error: 'SDL_Linked_Version' undeclared (first use in this function)
  15. /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.NYPJoPCV.c:2: error: (Each undeclared identifier is reported only once
  16. /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.NYPJoPCV.c:2: error: for each function it appears in.)

或者如下错误


点击(此处)折叠或打开

  1. BEGIN /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.mfC1B2mW.c
  2.     1 #include <SDL_version.h>
  3.     2 long check_SDL_GetVersion(void) { return (long) SDL_GetVersion; }
  4.     3 int main(void) { return 0; }
  5. END /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.mfC1B2mW.c
  6. gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -std=c99 -mdynamic-no-pic -fomit-frame-pointer -fPIC -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE -L/usr/local/lib -c -o /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.E9d2cGZ6.o /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.mfC1B2mW.c
  7. gcc -Wl,-dynamic,-search_paths_first -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE -L/usr/local/lib -o /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.Z74XFGa5 /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.E9d2cGZ6.o -lSDL2 -lm -lbz2 -lz
  8. check_cpp_condition SDL.h (SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201 -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE
  9. check_cpp -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE
  10. BEGIN /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.mfC1B2mW.c
  11.     1 #include <SDL.h>
  12.     2 #if !((SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201)
  13.     3 #error "unsatisfied condition: (SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201"
  14.     4 #endif
  15. END /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.mfC1B2mW.c
  16. gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -std=c99 -mdynamic-no-pic -fomit-frame-pointer -fPIC -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE -E -o /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.E9d2cGZ6.o /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.mfC1B2mW.c
  17. check_cpp_condition SDL.h (SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300 -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE
  18. check_cpp -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE
  19. BEGIN /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.mfC1B2mW.c
  20.     1 #include <SDL.h>
  21.     2 #if !((SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300)
  22.     3 #error "unsatisfied condition: (SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300"
  23.     4 #endif
  24. bbs.chinaffmpeg.com 孙悟空
  25. END /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.mfC1B2mW.c
  26. gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -std=c99 -mdynamic-no-pic -fomit-frame-pointer -fPIC -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_THREAD_SAFE -E -o /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.E9d2cGZ6.o /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.mfC1B2mW.c
  27. /var/folders/z5/31tj_ff977n3r59bx1cwg98c0000gn/T//ffconf.mfC1B2mW.c:3:2: error: #error "unsatisfied condition: (SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300"


根据对ffplay与ffmpeg中libavdevice中SDL相关的接口与SDL1和SDL2的初步对比,发现SDL2与SDL1差别还是蛮大的,要改libavdevice也是力气活,所以如果SDL1不影响太多的话,还是用SDL1吧 

阅读(330) | 评论(0) | 转发(0) |
0

上一篇:Git Tips

下一篇:Hadoop与Hbase分布式配置

给主人留下些什么吧!~~