Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install FFMPEG 2.8.6 support NVENC on Ubuntu 16.04
#!/bin/bash
## Install FFMPEG 2.8.6 Ubuntu 16.04 64Bits
## http://www.linuxpro.com.br/2017/04/compile-ffmpeg-nvenc-ubuntu/
## Pacote Compilado no GITHUB: https://github.com/jniltinho/oficinadotux
## Run as root (sudo su)
## Check Nvidia ENC
## nvidia-smi dmon -i 0
## Test FFMPEG ENCODER NVENC (FFMPEG 2.8.6 NVIDIA-SDK 6.0.1)
## ffmpeg -y -i INPUT -vcodec nvenc_h264 -b:v 10M -acodec copy OUTPUT.mp4
## ffmpeg -y -i INPUT -vcodec nvenc_h264 -pixel_format yuv420p -tier high -2pass 1 -b:v 10M -profile:v high -preset hq -delay 0 -acodec copy OUTPUT.mp4
## Test FFMPEG ENCODER NVENC (FFMPEG 3.1.5 NVIDIA-SDK 6.0.1)
## ffmpeg -y -i INPUT -vcodec h264_nvenc -b:v 10M -acodec copy OUTPUT.mp4
## ffmpeg -y -i INPUT -vcodec h264_nvenc -pixel_format yuv420p -tier high -2pass 1 -b:v 10M -qmin 20 -qmax 52 -profile:v high -preset hq -delay 0 -acodec copy OUTPUT4.mp4
# Check if user has root privileges
if [[ $EUID -ne 0 ]]; then
echo "You must run the script as root or using sudo"
exit 1
fi
cd /root/
cp /etc/apt/sources.list /etc/apt/sources.list_$$.bkp
sed -i -e "/^# deb-src .*xenial universe/ s/^# //" /etc/apt/sources.list
apt-get update
apt-get -y install ffmpeg libfdk-aac-dev checkinstall unzip wget sysstat
apt-get -y install libgtk2.0-0:i386 libpangox-1.0-0:i386 git yasm autoconf libtool
apt-get -y install libpangoxft-1.0-0:i386 libidn11:i386 libglu1-mesa:i386
apt-get -y install build-essential libspeexdsp-dev pkg-config cmake git-core
apt-get -y build-dep ffmpeg
apt-get source ffmpeg
cd /root/
wget -c https://developer.nvidia.com/video-sdk-601 -O nvidia_video_sdk_6.0.1.zip
unzip nvidia_video_sdk_6.0.1.zip
cp nvidia_video_sdk_6.0.1/Samples/common/inc/*.h /usr/local/include/
cd ffmpeg-2.8.6
./configure --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened \
--libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl \
--enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger \
--enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray \
--enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype \
--enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg \
--enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy \
--enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis \
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi \
--enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq \
--enable-frei0r --enable-libx264 --enable-libopencv --enable-nonfree --enable-nvenc \
--enable-libfdk-aac --enable-pic
make -j4
checkinstall --pkgname=FFmpeg --deldoc=yes --deldoc=yes --nodoc --fstrans=no --backup=no \
--install=no --maintainer=linuxpro@linuxpro.com.br -y
cp *_amd64.deb /tmp/
cd /tmp/
ar vx *_amd64.deb
rm -f *_amd64.deb control.tar.gz debian-binary
tar -vxf data.tar.xz
rm -rf usr/share/doc
rm -rf usr/share/man
tar -vcJf ffmpeg-2.8.6_sdk6_Ubuntu1604_64Bits.xz usr
mv ffmpeg-2.8.6_sdk6_Ubuntu1604_64Bits.xz /root/
cp -aR usr/* /usr/
rm -rf /tmp/usr
### Delete Files
rm -f /root/ffmpeg_2.8.6.orig.tar.xz
rm -f /root/ffmpeg_2.8.6-1ubuntu2.debian.tar.xz
rm -f /root/ffmpeg_2.8.6-1ubuntu2.dsc
@strycore

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.