compile and install ffmpeg on Ubuntu

前端之家收集整理的这篇文章主要介绍了compile and install ffmpeg on Ubuntu前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
compile and install ffmpeg on Ubuntu

there are three steps in build ffmpeg
configuration (with a configure script)
compilation (with make)
installation (with make install)

1. configuration
./configure --prefix=$HOME/ffmpeg_build# run it under ffmpeg top directory
but a error occured during this configuration. it said yasm not installed. so to install it.

about yasm:
An assembler for x86 optimizations used by x264 and FFmpeg. Highly recommended or your resulting build may be very slow.
If your repository offers a yasm package ≥ 1.2.0 then you can install that instead of compiling

the yasm package in my repository is less than 1.2.0,so i did source code installation
cd /work/ffmpeg/ffmpeg-3.2.2
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
make distclean
notice:
a. --bindir="$HOME/bin is the directory yasm to be installed to
b. you should add $HOME/bin to $PATH otherwise the same error will continue to occur in configuration step.
after yasm installed,execute ffmpeg configuration again. and it succeeded.

2. make
run make under ffmpeg home directory

3. install
make install

after step 3,the ffmpeg build is finished. the build results are:
$HOME/ffmpeg_build/lib: all ffmpeg libs such as libavcodec.a and libavformat.a
$HOME/ffmpeg_build/include ffmpeg header files(APIs)
$HOME/ffmpeg_build/bin ffmpeg executable programs,namely ffmpeg,ffplayer and ffserver
in order to run ffmpeg program in any directory,we can add $HOME/ffmpeg_build/bin to $PATH(and export $PATH)

references 1. Compile FFmpeg on Ubuntu,Debian,or Mint https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu 2. wiki: Compilation Guide Generic https://trac.ffmpeg.org/wiki/CompilationGuide/Generic#Whytocompilefromsource
原文链接:https://www.f2er.com/ubuntu/354723.html

猜你在找的Ubuntu相关文章