Skip to content

Instantly share code, notes, and snippets.

@corenel
Last active September 14, 2023 03:46
  • Star 18 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Install NVDEC and NVENC as GStreamer plugins

Install NVDEC and NVENC as GStreamer plugins

Environment

  • Ubuntu 18.04
  • NVIDIA driver 460.32.03
  • NVIDIA Video Codec SDK 11.0.10
  • GStreamer 1.14.5

Steps

  1. Clone the gst-plugins-bad and check out to the same version as GStreamer installed on your PC
git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-bad
cd gst-plugins-bad/
git checkout 1.14.5
  1. Download NVIDIA Video Codec SDK and copy header files
cd /path/to/video/codec/sdk
cp /usr/local/cuda/include/cuda.h /path/to/gst-plugins-bad/sys/nvenc
cp Interface/nvEncodeAPI.h /path/to/gst-plugins-bad/sys/nvenc
cp Interface/cuviddec.h /path/to/gst-plugins-bad/sys/nvdec
cp Interface/nvcuvid.h /path/to/gst-plugins-bad/sys/nvdec
  1. Build plugins
cd /path/to/gst-plugins-bad
NVENCODE_CFLAGS="-I/path/to/gst-plugins-bad/sys/nvenc" ./autogen.sh --with-cuda-prefix="/usr/local/cuda" --disable-gtk-doc
cd sys/nvenc
make
sudo cp .libs/libgstnvenc.so /usr/lib/x86_64-linux-gnu/gstreamer-1.0/
cd ../nvdec
make
sudo cp .libs/libgstnvdec.so /usr/lib/x86_64-linux-gnu/gstreamer-1.0/
  1. Check installation
gst-inspect-1.0 | grep nvenc
gst-inspect-1.0 | grep nvdec

References

@neilyoung
Copy link

Do you have a receipt for meson builds? 1.22 for instance is not having that ./autogen/make anymore

@Danila24
Copy link

Do you have a receipt for meson builds? 1.22 for instance is not having that ./autogen/make anymore

The same question.

@neilyoung
Copy link

Do you have a receipt for meson builds? 1.22 for instance is not having that ./autogen/make anymore

The same question.

Before I abandoned all attempts I found, that it is possible to change into subprojects/gst-plugins-bad and build from there

(I tried to compile on Jetson Nano, couldn't make it to have nvh264enc on Ubuntu 20.04, CUDA 12 and GST 1.22, I suppose this is not going to work at all since it would require a GST fork, which is made for the Jetson GPU)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment