gstreamer pipeline to stream raw audio over network

Normally all audio pipelines use an audio codec and RTP encapsulation. I searched a lot for a raw audio pipeline, but I could not find much information. Then, I tried different options and came up with the following.

gst-launch-1.0 -v filesrc location=/tmp/musicfile.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! audio/x-raw, rate=16000, channels=1, format=S16LE ! audiomixer blocksize=320 ! udpsink host=192.168.1.10 port=10000

This above pipeline takes audio from an MP3 file, decodes it, changes the format to 16 KHz mono, and then sends it to the network using UDP. Audio mixer is used just to send the frame size of 10 msec amounting to 320 bytes of data.

gst-launch-1.0 -v udpsrc port=10000 ! rawaudioparse use-sink-caps=false format=pcm pcm-format=s16le sample-rate=16000 num-channels=1 ! queue ! audioconvert ! audioresample ! autoaudiosink

To play the same from network the above pipeline could be used.

Advertisement

Published by Anand Sivaram (आनन्दः )

twitter.com/anand_sivaram https://www.linkedin.com/in/anandsivaram/

One thought on “gstreamer pipeline to stream raw audio over network

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: