Search code examples
networkingstreamudpgstreamervorbis

GStreamer: Stream vorbis-encoded audio over network


I want to write an app that streams audio and video over the network. As a simple start, I wanted to try out the audio part.

I want to stream vorbis-encoded audio from my microphone over the network. I started with the following pipeline for the receiver:

gst-launch-0.10 tcpserversrc host=localhost port=3000 ! oggdemux ! vorbisdec ! audioconvert ! audio/x-raw-int, endianness="(int)1234", signed="(boolean)true", width="(int)16", depth="(int)16", rate="(int)22000", channels="(int)1" ! alsasink

And for the sender:

gst-launch-0.10 autoaudiosrc ! audio/x-raw-int,rate=22000,channels=1,width=16 ! audioconvert ! vorbisenc ! oggmux ! tcpclientsink host=localhost port=3000

This kind of works, but the audio is snatchy.

Can someone give me a hint how I can vorbis-encode and stream audio from my microphone smoothly over the network?

EDIT: I used audiotestsrc and made a recording of the output: http://db.tt/oDuQ2O41


Solution

  • I have tried those commands below (sligthly modified from those in the original post) and could they solved the "snatchy" sound problem for me

    sender:

    gst-launch-0.10 autoaudiosrc ! \
    audio/x-raw-int, endianness="(int)1234", signed="(boolean)true", width="(int)16", depth="(int)16", rate="(int)22000", channels="(int)1" ! \
    audioconvert ! \
    vorbisenc ! \
    oggmux max-delay=50 max-page-delay=50 ! \
    tcpclientsink host=localhost port=3000
    

    receiver:

    gst-launch-0.10 tcpserversrc host=localhost port=3000 ! \
    oggdemux ! \
    vorbisdec ! \
    audioconvert ! \
    audio/x-raw-int, endianness="(int)1234", signed="(boolean)true", width="(int)16", depth="(int)16", rate="(int)22000", channels="(int)1" ! \
    pulsesink