0

I’m trying to use GStreamer with NVDEC to extract frames from a video file. I already compiled and installed the NVDEC GStreamer plugin.

With a CPU decoder it works perfectly fine:

gst-launch-1.0 filesrc location=video.mkv ! matroskademux ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=2560,height=1920 ! jpegenc ! multifilesink index=0 location=%d.jpg

However, I want to take advantage of the hardware decoder in the GPU (using NVDEC):

gst-launch-1.0 filesrc location=video.mkv ! matroskademux ! h264parse ! nvdec ! videoconvert ! videoscale ! video/x-raw,width=2560,height=1920 ! jpegenc ! multifilesink index=0 location=%d.jpg

This fails with:

WARNING: erroneous pipeline: could not link videoscale0 to jpegenc0, videoscale0 can't handle caps video/x-raw, width=(int)2560, height=(int)1920

How can this be fixed?

Dávid Molnár
  • 10,673
  • 7
  • 30
  • 55

2 Answers2

0

The issue can be fixed by adding a video convert element before video scale in the pipeline when using NVDEC:

gst-launch-1.0 filesrc location=video.mkv ! matroskademux ! h264parse ! nvdec ! videoconvert ! videoscale ! video/x-raw,width=2560,height=1920 ! jpegenc ! multifilesink index=0 location=%d.jpg
  • Are you sure this works? For me it gives `WARNING: erroneous pipeline: could not link videoscale0 to jpegenc0, videoscale0 can't handle caps video/x-raw, width=(int)2560, height=(int)1920` – Dávid Molnár Jul 29 '23 at 13:09
0

You may try downloading from GL memory into system memory:

gst-launch-1.0 filesrc location=video.mkv ! matroskademux ! h264parse ! nvdec ! gldownload ! videoscale ! video/x-raw,width=2560,height=1920 ! videoconvert ! jpegenc ! multifilesink index=0 location=%d.jpg
SeB
  • 1,159
  • 6
  • 17