#include <iostream>using namespace std;extern "C" {#include <libavcodec/avcodec.h> // required headers#include <libavformat/avformat.h>}int main(int argc, char**argv) { av_register_all(); // offending library call return 0;}
ffmpeg 默认是用C文件来编译的,如果某个CPP文件想引用ffmpeg中的某些函数或者头文件,有可能出现
‘UINT64_C’ was not declared in this scope的错误
情形大概如下
The same issue i‘m getting here when compiling chromium with ffmpeg from svn:
In file included from /usr/include/libavutil/avutil.h:81:0,
from /usr/include/libavcodec/avcodec.h:30,
from out/Release/obj.target/geni/ffmpeg_stubs.cc:16:
/usr/include/libavutil/common.h: In function ‘int32_t av_clipl_int32(int64_t)‘:
/usr/include/libavutil/common.h:154:47: error: ‘UINT64_C‘ was not declared in this scope
make: *** [out/Release/obj.target/geni/ffmpeg_stubs.o] Error 1
可以 在cpp文件中加入
extern "C"{
#ifdef __cplusplus
#define __STDC_CONSTANT_MACROS
#ifdef _STDINT_H
#undef _STDINT_H
#endif
# include <stdint.h>
#endif
}
来解决
如果在android下用编译。在Android.mk加入
LOCAL_CFLAGS := -D__STDC_CONSTANT_MACROS即可
#ifdef __cplusplus extern "C" { #endif void AfterSessionDone(); void openURL(UsageEnvironment& env, char const* progName, char const* rtspURL,Authenticator *authDB,const int Channel); char* h264_decode_buf_prepare(char *sps,int sps_len,char* pps,int pps_len,char* buf_in, char* buf_pre_for_h264_decode,int framesize,const int Channel); #ifdef __cplusplus } #endif
编译为动态库时的问题:
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S against `av_destruct_packet‘ can not be used when making a shared object; recompile with -fPIC
修改方法:
./configure --enable-pic && make
如果使用的是虚拟机进行开发live555.需要加入路由表:
route add default gw xxx.xxx.xxx.xxx eth0
编译ffmpeg后,直接编译示例不能通过显示库不能找到问题解决。
原来,为了让pkg-config可以得到这些信息,要求库的提供者,提供一个.pc文件,.pc文件里面存放的是一些头文件及库的地址。这些.pc文件默认放在/usr/share/pkgconfig里面,如果你改变了.pc的存放路径,必须要让计算机知道,所以需要修改 PKG_CONFIG_PATH 。
假设我的.pc文件放到了/usr/local/lib/pkgconfig下,我需要做如下修改:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
live555在windows环境编译vs2010:
Ⅲ 编译步骤
方法一(Win7下命令方式)
0 综述:利用genWindowsMakefiles.cmd生成VS可用的makefile
1 修改win32config。打开live\win32config文件,修改如下
TOOLS32 = c:\Program Files\DevStudio\Vc |
TOOLS32 = E:\Program Files\Microsoft Visual Studio 10.0\VC |
将TOOLS32修改为你的VS2010路径 |
LINK_OPTS_0 = $(linkdebug) msvcirt.lib |
LINK_OPTS_0 = $(linkdebug) msvcrt.lib |
编译器索要的LINK运行库不同,原本以为可以改为msvcrt100.lib,但没找着 |
2 新增Makefile设定。打开live\groupsock\Makefile.head,修改如下
INCLUDES = -Iinclude -I../UsageEnvironment/include |
INCLUDES = -Iinclude -I../UsageEnvironment/include -DNO_STRSTREAM |
3 建立makefile
方法:运行live\genWindowsMakefiles.cmd,生成VS能够编译的*.mak文件
4 建立build.bat命令
新建live\complie.bat,并添加内容如下:
call "E:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"cd liveMedianmake /B -f liveMedia.makcd ../groupsocknmake /B -f groupsock.makcd ../UsageEnvironmentnmake /B -f UsageEnvironment.makcd ../BasicUsageEnvironmentnmake /B -f BasicUsageEnvironment.makcd ../testProgsnmake /B -f testProgs.makcd ../mediaServernmake /B -f mediaServer.mak
5 开始编译:(命令行下)执行complie.bat
参考地址:http://www.cnblogs.com/skyseraph/archive/2012/04/11/2442840.html
参考文章:
http://blog.csdn.net/onelight1997/article/details/7528935
live555虚拟机下不能获取数据问题:
http://blog.csdn.net/wesleyluo/article/details/6204635
http://blog.csdn.net/liushu1231/article/details/9203239
识别I帧P帧B帧。
http://blog.csdn.net/linzhiji/article/details/5393647
解码流程经典教程:
http://www.360doc.com/content/11/1117/09/8050095_165108638.shtml
ffmpeg时间戳问题汇总
http://www.cnblogs.com/loveclover/archive/2011/03/23/1993065.html
ffmpeg开发SDK介绍
http://blog.sina.com.cn/s/blog_62a8419a01016exv.html
含有B帧时的疑惑
http://bbs.csdn.net/topics/390692774
100行代码实现最简单的基于FFMPEG+SDL的视频播放器
http://blog.csdn.net/leixiaohua1020/article/details/8652605
ffmpeg解码花屏,码流丢失问题
http://bbs.rosoo.net/thread-14856-1-1.html
http://blog.csdn.net/howema/article/details/6065441
FFMPEG重要学习官方资料: