This question probably doesn't belong here but I am posting anyway as I am getting nowhere with this issue. I am using Tesla T4 and believe me it want' easy to compile but I was successfully able to compile ffmpeg on CentOS 7 with nvenc and everything works great with file encoding/decoding Here's the command I am using to re-encode a file
ffmpeg -probesize 4M -threads 4 -analyzeduration 30000 -hwaccel cuvid -c:v h264_cuvid -i test.ts -vcodec h264_nvenc -profile:v main -rc:v cbr_hq -preset llhq -bufsize 9000k -b:v 6000k -minrate 5900k -maxrate 6000k -rc-lookahead:v 32 -bf:v 3 -coder:v -1 -f mpegts test1.ts
BUT when I want to re-encode a live stream I get segmentation fault error. All you have to do it replace the -i test.ts to udp://: and the encoding process crashes. I came upon this page but still have no idea how to fix it
opencv/opencv#10201
Here's my script
#!/bin/sh -e
Globals
NASM_VERSION="2.14rc15"
YASM_VERSION="1.3.0"
CUDA_VERSION="10.1.168-1"
CUDA_DIR="/usr/local/cuda"
WORK_DIR="$HOME/ffmpeg-build-sources"
DEST_DIR="$HOME/ffmpeg-build-binaries"
mkdir -p "$WORK_DIR" "$DEST_DIR" "$DEST_DIR/bin"
export PATH="$DEST_DIR/bin:$PATH"
Routines
Wget() { wget -cN "$@"; }
installYumLibs() {
sudo yum -y install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel
libass-devel tibtheora-devel libvorbis-devel libva-devel
wget unzip cmake mercurial patch
}
installCUDASDKyum() {
yum install -y epel-release
rpm -q cuda-repo-rhel7 2>/dev/null ||
yum install -y "https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-repo-rhel7-${CUDA_VERSION}.x86_64.rpm"
yum install -y cuda
}
installCUDASDK() {
echo "Installing CUDA and the latest driver repositories from repositories"
cd "$WORK_DIR/"
. /etc/os-release
case "$ID-$VERSION_ID" in
centos-7 ) installCUDASDKyum ;;
* ) echo "ERROR: only CentOS 7 is supported."; exit 1;;
esac
}
installNvidiaSDK() {
echo "Installing the nVidia NVENC SDK."
cd "$WORK_DIR/"
test -d nv-codec-headers || git clone -b n9.0.18.2 https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
cd nv-codec-headers
git pull
make
make install PREFIX="$DEST_DIR"
}
compileNasm() {
echo "Compiling nasm"
cd "$WORK_DIR/"
Wget "http://www.nasm.us/pub/nasm/releasebuilds/$NASM_VERSION/nasm-$NASM_VERSION.tar.gz"
tar xzvf "nasm-$NASM_VERSION.tar.gz"
cd "nasm-$NASM_VERSION"
./configure --prefix="$DEST_DIR" --bindir="$DEST_DIR/bin"
make -j$(nproc)
make install distclean
}
compileYasm() {
echo "Compiling yasm"
cd "$WORK_DIR/"
Wget "http://www.tortall.net/projects/yasm/releases/yasm-$YASM_VERSION.tar.gz"
tar xzvf "yasm-$YASM_VERSION.tar.gz"
cd "yasm-$YASM_VERSION/"
./configure --prefix="$DEST_DIR" --bindir="$DEST_DIR/bin"
make -j$(nproc)
make install distclean
}
compileFFmpeg(){
echo "Compiling ffmpeg"
cd "$WORK_DIR/"
test -d FFmpeg || git clone https://github.com/FFmpeg/FFmpeg -b master
cd FFmpeg
git pull
export PATH="$CUDA_DIR/bin:$PATH" # ..path to nvcc
PKG_CONFIG_PATH="$DEST_DIR/lib/pkgconfig" \
./configure \
--pkg-config-flags="--static" \
--prefix="$DEST_DIR" \
--bindir="$DEST_DIR/bin" \
--extra-cflags="-I $DEST_DIR/include -I $CUDA_DIR/include/" \
--extra-ldflags="-L $DEST_DIR/lib -L $CUDA_DIR/lib64/" \
--extra-libs="-lpthread" \
--enable-nonfree \
--enable-cuda-nvcc \
--enable-cuvid \
--enable-libnpp \
--enable-nvenc
make -j$(nproc)
make install distclean
hash -r
}
installYumLibs
installCUDASDK
installNvidiaSDK
compileNasm
compileYasm
compileFFmpeg
echo "Complete!"
Here's my nvidia-smi output