Realtime audio over UDP - Low quality

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Realtime audio over UDP - Low quality

David Ventura
Hi. I'm trying to get audio (voice only) over udp on local network.

First: Listening to the mic directly through alsa gives me great quality; there's no overdrive when shouting/talking WAY too close to the mic.

Now, when using the following pipeline the audio is .. ok. The quality is not 'good'. It's good enough, but there's a clear quality drop from directly listening to the mic. There's overdrive when there's shouting, etc.


Producer:

gst-launch-1.0  alsasrc slave-method=resample do-timestamp=true ! audioconvert ! audioresample ! mulawenc ! rtppcmupay ! multiudpsink clients=192.168.2.120:5001

Consumer:


gst-launch-1.0 -q udpsrc port=5001 caps="application/x-rtp" do-timestamp=true ! rtppcmudepay ! mulawdec 
! audioconvert ! audioresample ! audio/x-raw,format=S16LE,layout=interleaved, rate=44100, channels=2 ! fdsink fd=1 sync=true 

What's happening? Is this the recommended way to do audio over udp?
I have gstreamer 1.4.4 on the producer and 1.9.90 on the consumer.

--
Stack is the new term for "I have no idea what I'm actually using".

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Realtime audio over UDP - Low quality

Tim Müller
On Fri, 2016-11-04 at 14:28 -0300, David Ventura wrote:

Hi,

gst-launch-1.0 -q udpsrc port=5001 caps="application/x-rtp" do-timestamp=true ! rtppcmudepay ! mulawdec 
! audioconvert ! audioresample ! audio/x-raw,format=S16LE,layout=interleaved, rate=44100, channels=2 ! fdsink fd=1 sync=true 

fdsink? I think you also want an rtpjitterbuffer after udpsrc (set latency property, default latency is quite high), and then perhaps try 

.. ! audiorate ! wavenc ! filesink location=foo.wav

for starters.

What's happening? Is this the recommended way to do audio over udp?
I have gstreamer 1.4.4 on the producer and 1.9.90 on the consumer.


has some examples for various things.

Cheers
-Tim

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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Realtime audio over UDP - Low quality

David Ventura
Hi Tim,

I'm using fdsink because I'm feeding the output to another program.

Using rtpjitterbuffer seems to have helped a lot.

Testing server-alsasrc-PCMA.sh and client-PCMA.sh seems to reduce 'noise' a lot (currently using alsasrc with the input OFF and I hear a little crackling.. a lot less than using my current method). The problem is the receiver doesn't survive a producer restart, in our setup the producer starts/stops at any time

Is this solvable?


Also, what's with the crackling? Running

>gst-launch-1.0 alsasrc ! audiorate ! wavenc ! filesink location=foo.wav

I hear a little hissing in the background, but that's it, no crackling at all.

David

On 4 November 2016 at 15:04, Tim Müller <[hidden email]> wrote:

>
> On Fri, 2016-11-04 at 14:28 -0300, David Ventura wrote:
>
> Hi,
>
> gst-launch-1.0 -q udpsrc port=5001 caps="application/x-rtp" do-timestamp=true ! rtppcmudepay ! mulawdec
> ! audioconvert ! audioresample ! audio/x-raw,format=S16LE,layout=interleaved, rate=44100, channels=2 ! fdsink fd=1 sync=true
>
>
> fdsink? I think you also want an rtpjitterbuffer after udpsrc (set latency property, default latency is quite high), and then perhaps try
>
> .. ! audiorate ! wavenc ! filesink location=foo.wav
>
> for starters.
>
> What's happening? Is this the recommended way to do audio over udp?
> I have gstreamer 1.4.4 on the producer and 1.9.90 on the consumer.
>
>
> https://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/rtp
>
> has some examples for various things.
>
> Cheers
> -Tim
>
> --
> Tim Müller, Centricular Ltd - http://www.centricular.com
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>



--
Stack is the new term for "I have no idea what I'm actually using".

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Realtime audio over UDP - Low quality

Nicolas Dufresne-5
In reply to this post by David Ventura

Le 4 nov. 2016 1:42 PM, "David Ventura" <[hidden email]> a écrit :
>
> Hi. I'm trying to get audio (voice only) over udp on local network.
>
> First: Listening to the mic directly through alsa gives me great quality; there's no overdrive when shouting/talking WAY too close to the mic.
>
> Now, when using the following pipeline the audio is .. ok. The quality is not 'good'. It's good enough, but there's a clear quality drop from directly listening to the mic. There's overdrive when there's shouting, etc.

That is likely the side effect of using mu-law compression. It should sound like weird phone at best.

Maybe your use case allow using raw pcm (l16pay) or opus codec if compression matter (you can even turn on music mode on opus, it gives great results).

>
>
> Producer:
>
> gst-launch-1.0  alsasrc slave-method=resample do-timestamp=true ! audioconvert ! audioresample ! mulawenc ! rtppcmupay ! multiudpsink clients=192.168.2.120:5001
>
> Consumer:
>
>
> gst-launch-1.0 -q udpsrc port=5001 caps="application/x-rtp" do-timestamp=true ! rtppcmudepay ! mulawdec 
> ! audioconvert ! audioresample ! audio/x-raw,format=S16LE,layout=interleaved, rate=44100, channels=2 ! fdsink fd=1 sync=true 
>
> What's happening? Is this the recommended way to do audio over udp?
> I have gstreamer 1.4.4 on the producer and 1.9.90 on the consumer.
>
> --
> Stack is the new term for "I have no idea what I'm actually using".
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel