-
Notifications
You must be signed in to change notification settings - Fork 3
/
ffmpeg build instructions
286 lines (195 loc) · 8.95 KB
/
ffmpeg build instructions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
***WELCOME ALL***
#Today we will build a COMPLETE and COMPLETELY-WORKING, UP TO DATE, FFmpeg with NVencoding + Cuda + OpenGL + OpenCL + libnpp + everything else you could possibly want.
#WORKING + UP TO DATE build guide from source, I will also be building the current up to date OBS for Ubuntu, Mint, Debian for use with NVenc also.
***First before we start anything we will need three things installed, built and placed into specific paths:***
1: Nvidia driver: :http://us.download.nvidia.com/XFree86/Linux-x86_64/375.39/NVIDIA-Linux-x86_64-375.39.run
2: Cuda 7.5: (Officially supports NVenc and Cuda) http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run
3: Video_Codec_SDK: https://developer.nvidia.com/designworks/video_codec_sdk/downloads/v7.1
#***Now comes the fun! First we need to install Nvidia diver:
#Press Ctrl+Alt+F1 at log-in screen (type in user-name and password into command line
*No Apple Keyboards* #You may be able to change that in the keyboard settings, but it might be a little harder without GUI
#Still cant drop to a shell without Xserver? Press "e" at grub menu to edit the boot options.
#adding "nomodeset" to your grub boot options right after "quiet splash" near the bottom line will help you press f10 to finish booting
#Now log in with your username and password to the CLI and now we can start issuing the commands
sudo nano /etc/modprobe.d/blacklist.conf
#Add the following lines to the bottom of the file
blacklist amd76x_edac
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
#Hold Control + o then hit Enter to save
#Hold Control + x then hit Enter to exit
sudo apt-get remove --purge nvidia*
sudo service lightdm stop
#for Mint its "sudo service mdm stop" Somtimes you will need to kill lightdm other ways just google it,
bottom line xsever cannot be running while installing this driver)
cd ~/Downloads
wget us.download.nvidia.com/XFree86/Linux-x86_64/375.39/NVIDIA-Linux-x86_64-375.39.run
sudo chmod +x NVIDIA-Linux-x86_64-375.39.run
sudo ./NVIDIA-Linux-x86_64-375.39.run
sudo nvidia-xconfig
sudo update-initramfs -u
sudo reboot
#When computer reboots we cant start inatalling the Video_Codec_SDK
#*** Installing Video_Codec_SDK ***
$: cd Downloads
/Downloads$: firefox https://developer.nvidia.com/designworks/video_codec_sdk/downloads/v7.1
#Just accept the EULA and Download, after the download finishes be sure to place SDK inside your Download folder IMPORTANT!!!!
$: cd Downloads
/Downloads$: unzip Video_Codec_SDK_7.1.9
/Downloads$: cd ~/Video_Codec_SDK_7.1.9/Samples
$: make
$: sudo cp ~/Downloads/Video_Codec_SDK_7.1.9/Samples/common/inc/*.h /usr/local/include
$: sudo cp ~/Downloads/Video_Codec_SDK_7.1.9/Samples/common/inc/GL/*.h /usr/local/include
#***Now we install Cuda 7.5 and move those files to the proper paths***
sudo service lightdm stop
#for Mint the command is:
sudo service mdm stop
#SOMETIMES YOU NEED TO FIND OTHER METHODS TO KILL XSERVER
cd ~/Downloads
wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run
sudo chmod +x cuda_7.5.18_linux.run
sudo ./cuda_7.5.18_linux.run --override
#Just say yes to the unsupported configuartion the compiler changed but worked fine anyway with the --override flag
#Say NO to installing the driver! but yes to the SDK and the Paths for install locations are fine at default
#Once the install is finished we need to copy our cuda file to the proper path.
sudo cp ~/usr/local/cuda/include /cuda.h /usr/local/include
#Done for now... You are set up and ready to build FFmpeg with a shit load of extra options including NVencoding AKA ShadowPlay!
***Compile FFmpeg on Ubuntu, Debian, or Mint***
This guide for supported releases of Ubuntu, Debian, and Linux Mint will provide a local install of the latest FFmpeg tools and libraries including several external encoding and decoding libraries (codecs). This will not interfere with repository packages.
$: sudo apt-get update
$: sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev
$: sudo apt-get -y install libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev
$: sudo apt-get -y install libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev
Now make a directory.
$: mkdir ~/ffmpeg_sources
$: cd ~/ffmpeg_sources
$: 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
libx264:
$: cd ~/ffmpeg_sources
$: wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
$: tar xjvf last_x264.tar.bz2
$: cd x264-snapshot*
$: PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --disable-opencl
$: PATH="$HOME/bin:$PATH" make
$: make install
libx265:
$: sudo apt-get install cmake mercurial
$: cd ~/ffmpeg_sources
$: hg clone https://bitbucket.org/multicoreware/x265
$: cd ~/ffmpeg_sources/x265/build/linux
$: PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
$: make
$: make install
libfdk-aac:
$: cd ~/ffmpeg_sources
$: wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master
$: tar xzvf fdk-aac.tar.gz
$: cd mstorsjo-fdk-aac*
$: autoreconf -fiv
$: ./configure --prefix="$HOME/ffmpeg_build" --disable-shared
$: make
$: make install
libmp3lame:
$: sudo apt-get install nasm
$: cd ~/ffmpeg_sources
$: wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
$: tar xzvf lame-3.99.5.tar.gz
$: cd lame-3.99.5
$: ./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared
$: make
$: make install
libopus:
$: cd ~/ffmpeg_sources
$: wget http://downloads.xiph.org/releases/opus/opus-1.1.4.tar.gz
$: tar xzvf opus-1.1.4.tar.gz
$: cd opus-1.1.4
$: ./configure --prefix="$HOME/ffmpeg_build" --disable-shared
$: make
$: make install
libvpx:
$: cd ~/ffmpeg_sources
$: wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.6.1.tar.bz2
$: tar xjvf libvpx-1.6.1.tar.bz2
$: cd libvpx-1.6.1
$: PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests
$: PATH="$HOME/bin:$PATH" make
$: make install
***BUILDING FFMPEG FRMOM SOURCE WITH PRPER OPTIONS!***
STARTFRESH: rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,vsyasm,x264,x265,yasm,ytasm}
$: cd ~/ffmpeg_sources
$: wget http://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-cflags="-I/usr/local/cuda/include/" \
--extra-ldflags="-L/usr/local/cuda/lib64/" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-nonfree \
--enable-cuda \
--enable-nvenc \
--enable-opengl \
--enable-libnpp \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265
PATH="$HOME/bin:$PATH" make
make install
hash -r
To install in host
$: PATH=./configure \
--extra-cflags="-I/usr/local/cuda/include/" \
--extra-ldflags="-L/usr/local/cuda/lib64/" \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-shared \
--enable-nonfree \
--enable-cuda \
--enable-nvenc \
--enable-opengl \
--enable-libnpp \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265
--cc="gcc -m64 -fPIC"
***COMMAND TO UNINSTALL AND START FRESH!
rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,vsyasm,x264,x265,yasm,ytasm}
NOW GO BUILD OBS!!! YOU ARE ALMOST DONE!!!
(optional) FIRST REMOVE OBS-STUDIO incase you have tried this already and messed it up before.
sudo dpkg -r obs-studio
OK ready to build now!
git clone https://github.com/jp9000/obs-studio.git
cd obs-studio
mkdir build && cd build
cmake -DUNIX_STRUCTURE=1 -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
sudo checkinstall --pkgname=obs-studio --fstrans=no --backup=no \
--pkgversion="$(date +%Y%m%d)-git" --deldoc=yes
THATS IT! YOU NOW CAN ENCODE USING NVENC ON YOUR GPU ON UBUNTU, MINT and DEBIAN.
gcc cmdline.h cmdline.c recording_home_stable_15_03.c -o recording_stable_15_03 -ljansson -lavfilter -lswresample -lswscale -lavdevice $(pkg-config --cflags --libs libavformat libavcodec) -lpostproc -lpthread `pkg-config --cflags --libs glib-2.0` `pkg-config --cflags --libs opus` `pkg-config --cflags --libs ogg` -levent -lrabbitmq -Wall -g