Prepending data to a stream

Sebastian Dröge sebastian at
Thu Jun 26 00:47:33 PDT 2014

On So, 2014-06-08 at 11:12 +0200, Peter Maersk-Moller wrote:
> Is there a method/mechanism by which one can prepend data to the beginning
> of a data stream? Currently I use a shell script with unnamed pipes, but
> that has limitations and can affect packet boundaries. Here is one example:
> (
>   gst-launch -v audiotestsrc is-live=true !\
>     queue !\
>     fdsink fd=3 3>&1 1>&2
> ) | nc $host $port
> Usually the above example works nicely, but in some cases, where the audio
> source may include decoding audio and assuming format=S16LE and channels=2,
> there is no guarantee that nc receives in ONE chunck a number of audio
> bytes dividable by 4 due to the unnamed pipe feeding nc.
> It would be nicer and predictable/controllable if one could do something
> like this:
>   gst-launch -v audiotestsrc is-live=true !\
>     queue !\
>     tcpclientsink prepend-data=SOMETHING_TO_PREPEND host=$host port=$port
> In fact it could be useful if all (probably non videosinks) datasinks could
> be prepended and appended (when closing) data.
> Is there currently a way to prepend data for a stream?

For this kind of stuff you should really write some code, then you can
properly and reliably prepend data to your streams or do whatever else
you want with the data :)

The fiddling around with gst-launch and stdin/stdout is never going to
work reliably.

Sebastian Dröge, Centricular Ltd -
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the gstreamer-devel mailing list