'A general gstreamer pipeline use xvimagesink to pull rtmp stream with/without audio

Assuming that there are 2 kinds of streams, one is only video stream (without audio), the other is video with audio. We know that playbin with a uri can play them all even if we dont know what kind of stream we get, but is there any pipelines that use xvimagesink or nv3dsink (not autovideosink etc.) that can receive both (with or without audio) cause we dont know whether the video stream is with audio or not?

For instance, if the video stream is with audio, we play video with audio, else we play video without audio.

I've tried

gst-launch-1.0 rtmpsrc location="$RTMP_SRC" ! \
    flvdemux name=demux \
    demux.audio ! queue ! decodebin ! autoaudiosink \
    demux.video ! queue ! decodebin ! autovideosink

but if the video is without audio, only one frame would be shown on the screen.

https://github.com/matthew1000/gstreamer-cheat-sheet/blob/master/rtmp.md This article helps me a lot, but i'm still looking for a excellent general pipeline that works like "playbin" but use xvimagesink or nv3dsink for playing video.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source