现在的位置: 首页 > 综合 > 正文

FFmpeg Compiling Issues

2013年09月18日 ⁄ 综合 ⁄ 共 1848字 ⁄ 字号 评论关闭

最近需要用到ffmpeg,其实一部分也是自己感兴趣选了这个试试。目前在windows和mac下都编译通过,备忘

 

1.  unresolved external symbol

img_convert(AVPicture *dst, int dst_pix_fmt, const AVPicture *src, int pix_fmt, int width, int height);

 

似乎ffmpeg最近作了些大的接口改动,去年(08年)早些时候把上述函数去掉了,代以swscale,其中有牵涉到GPL,LGPL的限制。我不是太懂这二者的区别,具体可参考下面的帖子

 

Linking problems using ffmpeg static and visual studio 2008

http://ffmpeg.arrozcru.com/forum/viewtopic.php?f=8&t=87

 

2. 编译ffmpeg时可以选择GPL还是LGPL

./configure --enable-memalign-hack -> gives LGPL binaries with img_convert code and swscale API
./configure --enable-memalign-hack --enable-swscale --enable-gpl -> gives GPL binaries with swscale code and swscale API

 

3. INT64_C identifier not found

Solution 1:

in /usr/local/include/ffmpeg/avformat.h
:

#define INT64_C

#define __STDC_CONSTANT_MACROS

#include <stdint.h>

 

Solution 2:

Use -D__STDC_CONSTANT_MACROS while compiling FFMPEG, or

CXXFLAGS=-D__STDC_CONSTANT_MACROS when compiling any project including ffmpeg

注意对Linux和mac -D是必须的,VisualStudio(我用05)里在Preprocessor Defintions里加__STDC_CONSTANT_MACROS就行了

 

4. 如何按照帧序号来定位(Seek)视频

由于压缩的缘故,按帧序号搜索不如时间戳(timestamp)来得方便直接。问题也不是workaround可以解决的。思路是

my approach for seeking to a precise frame

http://www.mail-archive.com/libav-user@mplayerhq.hu/msg01209.html

 

幸好有人已经实现了。

ffmpeg- Frame Accurate Seeking Extension

http://sourceforge.net/projects/ffmpeg-fas/

 

5. error C2143: syntax error : missing ';' before 'type'

这是Visual Stodio的问题。如果编译.c文件时,所有本地变量(local variables)必需在函数开头声明!

所以

int foo()
{

   do sth;

    int x = 1;

    do sth else;

    return x;
}

 

要写成

 

int foo()
{
    int x;
   do sth;
    x = 1;
    return x;
}

 

---哇,以前好像是有这么个印象,遥远的记忆。。。非常annoying的一件事!尤其是定义临时变量时

C89这么要求,C99就可以在需要时再定义了

 

5. 另一些还没遇到,备注

================

出现问题
1. #include "version.h"  找不到文件。
注释掉这行,好像没什么用处。

2. _main 重复定义
在ffplay.c文件前面 增加 #define __MINGW32__    (这个应该都想得到,We don't want SDL to override our main() )

3. unresolved external symbol _rint ...
自己编写该函数
int rint(int x)
{
return (int)(x + (x < 0 ? -0.5 : 0.5));
};

4. unresolved external symbol _av_log_level
注释掉源代码 av_log_level =99;

5. 注释掉show_help函数内容。

==================


 

抱歉!评论已关闭.