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
完