#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后,直接编译示例不能通过显示库不能找到问题解决。
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
live555在windows环境编译vs2010:
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 liveMedia nmake /B -f liveMedia.mak cd ../groupsock nmake /B -f groupsock.mak cd ../UsageEnvironment nmake /B -f UsageEnvironment.mak cd ../BasicUsageEnvironment nmake /B -f BasicUsageEnvironment.mak cd ../testProgs nmake /B -f testProgs.mak cd ../mediaServer nmake /B -f mediaServer.mak
5 开始编译:(命令行下)执行complie.bat
参考地址: http://www.cnblogs.com/skyseraph/archive/2012/04/11/2442840.html
参考文章:
linux获取本机IP地址问题(live555)
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
FFMpeg中的函数
http://blog.csdn.net/howema/article/details/6065441
FFMPEG重要学习官方资料:
http://ffmpeg.org/faq.html