libav - stream audio via UDP results in overread or underrun

0

I am streaming small audio files from one raspberry-pi to several other raspberry-pi's. The wireless connection is good, the throughput is good, the ping/latency is good.

The receivers look like this:

avplay -probesize 32 -f mp3 -vn -i udp://239.255.0.1:8001

When I send the audio stream (using -re) like this:

avconv -re -i 1.wav -f mp3 -b:a 128K -vn udp://239.255.0.1:81?localaddr=192.168.0.1

The result on the receiver is choppy audio with lots of this:

ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred0B f=0/0   
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred0B f=0/0   
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred0B f=0/0   
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred0B f=0/0   
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred0B f=0/0 

When I send the audio stream (without using -re) like this:

avconv -i 1.wav -f mp3 -b:a 128K -vn udp://239.255.0.1:81?localaddr=192.168.0.1

The result on the receiver is skippy audio with lots of this:

[mp3 @ 0x72501740] overread, skip -10 enddists: -7 -7  0B f=0/0   
[mp3 @ 0x72501740] overread, skip -7 enddists: -5 -5
[mp3 @ 0x72501740] overread, skip -9 enddists: -6 -6   0B f=0/0   
[mp3 @ 0x72501740] overread, skip -5 enddists: -1 -1   0B f=0/0   
[mp3 @ 0x72501740] overread, skip -7 enddists: -2 -2

If I increase the probesize on the receiver, the first sound I play is good and subsequent sounds are bad because probesize only applies initially.

The actual question: How can I get avplay to continuously buffer the input properly so that underruns and overreads/skips do not occur?

user3091850

Posted 2016-06-21T21:20:51.577

Reputation: 1

I seem to be having better luck by adding ?buffer_size=400000 to the avplay command line. – user3091850 – 2016-06-21T22:50:44.500

Answers

0

I am now using:

avplay -probesize 32 -f mp3 -vn -i udp://239.255.0.1:8001?buffer_size=400000

This seems to help and I believe any further skips are due to wireless interference and the fact that I am using UDP.

user3091850

Posted 2016-06-21T21:20:51.577

Reputation: 1