linux mpeg4ip 编译,CentOS6.2下编译mpeg4ip

本文档详细记录了在CentOS6.264位系统上编译和安装mpeg4ip的过程,包括所需库的安装、编译过程中遇到的错误及其解决方案,如bash版本问题、ffmpeg相关库的安装、头文件冲突、宏定义问题等。通过解决这些问题,最终成功完成编译并进行了`make install`。
摘要由CSDN通过智能技术生成

一、环境

1、操作系统版本

CentOS 6.2 64位

uname -a的输出:

Linux localhost.localdomain 2.6.32-220.17.1.el6.x86_64 #1 SMP Wed May 16 00:01:37 BST 2012 x86_64 x86_64 x86_64 GNU/Linux

2、mpeg4ip版本

版本:1.6.1

下载链接:

52cb83d181f66b242c20c3501b41877e.png

二、编译

1、编译mpeg4ip需要的库

首先安装libtool库,命令如下:

yum install libtool

然后进入到mpeg4ip的目录,运行./bootstrap进行配置,如果出错,是因为bash版本及名称的问题,修改bootstrap文件中第一行,改sh为bash.或运行 bash ./bootstrap。

提示如下:

*** ffmpeg encoder is not installed

*** xvid encoder is not installed

*** x264 encoder is not installed

*** lame encoder is not installed

*** faac encoder is not installed

*** twolame encoder is not installed

安装相应库:

yum install ffmpeg-devel xvidcore-devel twolame-devel x264-devel

编译:make

2、编译中的错误处理

2.1报错内容:

In file included from config_opts.cpp:1:

/include/mpeg4ip.h:126: error: new declaration 'char* strcasestr(const char*,const char*)'

/usr/include/string.h:369: error: ambiguates old declaration 'const char* strcasestr(const char*, const char*)'

解决办法:

vi include/mpeg4ip.h

注释掉函数声明,如下所示:

5c1ad696e01cd0f72cdbe8f289b919f2.png

2.2报错内容:

cc1plus: warnings being treated as errors

sys_decoder_blkdec.cpp:190: error: suggest parentheses around '&&' within '||'

sys_decoder_blkdec.cpp:205: error: suggest parentheses around '&&' within '||'

如图所示:

7eb2cf63a6c3bddf2c164e69a47bc16e.png

解决办法:

vi common/video/iso-mpeg4/src/Makefile

去掉Werror

vi命令: %s/-Werror//

2.3报错内容:

type_basic.cpp:320: error: '' has incomplete type

type_basic.cpp:320: error: invalid use of 'Void'

type_basic.cpp:320: error: prototype for 'Void CMotionVector::setToZero()' does not match any in class 'CMotionVector'

./../include/basic.hpp:441: error: candidate is: Void CMotionVector::setToZero()

解决办法:

vi common/video/iso-mpeg4/src/type_basic.cpp

在320行去掉括号内的Void,如图所示:

06d97e72b4d24d5822e862fac31b96f5.png

2.4报错内容:

cc1: warnings being treated as errors

config.c: In function 'enter_chn':

config.c:636: error: array subscript is above array bounds

config.c:637: error: array subscript is above array bounds

解决办法:

vi player/lib/audio/faad/Makefile

去掉Werror

2.5报错内容:

/usr/local/include/libavutil/common.h: In function ‘int32_t av_clipl_int32(int64_t)’:

/usr/local/include/libavutil/common.h:154: error: ‘UINT64_C’ was not declared in this scope

...

解决办法:

涉及到标准c和c99的问题,在出问题的文件中加上下面三句话就好了

#ifndef UINT64_C#define UINT64_C(value)__CONCAT(value,ULL)

#endif

2.6报错内容:

In file included from ffmpeg.cpp:26:

ffmpeg.h:29:28: error: ffmpeg/avcodec.h: No such file or directory

...

解决办法:

版本遗留问题,修改下路径就行了。其实这是一类问题,接下来还会遇到好多次,以这个为例展例下,其它的照此修改就OK了。

vi player/plugin/audio/ffmpeg/ffmpeg.h

在第30行进行修改,替换成完整路径:

#include

91e29edd674bf3a847535c57968bd4ca.png

2.7报错内容:

ffmpeg.cpp: In function 'codec_data_t* ffmpeg_create(const char*, const char*, int, int, format_list_t*, audio_info_t*, const uint8_t*, uint32_t, audio_vft_t*,void*)':

ffmpeg.cpp:180: error: 'AVCODEC_MAX_AUDIO_FRAME_SIZE' was not declared in this scope

ffmpeg.cpp: In function 'int ffmpeg_decode(codec_data_t*, frame_timestamp_t*, int, int*, uint8_t*, uint32_t, void*)':

解决办法:

vi /usr/include/ffmpeg-spice/libavcodec/avcodec.h

查找AVCODEC_MAX_AUDIO_FRAME_SIZE,得到如下结果:

816fc276b0e78a324ba9fe4f01d5e476.png

复制其值到文件player/plugin/audio/ffmpeg/ffmpeg.h,并把Q去掉:

vi player/plugin/audio/ffmpeg/ffmpeg.h

添加如下内容:

#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000

3c1ec2b36cec81387820bfc428aad42a.png

2.8报错内容:

media_utils.cpp: In function 'int create_media_for_iptv(CPlayerSession*, const char*, int,control_callback_vft_t*)':

media_utils.cpp:613: error: invalid conversion from 'const char*' to 'char*'

解决办法:

vi player/src/media_utils.cpp

在613行,对name变量进行强制类型转换,如图所示:

df5b5d4330ba561b1aa8af85c610b097.png

2.9报错内容:

../server/mp4live/video_util_resize.h:93: error: conflicting declaration 'uint8_t* fV'

../server/mp4live/video_util_resize.h:91: error: 'fV' has a previous declaration as 'const uint8_t* fV'

../server/mp4live/video_util_resize.h:94: error: redefinition of 'uint32_t tvStride'

../server/mp4live/video_util_resize.h:94: error: 'uint32_t tvStride' previously declared here

解决办法:这个就是函数声明的时候变量重名了,把名字修改的不同就OK了。这是我修改:

void CopyYuv(const uint8_t *fY, const uint8_t *fU, const uint8_t *fV,

uint32_t fyStride, uint32_t fuStride, uint32_t fvStride2,

uint8_t*tY, uint8_t *tU, uint8_t *fV2,

uint32_t tyStride, uint32_t tvStride, uint32_t tvStride2,

uint32_t w, uint32_t h);

2.10报错内容:

video_ffmpeg.cpp:124: error: 'struct AVCodecContext' has no member named 'frame_rate'

video_ffmpeg.cpp:125: error: 'struct AVCodecContext' has no member named 'frame_rate_base'

video_ffmpeg.cpp:136: error: 'struct AVCodecContext' has no member named 'aspect_ratio'

解决办法:

这几个错误影响不大,就直接注释掉了,我主要用mp4livevi server/mp4live/video_ffmpeg.cpp

52c315278e3fed7f7bfe78d4ba26f262.png

好,编译成功,make install即可使用。

三、安装使用

1、安装

make install

2、使用mp4live

7f83b37cc3cef3d547969c8bea2aa505.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值