-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_ffmpeg_nvenc.sh
More file actions
executable file
·50 lines (44 loc) · 1.04 KB
/
build_ffmpeg_nvenc.sh
File metadata and controls
executable file
·50 lines (44 loc) · 1.04 KB
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
#!/bin/bash
set -e
# Define directories
export SRC="$HOME/ffmpeg_sources"
export BUILD="$HOME/ffmpeg_build"
export BIN="$HOME/bin"
export PKG_CONFIG_PATH="$BUILD/lib/pkgconfig"
mkdir -p "$SRC" "$BUILD" "$BIN"
# Build x264
cd "$SRC"
rm -rf x264
git clone --depth 1 https://code.videolan.org/videolan/x264.git
cd x264
./configure --prefix="$BUILD" --bindir="$BIN" --enable-static
make -j$(nproc)
make install
# Build FFmpeg with NVENC and x264
cd "$SRC"
rm -rf ffmpeg
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
make distclean
./configure \
--prefix="$BUILD" \
--pkg-config-flags="--static" \
--extra-cflags="-I$BUILD/include" \
--extra-ldflags="-L$BUILD/lib" \
--extra-libs="-lpthread -lm" \
--bindir="$BIN" \
--enable-gpl \
--enable-nonfree \
--enable-libx264 \
--enable-cuda \
--enable-cuvid \
--enable-nvenc \
--enable-libnpp \
--disable-debug \
--enable-static \
--disable-shared
make -j$(nproc)
make install
echo -e "\n✅ FFmpeg built successfully!"
"$BIN/ffmpeg" -hwaccels
"$BIN/ffmpeg" -codecs | grep nvenc