Extract frames using GStreamer with NVDEC

206 views Asked by At

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?

1

There are 1 answers

0
SeB On

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