NeuronQ
NeuronQ

Reputation: 8215

Gstreamer pipeline - produce and consume output in separate processes

I want to have two separate gstreamer pipelines, one producing a video output, the other consuming it. The producer is in a Docker container, and the consumer is running on the host. For this I'm trying to get even the most basic thing imaginable working with gst-launch tool, but I just can't get it working no matter what. For example, this fails on the receiving end with ERROR: from element /GstPipeline:pipeline0/GstRtpVRawDepay:rtpvrawdepay0: No RTP format was negotiated.:

# process to produce video stream:
gst-launch-1.0 --gst-debug-level=3 \
  videotestsrc ! videoconvert \
  ! rtpvrawpay ! udpsink host=127.0.0.1 port=5600

# process to consume it (and display it):
gst-launch-1.0 --gst-debug-level=3 \
  udpsrc port=5600 \
  ! rtpvrawdepay ! videoconvert ! autovideosink

...what boggles my ming is that a seeming much more complex setup I do manage to get working:

# produce:
gst-launch-1.0 filesrc location=/path/to/my.mp4 \
  ! decodebin ! videoconvert \
  ! x264enc tune=zerolatency \
  ! rtph264pay \
  ! udpsink host=127.0.0.1 port=5600

# consume:
gst-launch-1.0 -vc udpsrc port=5600 close-socket=false multicast-iface=false auto-multicast=true \
  ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 \
  ! fpsdisplaysink  sync=false async=false --verbose

(Note: special sink type in second example doesn't matter, using autovideosink also works fine.)

Upvotes: 3

Views: 2788

Answers (1)

Florian Zwoch
Florian Zwoch

Reputation: 7393

So it seems you want to do this on the same host. Thats great, so we can forget about the complexity of network protocols and transmission.

GStreamer offers different ways to do this. I would recommend to look at gdp plugin:

Plugin Details:
  Name                     gdp
  Description              Payload/depayload GDP packets
  Filename                 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstgdp.so
  Version                  1.16.0
  License                  LGPL
  Source module            gst-plugins-bad
  Source release date      2019-04-19
  Binary package           GStreamer Bad Plugins (Debian)
  Origin URL               http://packages.qa.debian.org/gst-plugins-bad1.0

  gdpdepay: GDP Depayloader
  gdppay: GDP Payloader

  2 features:
  +-- 2 elements

In combination with the shm plugin:

Plugin Details:
  Name                     shm
  Description              shared memory sink source
  Filename                 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstshm.so
  Version                  1.16.0
  License                  LGPL
  Source module            gst-plugins-bad
  Source release date      2019-04-19
  Binary package           GStreamer Bad Plugins (Debian)
  Origin URL               http://packages.qa.debian.org/gst-plugins-bad1.0

  shmsink: Shared Memory Sink
  shmsrc: Shared Memory Source

  2 features:
  +-- 2 elements

Doing so lets you pass the complete GstBuffer data between processes. That means with all the time stamps, flags, etc.

So basically the producer does something like this:

.. ! gdppay ! shmsink

and the consumer:

shmsrc ! gdpdepay ! ..

Set the properties and socket path accordingly..

I guess a regular file/pipe via filesink/filesrc would work to, but I have not tried..

Upvotes: 3

Related Questions