Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Technical Support

Thread Tools Search this Thread Display Modes
Old 28th July 2016, 08:34   #1
Junior Member
Join Date: Jul 2007
Posts: 6
How does Shoutcast deal with mp3 frame headers and frame dependencies?

Hi everyone.


If I myself intend to receive and then send out a Shoutcast compatible audio stream processed by my application, then how to do it properly using an mp3 (de/en)coder library?

Pseudo code, or better - lame mp3 specific code would be highly appreciated.

Long story:

Currently I'm working on an embedded Linux project which will receive audio through DLNA, process it (FFT for LED visualization effects) and then pass it to one (pretty stubborn) device which accepts audio streams only through Shoutcast protocol. I already have DLNA part of it implemented (using gupnp).

Before getting to code mp3 conversion and Shoutcast specific things, I wanted to have a more general, abstract view at Shoutcast mp3 stream handling. Specific questions which bother me were caused by an article about mp3, which says:

Generally, frames are independent items. Each frame has its own header and audio informations. There is no file header. Therefore, you can cut any part of MPEG file and play it correctly (this should be done on frame boundaries but most applications will handle incorrect headers). For Layer III, this is not 100% correct. Due to internal data organization in MPEG version 1 Layer III files, frames are often dependent of each other and they cannot be cut off just like that.
This made me wonder, how Shoutcast servers and clients deal with frame headers and frame dependencies.
Do I have to encode to constant bitrate (CBR) only, if I want to achieve maximum compatibility with most of Shoutcast players out there?

Is the mp3 frame header used at all or the stream format is deduced from a Shoutcast protocol specific HTTP header?

Does Shoutcast protocol guarantee (or is it common good practice) to start serving mp3 stream on frame boundaries and continue to respond with chunks that are cut at frame boundaries? But what is the minimum or recommended size of a mp3 frame for streaming live audio?

How does Shoutcast deal with frame dependencies - does it do something special with mp3 encoding to ensure that the served stream does not have frames which depend on previous frames (if this is even possible)? Or maybe it ignores these dependencies on server side/client side, thus getting audio quality reduction or even artifacts?

Maybe there is some c/c++ lightweight library dealing with this stuff and ensuring correct mp3 streams? I have seen libshout, but as I understand, it does server audio itself but only passes it to Shoutcast servers, and I don't want to run a full Shoutcast server on an embedded device - that would be an overkill and waste of resources because I need to output the radio stream only to a single device.

Thanks for your time reading this long text and I'll appreciate any help you can provide.

Last edited by midix; 28th July 2016 at 10:43.
midix is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Technical Support

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump