Search code examples
gstreamerv4l2

how do I build a gstreamer pipeline to send an image file to a V4L2 sink?


I'd like to build a gstreamer pipeline to send an image file to a V4L2 device, and have that device display the image indefinitely.

gst-launch-1.0 -v filesrc location=cat.jpg ! jpegdec ! v4l2sink device=/dev/video1 gives me the following output:

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstJpegDec:jpegdec0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1200, height=(int)1200, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)1:4:0:0, framerate=(fraction)0/1
ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstFileSrc:filesrc0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

I suspect I'm missing something related to [not] turning image data into video data, since replacing v4l2sink with fakesink seems to work.


Solution

  • after some fiddling, it appears as though I was simply missing videoconvert from my pipeline (go figure!):

    gst-launch-1.0 \
      filesrc location=cat.jpg \
      ! jpegdec \
      ! videoconvert \
      ! v4l2sink device=/dev/video1