31 March 2008

AudioCasting - Beyond the Basics


My point here: Jon's eye for bottlenecks let's him apply some fairly straight forward tech at the sweetspot.

"Lots of people can upload a file to a web server. Hardly anybody can upload a file to a media server. If you can manage to do that, your content will likely be timecode-addressable--albeit using methods that few people are aware of. (Last month's column, for example, demonstrated how to excerpt from a RealVideo stream. That procedure has been available for years [1], but is still virtually unknown.) Unless media servers suddenly proliferate wildly, though, we can't rely on them to achieve a more granular hypermedia Web."

[Densely geek goodness follows]

This [example Python] code does The Simplest Thing That Could Possibly Work and, amazingly, it does. After querying the remote server for the length of the MP3 file, it maps the start and end times passed on the URL line, along with the MP3 file's duration, to a byte range. Then it uses the HTTP 1.1 Range header to ask the remote server to reach blindly into the middle of the requested MP3 file and return the indicated range. The code just ignores the kilobyte or so of ID3 metadata that might exist at the beginning of the file. It likewise pays no attention to MP3 frame boundaries. It's virtually certain that the returned fragment will neither begin nor end cleanly on a frame boundary. But MP3 players are evidently prepared to deal with this kind of abuse. All the ones I've tried gamely hunt for the first whole frame and begin playing.

Note that some (but not all) media players use the HTTP 1.1 Range header to permit direct random access into large MP3 files. If you begin loading the above MP3 file into RealPlayer or Winamp, you'll discover that you can immediately drag the slider to minute 18 and start playing at that point."
-- "O'Reilly Network - MP3 Sound Bites"

This post ends with this pithy footnote:

[1] "In principle, you need only attach start/stop parameters to the rtsp:// URL, like so: rtsp://cdo.earthcache.net/ _ roc-01.media.globix.net/ _ COMP001916MOD1/ _ t_assets/ _ 20040630/de051b22c39a6136848374594628ed01cf86197f.rm? _ start=11:45&end=13:05. [spaces added to allow line-wrap - bdt] In practice, to have the best chance of a correct browser/player interaction, you need to embed that URL in a .ram wrapper file, such as: http://www.oreillynet.com/ ... /examples/JavaOneLibertyWebServices.ram."

No comments: