[libav-tools] Audio streaming over WiFi network (UDP)

Robert Jaroszuk zim at iq.pl
Mon Dec 28 16:39:09 CET 2015


Hi,

I need some help with using avconv/avplay for simple audio streaming 
over wireless network.

I have an Arietta G25 with ARM9 at 400Mhz CPU with linux and I would like 
to use this device for streaming audio over wifi network.
On this embedded linux I use avconv to encode the audio into mpeg stream 
and send it over rtp to multicast address:

# /usr/bin/avconv -f oss -i /dev/dsp -ar 22050 -ab 64k -ac 1 
-filter_complex 'volume=50' -f mpeg rtp://224.0.0.1:1234/
avconv version 11.4-6:11.4-1~deb8u1, Copyright (c) 2000-2014 the Libav 
developers
   built on Jun  4 2015 20:16:59 with gcc 4.9.2 (Debian 4.9.2-10)
[oss @ 0x11d1e0] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, oss, from '/dev/dsp':
   Duration: N/A, start: 1167613970.360718, bitrate: N/A
     Stream #0.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Output #0, mpeg, to 'rtp://224.0.0.1:1234/':
   Metadata:
     encoder         : Lavf56.1.0
     Stream #0.0: Audio: mp2, 22050 Hz, mono, s16, 64 kb/s
     Metadata:
       encoder         : Lavc56.1.0 mp2
Stream mapping:
   Stream #0:0 (pcm_s16le) -> volume
   volume -> Stream #0:0 (mp2)
Press ctrl-c to stop encoding
Non-monotonous DTS in output stream 0:0; previous: 1225224, current: 
1224159; changing to 1225225. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 2886678, current: 
2886580; changing to 2886679. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 2886820, current: 
2886302; changing to 2886821. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 4550980, current: 
4550020; changing to 4550981. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 5541698, current: 
5540641; changing to 5541699. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 5541699, current: 
5541588; changing to 5541700. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 6023020, current: 
6020335; changing to 6023021. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 6023021, current: 
6022424; changing to 6023022. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 6506967, current: 
6506029; changing to 6506968. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 6984910, current: 
6984229; changing to 6984911. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 6984911, current: 
6984253; changing to 6984912. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 6984912, current: 
6983143; changing to 6984913. This may result in incorrect timestamps in 
the output file.
Non-monotonous DTS in output stream 0:0; previous: 6984913, current: 
6984543; changing to 6984914. This may result in incorrect timestamps in 
the output file.
size=     656kB time=83.02 bitrate=  64.7kbits/s

On the laptop I use avplay to listen:

zim at laptop ~ $ avplay -f mpeg -i rtp://224.0.0.1:1234
avplay version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2003-2014 the 
Libav developers
   built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
[mpeg @ 0x7efef8005be0] max_analyze_duration reached
[mpeg @ 0x7efef8005be0] Estimating duration from bitrate, this may be 
inaccurate
Input #0, mpeg, from 'rtp://224.0.0.1:1234':
   Duration: N/A, start: 1.000000, bitrate: 64 kb/s
     Stream #0.0[0x1c0]: Audio: mp2, 22050 Hz, 2 channels, s16p, 64 kb/s
[mp2 @ 0x7efef8004b40] Header missingvq=    0KB sq=    0B f=0/0
  103.42 A-V:  0.000 s:0.0 aq=    0KB vq=    0KB sq=    0B f=0/0

Unfortunately, after ~10-20 seconds audio queue (aq) comes to zero kB 
and audio starts to interrupt constantly.
I think it's because the embedded system is overloaded, but as far as I 
can see, the avconv is using 100% cpu and the load is higher than 1.
I tried to use ac3 codec, but it didn't help.
Also changing the bitrate or audio sampling rate didn't help. avconv 
still eats almost 100% cpu power, no matter how I use it.
Do you have any idea what could be changed?

This device I am using is not so powerful, but it should easily handle 
this kind of tasks.

Thank you.
R.






More information about the libav-tools mailing list