Web radio live streams don’t play; HTTP delivery aborts with Write failed [521] / End of file reached [304]

Help!

I cannot get it to work. I also created a github issue (Web radio live streams don’t play; HTTP delivery aborts with Write failed [521] / End of file reached [304] · Issue #379 · toniebox-reverse-engineering/teddycloud · GitHub) but have no clue if soemone is even working on the repo.

It would ne awsome if someone has an idea, what is wrong with my serup.

Describe the bug

Streaming web radio streams do not play on the Toniebox.
teddyCloud starts ffmpeg, decodes the live MP3 stream to PCM (48 kHz, s16le, stereo), and writes to the .stream (TAF) file.
After the prebuffer period, the HTTP delivery to the client aborts with:
Encoding aborted, active flag set to false, preceded by Write failed [521] and later End of file reached [304].
No audio is heard on the Toniebox.


To Reproduce

Steps to reproduce the behavior:

  1. Create a tag configured as a live web radio stream:

    {
       "live": true,
       "nocloud": true,
       "source": "https://streams.radiobob.de/numetal/mp3-192/",
       "skip_seconds": 0,
       "cache": false,
       "cloud_ruid": "0000000000000",
       "cloud_auth": "0000000000000000000000000000000",
       "cloud_override": false,
       "tonie_model": "10000974",
       "hide": false,
       "claimed": false,
       "_version": 5
    }
    
    
  2. Configure tag settings:

    • Force restart: off
    • Sweep prebuffer: on
    • Stream buffer: 20000 ms (also tested with 30000 ms)
  3. Start the Toniebox and trigger playback of that tag.

  4. Observe teddyCloud logs — ffmpeg starts, decodes, and writes PCM data to .stream.

  5. After ~20–60 seconds, teddyCloud aborts delivery, and the box never plays audio.


Expected behavior

After the configured prebuffer (e.g. 20 seconds), the Toniebox should start playback and continue streaming without interruptions.


Screenshots

N/A


Technical Details

  • Version: 0.6.4
  • Docker?: No (running in Proxmox LXC - Installed by Helper Script)
  • Docker image used: N/A
  • OS: Debian 12 (bookworm)
  • ffmpeg version: 5.1.7-0+deb12u1
  • TLS: Valid certificate, correct DNS override on the box
  • Reverse proxy: direct :443
  • Box Chip: CC3200

Attach logs of teddyCloud

Oct 09 14:11:12 pct-teddycloud teddycloud[137]: INFO |server.c:0432:httpServerRequestCallback| UA=TB/1620325289 SP/34471936 HW/1048898, FW=1620325289, SP=34471936, HW=1048898
Oct 09 14:11:12 pct-teddycloud teddycloud[137]: INFO |handler_cloud.c:0448:handleCloudContent|  >> client requested content for rUID c92f460e500304e0, auth ...
Oct 09 14:11:12 pct-teddycloud teddycloud[137]: INFO |handler_cloud.c:0590:handleCloudContent| Serve streaming content from https://streams.radiobob.de/numetal/mp3-192/
Oct 09 14:11:12 pct-teddycloud teddycloud[137]: INFO |toniefile.c:0678:ffmpeg_stream| Encode 1 sources:
Oct 09 14:11:12 pct-teddycloud teddycloud[137]: INFO |toniefile.c:0681:ffmpeg_stream|  https://streams.radiobob.de/numetal/mp3-192/
Oct 09 14:11:12 pct-teddycloud teddycloud[137]: INFO |toniefile.c:0683:ffmpeg_stream| as TAF to /opt/teddycloud/data/content/default/C82F450E/500304E0.stream
Oct 09 14:11:12 pct-teddycloud teddycloud[137]: INFO |toniefile.c:0560:ffmpeg_decode_audio_start_skip| Start ffmpeg for decoding...
Oct 09 14:11:12 pct-teddycloud teddycloud[137]: INFO |toniefile.c:0573:ffmpeg_decode_audio_start_skip| FFmpeg command: ffmpeg -i "https://streams.radiobob.de/numetal/mp3-192/" -f s16le -acodec pcm_s16le -ar 48000 -ac 2 -ss 0 -
Oct 09 14:11:12 pct-teddycloud teddycloud[137]: INFO |toniefile.c:0139:toniefile_create| Create TAF: /opt/teddycloud/data/content/default/C82F450E/500304E0.stream
Oct 09 14:11:12 pct-teddycloud teddycloud[137]: INFO |toniefile.c:0394:toniefile_new_chapter| new chapter at 0x00000000
Oct 09 14:11:13 pct-teddycloud teddycloud[384]: ffmpeg version 5.1.7-0+deb12u1 Copyright (c) 2000-2025 the FFmpeg developers
Oct 09 14:11:13 pct-teddycloud teddycloud[384]:   built with gcc 12 (Debian 12.2.0-14+deb12u1)
Oct 09 14:11:13 pct-teddycloud teddycloud[384]:   configuration: --prefix=/usr --extra-version=0+deb12u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
Oct 09 14:11:13 pct-teddycloud teddycloud[384]:   libavutil      57. 28.100 / 57. 28.100
Oct 09 14:11:13 pct-teddycloud teddycloud[384]:   libavcodec     59. 37.100 / 59. 37.100
Oct 09 14:11:13 pct-teddycloud teddycloud[384]:   libavformat    59. 27.100 / 59. 27.100
Oct 09 14:11:13 pct-teddycloud teddycloud[384]:   libavdevice    59.  7.100 / 59.  7.100
Oct 09 14:11:13 pct-teddycloud teddycloud[384]:   libavfilter     8. 44.100 /  8. 44.100
Oct 09 14:11:13 pct-teddycloud teddycloud[384]:   libswscale      6.  7.100 /  6.  7.100
Oct 09 14:11:13 pct-teddycloud teddycloud[384]:   libswresample   4.  7.100 /  4.  7.100
Oct 09 14:11:13 pct-teddycloud teddycloud[384]:   libpostproc    56.  6.100 / 56.  6.100
Oct 09 14:11:14 pct-teddycloud teddycloud[384]: Input #0, mp3, from 'https://streams.radiobob.de/numetal/mp3-192/':
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:   Metadata:
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     icy-br          : 192
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     icy-description : RADIO BOB - Nu Metal
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     icy-name        : RADIO BOB - Nu Metal
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     icy-pub         : 1
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     StreamTitle     : RADIO BOB - Nu Metal
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:   Duration: N/A, start: 0.000000, bitrate: 192 kb/s
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:   Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 192 kb/s
Oct 09 14:11:14 pct-teddycloud teddycloud[384]: Stream mapping:
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:   Stream #0:0 -> #0:0 (mp3 (mp3float) -> pcm_s16le (native))
Oct 09 14:11:14 pct-teddycloud teddycloud[384]: Press [q] to stop, [?] for help
Oct 09 14:11:14 pct-teddycloud teddycloud[384]: Output #0, s16le, to 'pipe:':
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:   Metadata:
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     icy-br          : 192
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     icy-description : RADIO BOB - Nu Metal
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     icy-name        : RADIO BOB - Nu Metal
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     icy-pub         : 1
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     StreamTitle     : RADIO BOB - Nu Metal
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     encoder         : Lavf59.27.100
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:   Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:     Metadata:
Oct 09 14:11:14 pct-teddycloud teddycloud[384]:       encoder         : Lavc59.37.100 pcm_s16le
Oct 09 14:11:14 pct-teddycloud teddycloud[384]: size=       5kB time=00:00:00.02 bitrate=1536.0kbits/s speed=N/A
Oct 09 14:11:14 pct-teddycloud teddycloud[137]: INFO |handler_cloud.c:0620:handleCloudContent| Serve streaming content from https://streams.radiobob.de/numetal/mp3-192/, delay 20000ms
Oct 09 14:11:55 pct-teddycloud teddycloud[384]: [2.8K blob data]
Oct 09 14:11:55 pct-teddycloud teddycloud[137]: ERROR|handler_cloud.c:0627:handleCloudContent|  >> file /opt/teddycloud/data/content/default/C82F450E/500304E0 not available or not send, error=Write failed [521]...
Oct 09 14:11:56 pct-teddycloud teddycloud[384]: size=   11530kB time=00:01:01.49 bitrate=1536.0kbits/s speed=1.47x
Oct 09 14:11:56 pct-teddycloud teddycloud[137]: INFO |toniefile.c:0783:ffmpeg_stream| Encoding aborted, active flag set to false
Oct 09 14:11:56 pct-teddycloud teddycloud[384]: av_interleaved_write_frame(): Broken pipe
Oct 09 14:11:56 pct-teddycloud teddycloud[384]: Error writing trailer of pipe:: Broken pipe
Oct 09 14:11:56 pct-teddycloud teddycloud[384]: size=   11574kB time=00:01:01.75 bitrate=1535.4kbits/s speed=1.48x
Oct 09 14:11:56 pct-teddycloud teddycloud[384]: video:0kB audio:11579kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Oct 09 14:11:56 pct-teddycloud teddycloud[384]: Error closing file pipe:: Broken pipe
Oct 09 14:11:56 pct-teddycloud teddycloud[384]: Conversion failed!
Oct 09 14:11:56 pct-teddycloud teddycloud[137]: INFO |toniefile.c:0627:ffmpeg_decode_audio_end| Stopped ffmpeg with code=256...
Oct 09 14:11:56 pct-teddycloud teddycloud[137]: ERROR|toniefile.c:0800:ffmpeg_stream| Could not close FFmpeg pipe error=Operation aborted [15]
Oct 09 14:11:56 pct-teddycloud teddycloud[137]: INFO |toniefile.c:0815:ffmpeg_stream| TAF encoding stopped (streaming)
Oct 09 14:11:56 pct-teddycloud teddycloud[137]: INFO |server.c:0961:server_init| 1 open HTTPS API connections

Additional context

teddyCloud successfully decodes the stream and writes data to disk (e.g. size=12137kB, time=00:01:04.73), but the write to the HTTP client fails with broken pipe.
This seems to prevent the Toniebox from ever starting playback.

You misplaced the link.

https://streams.radiobob.de/numetal/mp3-192/” Is False

Use this one!

https://regiocast.streamabc.net/regc-radiobobnumetal-mp3-192-3677695?sABC=68r970q0%230%23528p6p3qp64875r9n4p8755r3490575s%23&aw_0_1st.playerid=&amsparams=playerid:;skey:1760129232

I tested it on myself and it works

Unfortunately the same behaviour. :frowning:
I tried multiple streams already. Everyone with the same issue pattern.

Which teddycloud version, server hardware and toniebox are you using?

Maybe another thing to mention. I am using a creative tonie for testing.

Teddycloud 0.64

NAS with OpenMediaVault and Intel CPU, Docker as a container service

I have both CC3200 and ESP32 Tonieboxes.

I tested it with a custom tag.

PS: My Teddycloud runs over a MacVLAN bridge.

Not sure if the MacVLAN topic could be a reason for the issue in an LXC, but the container has a MAC address and a dedicated IP address, so, I guess this should not be the case.

Do you @HardwareJunkie or does anybody has an idea how I can “debug” this issue?

When I understand the processing right the tonie box is connecting with teddycloud via an api call. Is it possible to test via curl (simulating the toniebox request) checking if this request is working correctly and stable?

Check this Protocol analysis | Toniebox Hacking

Thank you and CURL worked like a charm.

AND I found the origin of my issue and this is incredibly embarrassing for me.
I didn’t realise that the new SD card I put in the Toniebox was partitioned and that the FAT32 partition was only 265MB in size. :see_no_evil_monkey:

That’s obviously not big enough for streaming.

1 Like