Ubuntu 12.04 x64 下安装 GStreamer+FFmpeg+Opencv

Ubuntu 12.04 x64 下安装 GStreamer+FFmpeg+Opencv

 

 近期,因为安装这三个开发软件,搞编译环境,上网找方法,足足耗费了我一个多星期的时间,现在将经验记录一下,在虚拟机和实体机上亲测成功安装。


总流程:

GStreamer -> x264 -> x265 -> ffmpeg -> opencv


00.配置一下运行环境 
# sudo vim /etc/ld.so.conf
新增行在文本末尾加上 /usr/local/lib
新增行在文本末尾加上 /usr/local
新增行在文本末尾加上 /usr/lib


01.Gstreamer
sudo add-apt-repository ppa:gstreamer-developers/ppa  &&
sudo apt-get update &&
sudo apt-get install gstreamer1.0* &&
gst-inspect-1.0


02.x264(yasm)
# wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
# tar xvf yasm-1.2.0.tar.gz
# ls
# cd yasm-1.2.0
# ./configure --prefix=/usr
# make
# make install
# cd ..

# wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
# tar xvf  last_x264.tar.bz2
# ls
# cd x264-snapshot-20140305-2245
# ./configure --enable-shared --enable-pic --enable-static
# make  
# make install
# cd ..
# x264 --help


03.x265(cmake 2.8.8、yasm 1.20)

install cmake
# sudo add-apt-repository ppa:whoopie79/ppa &&
# sudo apt-get update &&
# sudo apt-get install cmake
# cmake --version

install others
# sudo apt-get install mercurial cmake-curses-gui build-essential

install x265
# hg clone https://bitbucket.org/multicoreware/x265
# cd x265/build/linux
# ./make-Makefiles.bash
按一下 c ,按一下 g ,按一下 q.
# make
# make install
# ldconfig
# x265 --help
# cd ..
# cd ..
# cd ..

04.FFmpeg
# git clone git://source.ffmpeg.org/ffmpeg.git
# cd ffmpeg
# ./configure  --prefix=/usr/local --enable-shared --enable-static  --enable-gpl --enable-libx264  --enable-libx265 --enable-ffplay --enable-ffserver
# make
# make install
# ldconfig
# ffmpeg


05.OpenCV
# sudo apt-get install libgtk2.0-dev pkg-config python-dev  python-numpy libavcodec-dev libavformat-dev libswscale-dev libdc1394-22  libjpeg-dev libpng-dev libtiff-dev libjasper-dev

从官方下载OpenCV的文件: http://sourceforge.net/projects/opencvlibrary/files/
tar xvf OpenCV.tar.bz2
进入OpenCV的文件夹

# mkdir release
# cd release
# sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
# sudo make
# sudo make install

# sudo gedit /etc/ld.so.conf.d/opencv.conf   # 添加下面这句命令到文件中,文件是空的,不影响。
-> /usr/local/lib
# sudo ldconfig

# sudo vim /etc/bash.bashrc  # 添加下面两行到文件的末尾。
-> PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
-> export PKG_CONFIG_PATH

路径配置完毕进行测试:
# cd opencv-2.4.5/samples/c
# chmod +x build_all.sh
# ./build_all.sh
# ./facedetect --cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 lena.jpg

你可能感兴趣的:(ubuntu,ffmpeg,opencv,gstreamer)