[FFmpeg-devel] [PATCH] SHOUTcast HTTP Support

Micah F. Galizia micahgalizia
Fri Mar 5 00:44:34 CET 2010


On 10-03-04 06:27 PM, Ronald S. Bultje wrote:
> Hi Micah,
>
> On Thu, Mar 4, 2010 at 6:22 PM, Micah F. Galizia<micahgalizia at gmail.com>  wrote:
>> Moving forward, my approach will be to allow the probe buffer size to be
>> specified as a parameter.  This way, it can be limited to prevent probing
>> icy metadata as mp3 data and it will lower the time it takes to probe the
>> streams.
>
> Wait, I'm confused, this is the icy demuxer right? Shouldn't it remove
> the icy data from whatever it forwards to the next level, be that a
> second probe function or mp3 demuxer or whatever?

Sorry, I didn't explain this clearly.  As you said, the icy/shoutcast 
demuxer strips off the HTTP header before it passes the data to the next 
level. However, in the actual audio stream data, the first MP3 frame is 
missing its frame header and a portion of data following it. 
Essentially, the stream is started mid-frame, and this is making probes 
return with very low confidence.  If icy-metadata is turned off, the 
probe will eventually return with high enough confidence when the probe 
buffer size is large enough (usually around 256KB).

A large buffer size makes things worse when icy metadata is interleaved 
in the stream.  After 32KB, supposing that is our meta-data interval, we 
have the metadata (song title, artist and url in plaintext) in the 
stream data, and this keeps the probe score low even with large buffers. 
  To fix this, in addition to stripping off the http/icy header in the 
demuxer, I need to keep the probe buffer size to a maximum of the 
shoutcast metadata interval.  Any size beyond that does not improve the 
scores because the mp3 probe doesn't (and shouldn't) know how to handle 
the the interleaved metadata. What ends up happening in this situation 
is we keep probing until the probe buffer is PROBE_BUF_MAX (1MB), and 
finally succeed with a low probe score.  However, buffering up 1MB of 
stream data takes nearly 20 seconds in some cases.

-- 
Micah F. Galizia
micahgalizia at gmail.com

"The mark of an immature man is that he wants to die nobly for a cause, 
while the mark of the mature man is that he wants to live humbly for 
one."   --W. Stekel



More information about the ffmpeg-devel mailing list