[FFmpeg-user] streaming mp3 to Icecast server: av_interleaved_write_frame(): Broken pipe

Micael Silva micaelsilva at gmail.com
Wed Jun 12 00:32:23 EEST 2019


On Tue, 11 Jun 2019, 18:18 PATRICK KEROULAS, <
patrick.keroulas at radio-canada.ca> wrote:

> Hello,
>
> Our CDN provides icecast endpoints for mp3 streaming. As they recommended,
> I used '-legacy_icecast 1' to be compatible with old Icecast version
> which uses the SOURCE method instead of PUT.
>
> Transcoding to a file works fine but there is something wrong with
> the endpoint at the http/authentication level. From the error
> 'av_interleaved_write_frame(): Broken pipe', I'm not able to determine
> whether the client or the server is responsible for that.
> Can anyone help? Thanks.
>
> Regards,
>
> Patrick
>
> $ ffmpeg -loglevel debug -i udp://239.255.165.121:4001 -codec:a libmp3lame
>  -legacy_icecast 1 -vn -f mp3 icecast://[user]:[pwd]@
> mp3push.ord.llnw.net:79/stream/cbcmp3_mp3live
> ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers
>   built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)
>   configuration: --prefix=/usr --bindir=/usr/bin
> --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg
> --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2
> -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro '
> --enable-libopencore-amrnb --enable-libopencore-amrwb
> --enable-libvo-amrwbenc --enable-version3 --enable-bzlib
> --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass
> --enable-libcdio --enable-libdc1394 --disable-indev=jack
> --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal
> --enable-libopenjpeg --enable-libopus --enable-libpulse
> --enable-libschroedinger --enable-libsoxr --enable-libspeex
> --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264
> --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter
> --enable-avresample --enable-postproc --enable-pthreads --disable-static
> --enable-shared --enable-gpl --disable-debug --disable-stripping
> --shlibdir=/usr/lib64 --enable-runtime-cpudetect
>   libavutil      54. 31.100 / 54. 31.100
>   libavcodec     56. 60.100 / 56. 60.100
>   libavformat    56. 40.101 / 56. 40.101
>   libavdevice    56.  4.100 / 56.  4.100
>   libavfilter     5. 40.101 /  5. 40.101
>   libavresample   2.  1.  0 /  2.  1.  0
>   libswscale      3.  1.101 /  3.  1.101
>   libswresample   1.  2.101 /  1.  2.101
>   libpostproc    53.  3.100 / 53.  3.100
> Splitting the commandline.
> Reading option '-loglevel' ... matched as option 'loglevel' (set logging
> level) with argument 'debug'.
> Reading option '-i' ... matched as input url with argument 'udp://
> 239.255.165.121:4001'.
> Reading option '-codec:a' ... matched as option 'codec' (codec name) with
> argument 'libmp3lame'.
> Reading option '-legacy_icecast' ... matched as AVOption 'legacy_icecast'
> with argument '1'.
> Reading option '-vn' ... matched as option 'vn' (disable video) with
> argument '1'.
> Reading option '-f' ... matched as option 'f' (force format) with argument
> 'mp3'.
> Reading option 'icecast://[user]:[pwd]@
> mp3push.ord.llnw.net:79/stream/cbcmp3_mp3live' ... matched as output url.
> Finished splitting the commandline.
> Parsing a group of options: global .
> Applying option loglevel (set logging level) with argument debug.
> Successfully parsed a group of options.
> Parsing a group of options: input url udp://239.255.165.121:4001.
> Successfully parsed a group of options.
> Opening an input file: udp://239.255.165.121:4001.
> [udp @ 0x24ce420] end receive buffer size reported is 131072
> [mpegts @ 0x24cdc00] Format mpegts probed with size=2048 and score=100
> [mpegts @ 0x24cdc00] stream=0 stream_type=11 pid=702 prog_reg_desc=
> [mpegts @ 0x24cdc00] Before avformat_find_stream_info() pos: 0 bytes
> read:35532 seeks:0
> [mpegts @ 0x24cdc00] parser not found for codec none, packets or times may
> be invalid.
> [mpegts @ 0x24cdc00] probing stream 0 pp:2500
> [mpegts @ 0x24cdc00] Probe with size=1871, packets=1 detected loas with
> score=51
> [mpegts @ 0x24cdc00] probed stream 0
> [aac_latm @ 0x24f2640] initializing latmctx
> [mpegts @ 0x24cdc00] max_analyze_duration 5000000 reached at 5013333
> microseconds st:0
> [mpegts @ 0x24cdc00] After avformat_find_stream_info() pos: 656872 bytes
> read:658000 seeks:0 frames:241
> Input #0, mpegts, from 'udp://239.255.165.121:4001':
>   Duration: N/A, start: 31155.983311, bitrate: N/A
>   Program 1792
>     Metadata:
>       service_name    : 7EMCT0
>       service_provider: CBC / RADIO-CANADA
>     Stream #0:0[0x702](FRE), 241, 1/90000: Audio: aac_latm (LC)
> ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
> Successfully opened the file.
> Parsing a group of options: output url icecast://[user]:[pwd]@
> mp3push.ord.llnw.net:79/stream/cbcmp3_mp3live.
> Applying option codec:a (codec name) with argument libmp3lame.
> Applying option vn (disable video) with argument 1.
> Applying option f (force format) with argument mp3.
> Successfully parsed a group of options.
> Opening an output file: icecast://[user]:[pwd]@
> mp3push.ord.llnw.net:79/stream/cbcmp3_mp3live.
> [http @ 0x24e18e0] request: SOURCE /stream/cbcmp3_mp3live HTTP/1.1
> User-Agent: Lavf/56.40.101
> Accept: */*
> Connection: close
> Host: mp3push.ord.llnw.net:79
> Content-Type: audio/mpeg
> Icy-MetaData: 1
> Ice-Public: 0
> Authorization: Basic c291cmNlOkZueXZQNHQ2Slg=
>
>
> Successfully opened the file.
> detected 1 logical cores
> [graph 0 input from stream 0:0 @ 0x24cdae0] Setting 'time_base' to value
> '1/48000'
> [graph 0 input from stream 0:0 @ 0x24cdae0] Setting 'sample_rate' to value
> '48000'
> [graph 0 input from stream 0:0 @ 0x24cdae0] Setting 'sample_fmt' to value
> 'fltp'
> [graph 0 input from stream 0:0 @ 0x24cdae0] Setting 'channel_layout' to
> value '0x3'
> [graph 0 input from stream 0:0 @ 0x24cdae0] tb:1/48000 samplefmt:fltp
> samplerate:48000 chlayout:0x3
> [audio format for output stream 0:0 @ 0x24e43a0] Setting 'sample_fmts' to
> value 's32p|fltp|s16p'
> [audio format for output stream 0:0 @ 0x24e43a0] Setting 'sample_rates' to
> value '44100|48000|32000|22050|24000|16000|11025|12000|8000'
> [audio format for output stream 0:0 @ 0x24e43a0] Setting 'channel_layouts'
> to value '0x4|0x3'
> [AVFilterGraph @ 0x24fc980] query_formats: 4 queried, 9 merged, 0 already
> done, 0 delayed
> [icecast @ 0x2535cc0] It seems you are streaming an unsupported format.
> [icecast @ 0x2535cc0] It might work, but is not officially supported in
> Icecast!
> Output #0, mp3, to 'icecast://[user]:[pwd]@
> mp3push.ord.llnw.net:79/stream/cbcmp3_mp3live':
>   Metadata:
>     TSSE            : Lavf56.40.101
>     Stream #0:0(FRE), 0, 1/48000: Audio: mp3 (libmp3lame), 48000 Hz,
> stereo, fltp
>     Metadata:
>       encoder         : Lavc56.60.100 libmp3lame
> Stream mapping:
>   Stream #0:0 -> #0:0 (aac_latm (native) -> mp3 (libmp3lame))
> Press [q] to stop, [?] for help
> av_interleaved_write_frame(): Broken pipe
> No more output streams to write to, finishing.
> [libmp3lame @ 0x24fe4a0] Trying to remove 47 more samples than there are in
> the queue
> size=       8kB time=00:00:00.50 bitrate= 134.5kbits/s
> video:0kB audio:8kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 0.532670%
> Input file #0 (udp://239.255.165.121:4001):
>   Input stream #0:0 (audio): 27 packets read (9132 bytes); 27 frames
> decoded (27648 samples);
>   Total: 27 packets (9132 bytes) demuxed
> Output file #0 (icecast://[user]:[pwd]@
> mp3push.ord.llnw.net:79/stream/cbcmp3_mp3live):
>   Output stream #0:0 (audio): 24 frames encoded (27648 samples); 22 packets
> muxed (8448 bytes);
>   Total: 22 packets (8448 bytes) muxed
> 27 frames successfully decoded, 0 decoding errors
> [AVIOContext @ 0x24e3380] Statistics: 0 seeks, 23 writeouts
> [AVIOContext @ 0x24eea40] Statistics: 658000 bytes read, 0 seeks
> Conversion failed!
> ______________________________________________
>

Broken pipe errors usually happens when the servers refuses or closes the
connection for some reason, you'll should check if there's no parameter
strange to the server like metadata or audio sample rate (try to resample
to 44100 hz for instance)

PS: beware of the "authentication basic" headers published here, they are
the user and password base64 encoded and easily decoded by anyone which
read this message

>


More information about the ffmpeg-user mailing list