Moving audio over a local network using GStreamer

I need to move real-time sound between two Linux machines that run as their own software (mine), which is built on top of Gstreamer. (The software already has another connection between the machines, using a separate TCP-based protocol - I will mention this if reliable out-of-band data matters for the solution).

The audio input will be a microphone / line input on the sending machine, and the regular audio output as a receiver at the destination; alsasrc and alsasink are most likely, although for testing I use audiotestsrc instead of a real microphone.

GStreamer offers many ways to move data across networks - RTP, RTSP, GDP payload, UDP and TCP servers, clients and sockets, etc. There are also many examples on the network of streaming audio and video, but none of them seem to work for me in practice; either the destination pipeline cannot coordinate the caps, or I hear one packet, and then the pipeline conveyors, or the destination pipeline is immediately unloaded without any data.

In all cases, I only test on the gst-launch command line. No audio compression is required - raw audio or trivial encoding of WAV, uLaw or aLaw is normal; more importantly, low latency.

+3
source share
3 answers

, :

  • gst-launch audiotestsrc ! alsasink, , .
  • fakesink filesink, ,
  • GST_DEBUG, , GST_DEBUG=GST_CAPS:4 *:2, /
  • wirehark, , .

:

RTP:

gst-launch-0.10 -v udpsrc port=5000 ! "application/x-rtp,media=(string)audio, clock-rate=(int)44100, width=16, height=16, encoding-name=(string)L16, encoding-params=(string)1, channels=(int)1, channel-positions=(int)1, payload=(int)96" ! rtpL16depay ! audioconvert ! alsasink sync=false

gst-launch-0.10 audiotestsrc ! audioconvert ! audio/x-raw-int,channels=1,depth=16,width=16,rate=44100 ! rtpL16pay  ! udpsink host=localhost port=5000

TCP::

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

gst-launch-0.10 audiotestsrc ! tcpclientsink host=localhost port=3000
+4

gst-start, ? , . RTP/RTSP .

: , , 1. host = localhost host = ip- Linux- 2. cap = "application/x-rtp, media = (string) audio udpsrc .

+1

tojoel, ( ) . gstreamer.

TCP:

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

TCP:

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

RTP:

gst-launch-0.10 -v udpsrc port=5000 ! "application/x-rtp,media=(string)audio, clock-rate=(int)22000, width=16, height=16, encoding-name=(string)L16, encoding-params=(string)1, channels=(int)1, channel-positions=(int)1, payload=(int)96" ! rtpL16depay ! audioconvert ! alsasink sync=false

RTP:

gst-launch-0.10 pulsesrc ! audioconvert ! audio/x-raw-int,channels=1,depth=16,width=16,rate=22000 ! rtpL16pay  ! udpsink host=localhost port=5000
0
source

Source: https://habr.com/ru/post/1742858/


All Articles