How to use and install the nvenc in gstreamer on ubuntu 18.04 (x86_64) to decode a h264 stream.

I have installed ubuntu 18.04, the nvidea drivers and all the gstreamer packages. Now i’m looking for: How to install and use the nvdec gstreamer plugin to decode a h264 stream.

Install the driver

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ubuntu-drivers-common
sudo ubuntu-drivers autoinstall
sudo apt-get install ubuntu-restricted-extras

Install gstreamer

sudo add-apt-repository universe
sudo add-apt-repository multiverse
sudo apt-get update
sudo apt-get install gstreamer1.0-tools gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-bad1.0-dev

Getting nvidia hw encode/decode working with gstreamer is hard to hopeless.
gst-plugins-vaapi has a whitelist of va drivers it will work with, the libva-vdpau driver is not among it since it is unmaintained. You can force gstreamer to use it setting an env variable:

GST_VAAPI_ALL_DRIVERS=1 gst-inspect-1.0 vaapi

The nvenc/nvdec plugins are not included in any binary distribution since it needs cuda which is (afaik) not freely distributable so would lead to dependency problems. You would have to compile them yourself.
Most people simply use a player which includes vdpau/nvdec/nvenc support like vlc/ffmpeg/mpv.