[FFmpeg-user] Choppy ffmpeg audio RTP streaming over wifi

Andrew Widgery awidgery at gmail.com
Mon Dec 14 18:21:49 CET 2015


I have a Raspberry Pi, with a USB mic and a WiFi dongle dongle connected.

I'm trying to stream audio only from the Pi, with the intention of
receiving the stream over wifi to a custom iOS mobile app using
VLCKit.

The code executed on the Pi is:

ffmpeg -f alsa -i plughw:1,0 -acodec libmp3lame -ab 128k -ac 1 -ar
44100  -f rtp rtp://234.5.5.5:1234

The output:

ffmpeg version N-77183-g9553689 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Raspbian 4.9.2-10)
  configuration: --enable-libfreetype --enable-gpl --enable-nonfree
--enable-libass --enable-libmp3lame --bindir=/usr/local/bin
  libavutil      55. 10.100 / 55. 10.100
  libavcodec     57. 17.100 / 57. 17.100
  libavformat    57. 19.100 / 57. 19.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 20.100 /  6. 20.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, alsa, from 'plughw:1,0':
  Duration: N/A, start: 1450113372.115946, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Output #0, rtp, to 'rtp://234.5.5.5:1234':
  Metadata:
    encoder         : Lavf57.19.100
    Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, mono, s16p, 128 kb/s
    Metadata:
      encoder         : Lavc57.17.100 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> mp3 (libmp3lame))
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 234.5.5.5
t=0 0
a=tool:libavformat 57.19.100
m=audio 1234 RTP/AVP 14
b=AS:128

Press [q] to stop, [?] for help
size=    4653kB time=00:04:53.96 bitrate= 129.7kbits/s

On the Pi end I have a device playing (Christmas!) music constantly
into the USB mic for testing purposes. The Pi is only connected by
WiFi - not ethernet.

For testing receiving the stream, I'm using VLC (on a Macbook/iPhone).

When the Mac is connected through Ethernet, the stream works fine, as
you can see here:

https://goo.gl/photos/HZgNh7z4HgaqHBaP7

However, when the Mac is connected via WiFi, the stream is choppy, as
you can see here:

https://goo.gl/photos/qjAVH6djqS9Jbvmh6

You can also see a ping trace from the Mac to the Pi, and the VLC
stats. As you can see there doesn't seem to be a correlation between
either of these and the choppiness.

I've tried the VLC iOS app and the choppiness is the same as the Mac on WiFi.

How can I decrease/remove this chop, even if doing so increases latency a bit?


More information about the ffmpeg-user mailing list