User avatar
realies
Posts: 43
Joined: Fri Jul 18, 2014 9:27 am

FFmpeg audio encoding to Icecast

Tue May 26, 2015 8:32 pm

I'm trying to feed line audio to FFmpeg, encode it to mp3 and stream it via Icecast. Unfortunately I'm getting an "End of file" error.
According to the report log it seems that I can't establish a connection trough the icecast protocol. Can someone correct me?

Code: Select all

ffmpeg started on 2015-05-26 at 20:10:14
Report written to "ffmpeg-20150526-201014.log"
Command line:
ffmpeg -stats -report -f alsa -i hw:0 -c:a libmp3lame -b:a 128k -content_type audio/mpeg -f mp3 icecast://admin:[email protected]:8000/stream
ffmpeg version N-72354-g894d8cf Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.6 (Debian 4.6.3-14+rpi1)
  configuration: --enable-gpl --prefix=/usr --enable-nonfree --enable-libmp3lame --enable-libfaac --enable-libx264 --enable-version3 --disable-mmx --extra-libs=-lasound
  libavutil      54. 24.100 / 54. 24.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 33.101 / 56. 33.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  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 '-stats' ... matched as option 'stats' (print progress report during encoding) with argument '1'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'alsa'.
Reading option '-i' ... matched as input file with argument 'hw:0'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'libmp3lame'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '128k'.
Reading option '-content_type' ... matched as AVOption 'content_type' with argument 'audio/mpeg'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'mp3'.
Reading option 'icecast://admin:[email protected]:8000/stream' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option stats (print progress report during encoding) with argument 1.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file hw:0.
Applying option f (force format) with argument alsa.
Successfully parsed a group of options.
Opening an input file: hw:0.
[alsa @ 0x17147d0] All info found
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:0':
  Duration: N/A, start: 1432671015.013257, bitrate: 1536 kb/s
    Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Successfully opened the file.
Parsing a group of options: output file icecast://admin:[email protected]:8000/stream.
Applying option c:a (codec name) with argument libmp3lame.
Applying option b:a (video bitrate (please use -b:v)) with argument 128k.
Applying option f (force format) with argument mp3.
Successfully parsed a group of options.
Opening an output file: icecast://admin:[email protected]:8000/stream.
[http @ 0x1721520] request: PUT /stream HTTP/1.1
User-Agent: Lavf/56.33.101
Accept: */*
Expect: 100-continue
Connection: close
Host: localhost:8000
Content-Type: audio/mpeg
Icy-MetaData: 1
Ice-Public: 0
Authorization: Basic YWRtaW46aGFja21l
 
 
icecast://admin:[email protected]:8000/stream: End of file

User avatar
realies
Posts: 43
Joined: Fri Jul 18, 2014 9:27 am

Re: FFmpeg audio encoding to Icecast

Tue May 26, 2015 9:57 pm

Turned out that Icecast2 from the repository is version 2.3.2, which requires the -legacy_icecast 1 parameter as an option, such as

Code: Select all

ffmpeg -stats -report -f alsa -i hw:0 -c:a libmp3lame -b:a 320k -legacy_icecast 1 -content_type audio/mpeg -ice_name "DemoStream" -f mp3 icecast://source:[email protected]:8000/stream
Still trying to figure out how to lower the 98% cpu usage during the encoding (stays the same with lower bitrate) and bring it to Darkice-like levels.

mitchind
Posts: 31
Joined: Sat Jul 02, 2016 1:11 am

Re: FFmpeg audio encoding to Icecast

Wed Jul 06, 2016 8:11 pm

Any idea as to how to find out what version of icecast2 is in my current repository?

I have Raspbian Jessie Lite installed.

mitchind
Posts: 31
Joined: Sat Jul 02, 2016 1:11 am

Re: FFmpeg audio encoding to Icecast

Wed Jul 06, 2016 8:16 pm

I know this is an old question but happy I found it as it solved my problem using the current avconv fork of using ffmpeg on Raspban Jessie Lite on a Pi 3.

I was wondering how to find out what icecast2 version is currently installed?

If it's still old, is it just a matter of installing latest stable 2.4.0-1.1+deb8u1 version?

Return to “Graphics, sound and multimedia”