[FFmpeg-user] Raspberry Pi Audio Stream Stopping

Jon Krake 1024jon at gmail.com
Tue Feb 24 17:41:50 CET 2015


So I am using a raspberry pi to encode audio from USB sound card's Line In
and broadcasting to a multicast address as an MP3. I ran tests on a laptop
before I migrated it to a pi, and it seemed to run without issue. Now when
I run it on the pi, it will run for about 4 or 5 hours, then the ffmpeg
encoder(I think) will stop.  When I check on the program after a few hours,
I find that sox is still recording, but ffmpeg has stopped encoding.  I
have tried this with both arecord and sox, and with both the raspbian repo
avconv and the real ffmpeg compiled from source. I am figuring that it has
something to do with the limited resources on the pi, but I'm not sure.
Any thoughts would be appreciated.  Thanks in advance.

The command I am running is as follows:

*rec -b 16 -r 48000 -c 2 -t wav - | FFREPORT=file=ffreport.log:level=48
ffmpeg -i - -acodec libmp3lame -ab 320k -ac 1 -f rtp rtp://234.5.5.6:1234
<http://234.5.5.6:1234>*

The report log is below:

ffmpeg started on 2015-02-24 at 03:27:09
Report written to "ffreport.log"
Command line:
ffmpeg -i - -acodec libmp3lame -ab 320k -ac 1 -f rtp rtp://234.5.5.6:1234
ffmpeg version N-70050-g03f39fb Copyright (c) 2000-2015 the FFmpeg
developers
  built with gcc 4.6 (Debian 4.6.3-14+rpi1)
  configuration: --arch=armel --target-os=linux --enable-gpl
--enable-libx264 --enable-nonfree --enable-libmp3lame
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 25.100 / 56. 25.100
  libavformat    56. 23.100 / 56. 23.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.100 /  5. 11.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument '-'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec
('copy' to copy stream)) with argument 'libmp3lame'.
Reading option '-ab' ... matched as option 'ab' (audio bitrate (please use
-b:a)) with argument '320k'.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'rtp'.
Reading option 'rtp://234.5.5.6:1234' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Successfully parsed a group of options.
Parsing a group of options: input file -.
Successfully parsed a group of options.
Opening an input file: -.
[wav @ 0x2077600] Format wav probed with size=2048 and score=99
[wav @ 0x2077600] Before avformat_find_stream_info() pos: 44 bytes
read:4096 seeks:0
[wav @ 0x2077600] parser not found for codec pcm_s16le, packets or times
may be invalid.
[wav @ 0x2077600] probing stream 0 pp:14
[wav @ 0x2077600] probing stream 0 pp:13
[wav @ 0x2077600] probing stream 0 pp:12
[wav @ 0x2077600] probing stream 0 pp:11
[wav @ 0x2077600] probing stream 0 pp:10
[wav @ 0x2077600] probing stream 0 pp:9
[wav @ 0x2077600] probing stream 0 pp:8
[wav @ 0x2077600] probing stream 0 pp:7
[wav @ 0x2077600] probing stream 0 pp:6
[wav @ 0x2077600] probing stream 0 pp:5
[wav @ 0x2077600] probing stream 0 pp:4
[wav @ 0x2077600] probing stream 0 pp:3
[wav @ 0x2077600] probing stream 0 pp:2
[wav @ 0x2077600] probing stream 0 pp:1
[wav @ 0x2077600] probed stream 0
[wav @ 0x2077600] parser not found for codec pcm_s16le, packets or times
may be invalid.
[wav @ 0x2077600] All info found
[wav @ 0x2077600] After avformat_find_stream_info() pos: 204844 bytes
read:212992 seeks:0 frames:50
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, wav, from 'pipe:':
  Duration: N/A, bitrate: 1536 kb/s
    Stream #0:0, 50, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
48000 Hz, 2 channels, s16, 1536 kb/s
Successfully opened the file.
Parsing a group of options: output file rtp://234.5.5.6:1234.
Applying option acodec (force audio codec ('copy' to copy stream)) with
argument libmp3lame.
Applying option ab (audio bitrate (please use -b:a)) with argument 320k.
Applying option ac (set number of audio channels) with argument 1.
Applying option f (force format) with argument rtp.
Successfully parsed a group of options.
Opening an output file: rtp://234.5.5.6:1234.
Successfully opened the file.
detected 1 logical cores
[graph 0 input from stream 0:0 @ 0x2076ee0] Setting 'time_base' to value
'1/48000'
[graph 0 input from stream 0:0 @ 0x2076ee0] Setting 'sample_rate' to value
'48000'
[graph 0 input from stream 0:0 @ 0x2076ee0] Setting 'sample_fmt' to value
's16'
[graph 0 input from stream 0:0 @ 0x2076ee0] Setting 'channel_layout' to
value '0x3'
[graph 0 input from stream 0:0 @ 0x2076ee0] tb:1/48000 samplefmt:s16
samplerate:48000 chlayout:0x3
[audio format for output stream 0:0 @ 0x206fba0] Setting 'sample_fmts' to
value 's32p|fltp|s16p'
[audio format for output stream 0:0 @ 0x206fba0] Setting 'sample_rates' to
value '44100|48000|32000|22050|24000|16000|11025|12000|8000'
[audio format for output stream 0:0 @ 0x206fba0] Setting 'channel_layouts'
to value '0x4'
[audio format for output stream 0:0 @ 0x206fba0] auto-inserting filter
'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the
filter 'audio format for output stream 0:0'
[AVFilterGraph @ 0x2077230] query_formats: 4 queried, 6 merged, 3 already
done, 0 delayed
0.500000 0.500000
[auto-inserted resampler 0 @ 0x20708a0] ch:2 chl:stereo fmt:s16 r:48000Hz
-> ch:1 chl:mono fmt:s16p r:48000Hz
Output #0, rtp, to 'rtp://234.5.5.6:1234':
  Metadata:
    encoder         : Lavf56.23.100
    Stream #0:0, 0, 1/90000: Audio: mp3 (libmp3lame), 48000 Hz, mono, s16p,
320 kb/s
    Metadata:
      encoder         : Lavc56.25.100 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> mp3 (libmp3lame))
size=      56kB time=00:00:01.41 bitrate= 325.3kbits/s
size=      83kB time=00:00:02.08 bitrate= 325.3kbits/s
size=     103kB time=00:00:02.59 bitrate= 325.3kbits/s
size=     123kB time=00:00:03.09 bitrate= 325.3kbits/s
size=     143kB time=00:00:03.60 bitrate= 325.3kbits/s
.
.
.
size= 443979kB time=03:06:18.00 bitrate= 325.4kbits/s size= 444000kB
time=03:06:18.52 bitrate= 325.4kbits/s size= 444020kB time=03:06:19.03
bitrate= 325.4kbits/s size= 444040kB time=03:06:19.53 bitrate= 325.4kbits/s
size= 444061kB time=03:06:20.06 bitrate= 325.4kbits/s size= 444081kB
time=03:06:20.56 bitrate= 325.4kbits/s size= 444101kB time=03:06:21.07
bitrate= 325.4kbits/s size= 444122kB time=03:06:21.60 bitrate= 325.4kbits/s
size= 444142kB time=03:06:22.10 bitrate= 325.4kbits/s size= 444162kB
time=03:06:22.60 bitrate= 325.4kbits/s size= 444183kB time=03:06:23.13
bitrate= 325.4kbits/s size= 444203kB time=03:06:23.64 bitrate= 325.4kbits/s
size= 444223kB time=03:06:24.14 bitrate= 325.4kbits/s size= 444244kB
time=03:06:24.67 bitrate= 325.4kbits/s [libmp3lame @ 0x20b6e30] Trying to
remove 47 more samples than there are in the queue size= 444248kB
time=03:06:24.76 bitrate= 325.4kbits/s video:0kB audio:436906kB
subtitle:0kB other streams:0kB global headers:0kB muxing overhead:
1.680361% Input file #0 (pipe:): Input stream #0:0 (audio): 524287 packets
read (2147479552 bytes); 524287 frames decoded (536869888 samples); Total:
524287 packets (2147479552 bytes) demuxed Output file #0 (rtp://
234.5.5.6:1234): Output stream #0:0 (audio): 466032 frames encoded
(536868864 samples); 466033 packets muxed (447391680 bytes); Total: 466033
packets (447391680 bytes) muxed 524287 frames successfully decoded, 0
decoding errors [AVIOContext @ 0x20d7f10] Statistics: 0 seeks, 468255
writeouts [AVIOContext @ 0x2077080] Statistics: 8899084332 bytes read, 0
seeks Received signal 2: terminating.


More information about the ffmpeg-user mailing list