How to get the `nvcodec` package in Ubuntu

I’m struggling to work out how I access the elements from nvcodec?

It says the that it’s in gst-plugins-bad and indeed it’s in the monorepo here, and browsing git tags has been since 1.20

I’m running Ubuntu in docker, here’s the docker file I’m testing currently:

FROM ubuntu:24.04

RUN apt-get update && \
    apt-get -y install \
        python3 \
        gstreamer1.0-plugins-base \
        gstreamer1.0-plugins-good \
        libgstreamer1.0-dev \
        libgstreamer-plugins-base1.0-dev \
        gstreamer1.0-plugins-bad \
        gstreamer1.0-tools \

Output of gst-inspect-1.0 --version:

gst-inspect-1.0 version 1.24.2
GStreamer 1.24.2

And yet running gst-inspect-1.0 none of the nvcodec elements are listed? Any help gratefully received!

In a docker w/o NVIDIA hardware:

gst-inspect-1.0 nvcodec
Plugin Details:
  Name                     nvcodec
  Description              GStreamer NVCODEC plugin
  Filename                 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/
  Version                  1.24.2
  License                  LGPL
  Source module            gst-plugins-bad
  Source release date      2024-04-09
  Binary package           GStreamer Bad Plugins (Ubuntu)
  Origin URL     

  Warning: CUDA library "" was not found.

  Warning: NVENC library "" was not found.

  Warning: NVDEC library "" was not found.

  0 features:

Be sure you have all the deps installed and NVIDIA hardware available.

Ah, you’re right, the plugin is actually there! It did not occur to me that the elements would not show up in the full list from gst-inspect-1.0 without the hardware/drivers in place :person_facepalming:

I’m working on my code locally where I don’t have the right hardware, and trying to run on an EC2 instance, where I’ve evidently not yet got the drivers installed correctly, so will dig in more on that. thanks for the pointer!

Ok some progress :slight_smile:

I’m running on an g4dn.xlarge instance in AWS, using the latest Ubuntu 22.04 AMI, and have followed the instructions on the ubuntu site: Install NVIDIA drivers on a GPU-enabled EC2 instance - Ubuntu on AWS documentation . Output of nvidia-smi looks correct

Additionally I’ve installed the Ubuntu packages libnvidia-encode-535-server and libnvidia-decode-535-server.

  • gst-inspect-1.0 nvcodec returns no error, but still no elements, however
  • sudo gst-inspect-1.0 nvcodec does return elements :tada:

I’ve tested this pipeline as root and it runs successfully

gst-launch-1.0 -e  videotestsrc ! video/x-raw,height=720,width=1280 ! nvh264enc max-bitrate=2000 ! h264parse !  mp4mux ! filesink location="foo.mp4"