Switching Audio/Video Sources to shout2send

Tim Müller tim at centricular.com
Tue Sep 20 11:39:52 UTC 2016


On Wed, 2016-09-14 at 15:39 -0700, Sari McFarland wrote:

Hi Sari,

> I'm working on some code that generates a live stream of audio and
> video and sends it to an icecast server with shout2send.  Not all of
> the media is coming from a playbin/decodebin, so I'm not able to use
> the about-to-finish callback to switch to another media file without
> stopping the pipeline.  Sometimes I'm inserting silence or the test
> signal, or audio from a network source.  In order to switch between
> sources or media files, I'm currently setting the pipeline to null,
> relinking it and setting it to play again.  This causes shout2send to
> disconnect and reconnect to the icecast server which disconnects the
> icecast listeners.  To get around this for audio only, I've been
> sending the audio to pulse, and with a second pipeline I'm getting
> audio from pulse and sending to shout2send.
> 
> Now I need to make this work for video as well.  Is there a
> workaround for video similar to using pulse for audio?  Or is there a
> way to modify the pipeline without disconnecting from shout2send?  

If you're always encoding + muxing the audio/video before feeding it to
shout2send, then the intervideosink/src and interaudiosink/src elements
might be useful in this case.

You could basically have two separate pipelines, one encoder pipeline
that always keeps running like this:


  interaudiosrc ! audioconvert ! audioresample ! vorbisenc ! queue !
mux.

  intervideosrc ! videoconvert ! videorate ! theoraenc ! queue ! mux.

  oggmux name=mux ! shout2send


Then a second pipeline that feeds into the inter elements like for
example

  playbin video-sink=intervideosink  audio-sink=interaudiosink

If you shut down the second pipeline (playbin) that feeds into the
encoder, the encoder will start running, and the elements will keep
repeating the last frame (or after a while black) in the video case,
and generate silence in the audio case. So if you're quick enough to
start up a new playbin pipeline with a different file it might appear
almost gapless, and in any case the encoder keeps running without
disconnecting, also in case there are decoding errors or such.

This is a fairly limited setup of course, but it might just work for
you.

There's also a little playout streaming demo application here

  https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/tests/exa
mples/playout.c

which is a bit more sophisticated, but doesn't have quite the same
simplicity as the above :)

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

Join us at the GStreamer Conference!
10-11 October 2016 in Berlin,
Germany
http://gstreamer.freedesktop.org/conference/



More information about the gstreamer-devel mailing list