Search code examples
gstreamerrtmpgst-launch

GStreamer preview RTMP using xvimage


I want to preview RTMP using gstreamer xvimagesink. i can see the output if i use autovideosink like this:

gst-launch-1.0 -v rtmpsrc location='rtmp://127.0.0.1:1935/live/stream' ! decodebin3 ! autovideosink

but if i replace "autovideosink" with "xvimagesink" i get this:

Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0: Could not initialise Xv output
Additional debug info:
xvimagesink.c(1773): gst_xv_image_sink_open (): /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
Could not open display (null)
Setting pipeline to NULL ...
Freeing pipeline ...

Solution

  • Both decodebin3 and autovideosink are auto-plugging GStreamer elements. It means that both elements are auto-selecting available and the most appropriate GStreamer plugins to demux/decode (decodebin3) and render video (autovideosink) from, in this case, live RTMP stream.

    So it is very possible that, for example,

    • decodebin3 decodes video in format that xvimagesink cannot show on your platform/hardware and/or with your Gstreamer version,
    • xvimagesink is not set properly on your platform and it is not related with available display/monitor.

    To find out more details about

    • video format decoded by decodebin3
    • video sink element "chosen" by autovideosink,

    you can set higher (more detailed) debug level of GStreamer with, for example, export GST_DEBUG=3, rerun pipeline and inspect output.