-
-
Save freedomlang/6cac7a75f33bdb1abf0dccf3bd4fa753 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
if [ "`/usr/bin/whoami`" != "root" ]; then | |
echo "You need to execute this script as root." | |
exit 1 | |
fi | |
############################################################################### | |
# ffmpeg installer for centos 7 | |
# based on instructions at https://trac.ffmpeg.org/wiki/CompilationGuide/Centos | |
############################################################################### | |
yum install -y autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel | |
mkdir ~/ffmpeg_sources | |
# NASM | |
cd ~/ffmpeg_sources | |
curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2 | |
tar xjvf nasm-2.14.02.tar.bz2 | |
cd nasm-2.14.02 | |
./autogen.sh | |
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" | |
make | |
make install | |
# Yasm | |
cd ~/ffmpeg_sources | |
curl -O -L https://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 | |
# libx264 | |
cd ~/ffmpeg_sources | |
git clone --depth 1 https://code.videolan.org/videolan/x264.git | |
cd x264 | |
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static | |
make | |
make install | |
# libx265 | |
cd ~/ffmpeg_sources | |
hg clone https://bitbucket.org/multicoreware/x265 | |
cd ~/ffmpeg_sources/x265/build/linux | |
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source | |
make | |
make install | |
# libfdk_aac | |
cd ~/ffmpeg_sources | |
git clone --depth 1 https://github.com/mstorsjo/fdk-aac | |
cd fdk-aac | |
autoreconf -fiv | |
./configure --prefix="$HOME/ffmpeg_build" --disable-shared | |
make | |
make install | |
# libmp3lame | |
cd ~/ffmpeg_sources | |
curl -O -L https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz | |
tar xzvf lame-3.100.tar.gz | |
cd lame-3.100 | |
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm | |
make | |
make install | |
# libopus | |
cd ~/ffmpeg_sources | |
curl -O -L https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz | |
tar xzvf opus-1.3.1.tar.gz | |
cd opus-1.3.1 | |
./configure --prefix="$HOME/ffmpeg_build" --disable-shared | |
make | |
make install | |
# libvpx | |
cd ~/ffmpeg_sources | |
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git | |
cd libvpx | |
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm | |
make | |
make install | |
# ffmpeg itself | |
cd ~/ffmpeg_sources | |
curl -O -L 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" \ | |
--pkg-config-flags="--static" \ | |
--extra-cflags="-I$HOME/ffmpeg_build/include" \ | |
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \ | |
--extra-libs=-lpthread \ | |
--extra-libs=-lm \ | |
--bindir="$HOME/bin" \ | |
--enable-gpl \ | |
--enable-libfdk_aac \ | |
--enable-libfreetype \ | |
--enable-libmp3lame \ | |
--enable-libopus \ | |
--enable-libvpx \ | |
--enable-libx264 \ | |
--enable-libx265 \ | |
--enable-nonfree | |
make | |
make install | |
@alil0rd Apparently, you're missing libx264. Check the installation of libx264 in script.
Thanks for your answer. Line one got me this error:
`
[root@ip154 nasm-2.14.02]# yum install -y autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 33 kB 00:00:00
- base: mirrors.standaloneinstaller.com
- epel: mirror.imt-systems.com
- extras: mirrors.standaloneinstaller.com
- nux-dextop: li.nux.ro
- rpmfusion-free-updates: ftp-stud.hs-esslingen.de
- updates: mirrors.standaloneinstaller.com
base | 3.6 kB 00:00:00
http://mirror.centos.org/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article
https://wiki.centos.org/yum-errors
If above article doesn't help to resolve this issue please use https://bugs.centos.org/.
One of the configured repositories failed (CentOS-6 – Base),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=centos ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable centos
or
subscription-manager repos --disable=centos
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=centos.skip_if_unavailable=true
failure: repodata/repomd.xml from centos: [Errno 256] No more mirrors to try.
http://mirror.centos.org/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
`
@alil0rd Looks like you are running CentOS 6? If it is, this script won't work for it, it is CentOS 7 only(maybe including 8).
This is:
`
[root@ip154 ~]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
`
Hi, first of all thanks for your help. I used these codes to install the ffmpeg; however, I got these errors, here are the last lines of errors:
`
[root@ip154 ffmpeg]# PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
[root@ip154 ffmpeg]# make
Makefile:2: ffbuild/config.mak: No such file or directory
Makefile:40: /tools/Makefile: No such file or directory
Makefile:41: /ffbuild/common.mak: No such file or directory
Makefile:107: /libavutil/Makefile: No such file or directory
Makefile:107: /ffbuild/library.mak: No such file or directory
Makefile:109: /fftools/Makefile: No such file or directory
Makefile:110: /doc/Makefile: No such file or directory
Makefile:111: /doc/examples/Makefile: No such file or directory
Makefile:177: /tests/Makefile: No such file or directory
make: *** No rule to make target
/tests/Makefile'. Stop. [root@ip154 ffmpeg]# make install Makefile:2: ffbuild/config.mak: No such file or directory Makefile:40: /tools/Makefile: No such file or directory Makefile:41: /ffbuild/common.mak: No such file or directory Makefile:107: /libavutil/Makefile: No such file or directory Makefile:107: /ffbuild/library.mak: No such file or directory Makefile:109: /fftools/Makefile: No such file or directory Makefile:110: /doc/Makefile: No such file or directory Makefile:111: /doc/examples/Makefile: No such file or directory Makefile:177: /tests/Makefile: No such file or directory **make: *** No rule to make target
/tests/Makefile'. Stop.**`
Can you please help me?