ffmpeg compile and install ubuntu18.04 4.1

centos 64 can be downloaded: https://download.csdn.net/download/m0_37641005/10642836

 

gpu transcoding:

https://my.oschina.net/u/2950272/blog/1796874?p=2&temp=1525757428640

 

ubuntu18.04 ffmpeg 4.1 compiler installation

Original: https://blog.csdn.net/specialshoot/article/details/85239956

Official documents (not generate shared libraries):


https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu#RevertingChangesMadebyThisGuide
参考CSDN:
https://blog.csdn.net/u010821666/article/details/74905654


Why can not produce an official document shared libraries?

Official documentation to install ffmpeg and ffmpeg itself dependent libraries are added to the static option, you can get rid of static options (note, compile and install ffmpeg dependent libraries have to get rid of static options) and add shared option.

There is no simple way on ubuntu?

1. First dependent libraries are using sudo apt install installation, in addition to other libaom have, libaom is dependent ffmpeg4.1 new library, the library here:

https://download.csdn.net/download/specialshoot/10873750

Baidu network disk: Link: https://pan.baidu.com/s/1iCakuuaO3OmdjISux8j2_w extraction code: h6hu

2. compile and install ffmpeg

In the dependent libraries installed after you can compile and install the ffmpeg, pay attention to the official documents static removed, while adding enabled-share option!
Compile both generate static libraries generated using the shared library as follows (refer to the above configuration CSDN blog):

cd ~/ffmpeg_sources && \
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
tar xjvf ffmpeg-snapshot.tar.bz2 && \
cd ffmpeg && \
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--bindir="$HOME/bin" \
--enable-shared \
--enable-gpl \
--enable-libaom \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree && \
PATH="$HOME/bin:$PATH" make && \
make install && \
hash -r


Note that the above method has --enable-shared option, as well as build path, here are installed in $ HOME / ffmpeg_build that is the root directory, I was installed in / usr / local / ffmpeg directory, it will command all of the $ HOME / ffmpeg_build changed to / usr / local / ffmpeg can. ( The PATH = "$ the HOME / bin: $ the PATH" instead PATH = "/ usr / local / ffmpeg / bin: $ PATH")

3. Set the environment variables:

In the / etc / profile add the last two (FFMPEG_HOME our ffmpeg installation path):

export FFMPEG_HOME=/usr/local/ffmpeg
export PATH=$FFMPEG_HOME/bin:$PATH

In /etc/ld.so.conf Lane added:

/usr/local/ffmpeg/lib/

All ffmpeg installed!

 

If you do not libx264, to compile x264:

 

First talk about my needs, use ffmpeg library implements transcoding, increase watermark, screenshot function, the output file is fixed at H264 video encoding, audio encoding to AAC

System centos7.2

1. First ffmpeg library no x264, x264 need to download the library, compile it yourself, address: http: //www.videolan.org/developers/x264.html

The need to download the compiled ahead yasm library address: http: //www.linuxfromscratch.org/blfs/view/svn/general/yasm.html

./configure

make && make install

Then compile and install x264 library

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

./configure --enable-shared

make && make install

2. Because you want to add a watermark, image watermark and text watermark into, text watermark drawtext need to use this filter, you need to install libfreetype, libfontconfig
details see ffmpeg official document: https: //ffmpeg.org/ffmpeg-filters. html # drawtext-1 (may need over the wall)

libfreetype Download: https: //www.freetype.org/download.html

Can be directly mounted yum command: yum install freetype-devel

libfontconfig Download: https: //www.freedesktop.org/wiki/Software/fontconfig/

Unzip into the directory libfontconfig

./configure

make&& make install

3. Here is a compiled ffmpeg

ffmpeg Download: https: //ffmpeg.org/download.html#get-sources

Decompression finished entering the ffmpeg directory

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

./configure --enable-shared --enable-gpl --enable-libx264 --enable-libfreetype --enable-libfontconfig --disable-vaapi --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape 

make

It may take some time to compile a long time

Compilation is completed!

Use a command to find these dynamic libraries on OK

find -name "*.so*"

The header files and dynamic library into your project directory to be the next to OK

---------------------------------------------------------------

--enable-gpl with --enable-libx264 with the use, - disable-vaapi --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape connection is prohibited hard Code libraries

 

Guess you like

Origin blog.csdn.net/jacke121/article/details/93487340