ubuntu12.04上live555+v4l2+ffmpeg+x264开发环境的搭建


我把可能会用到的主要资源上传到度盘: http://pan.baidu.com/s/1i38AleP

ubuntu上安装主要步骤就是解压、configure、make、sudo make install

live555的安装可以看这里: http://www.live555.com/liveMedia/#config-unix

libx264的安装则是直接解压、然后configure、make和sudo make install,configure命令如下

./configure --disable-asm --enable-static --enable-shared

 

关键就是ffmpeg,可以看这里:https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

这里面有一些库如果你觉得不是很必要或者实在觉得装不上也可以不装(毕竟主要用的是x264),比如我编译安装的时候就没有--enable-libvpx

里面把ffmpeg的相关库都放到一起了,其实不指定prefix什么的也是可以的,看你自己喜好,默认安装到/usr/local/lib

我最后的configure语句是:

./configure --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-x11grab --enable-shared

这样还没完,你编译运行你自己写的时候可能还会报错

 

/usr/local/include/libavutil/common.h:30:2: error: #error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
/usr/local/include/libavutil/common.h:192:47: error: ‘UINT64_C’ was not declared in this scope

 

fix方法是直接在common.h的最前面加上:

 

#ifdef __cplusplus
#define __STDC_CONSTANT_MACROS
#ifdef _STDINT_H
#undef _STDINT_H
#endif
# include <stdint.h>
#endif

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

如果还出现找不到库的情况:

 

error while loading shared libraries: libavdevice.so.55: cannot open shared object file: No such file or directory

首先确认在安装路径下这些库存在,如果存在,则编辑 /etc/ld.so.conf文件,把安装路径加上,比如我的安装路径是/usr/local/lib,修改后整个文件就是

include /etc/ld.so.conf.d/*.conf
/usr/local/lib

相关内容