January 16, 2009

Streaming Video Playback Speed Controls - Two Innovative Methods

One of the coolest playback features for online video, especially academic video, is a player with the ability to speed up (or slow down) the playback speed of a streaming video.  Way back in the early 2000's there was a tool called Enounce that acted as a plugin to RealPlayer or Windows Media Player and would add a control slider to the player.  Everything from half-speed to 5x playback, with no pitch change on the audio.  It was very effective for watching lectures or news content - for much material, you can really absorb it much faster than it's spoken.  Turns out that Enounce is still available, and works pretty well, and they announced a version called MySpeed which supports embedded Flash video.   

End-users can buy and install Enounce and use it on their systems.  It's a native Windows-only application and must be installed individually on each system.

OK, that's great, but I want this as a feature of my website - I want all my Flash videos to appear with a speed control for all users.  To date, I'd been unable to find any way to do this - no one I've spoken with seems to know how to write code for Flash Player that will permit a speed control.  I'm told it's currently not possible.  

Then I came upon Bloggingheads.tv.  Bloggingheads.tv includes a Flash-based player (derived from the JW Media Player 3.2)  that has a "1.4x" button that bumps up the playback speed -- perfectly intelligible, but much quicker playback for taking in a long talk in a jiffy.  They did the impossible!

I had to know how they did it, so I did some poking around. Turns out they didn't do the impossible, they did an end-run around it.  The playlist that their flash player reads for each video program references two media files.  Here's the relevant code snippet from the XSPF-format playlist:

<meta rel="alternate">

So, they created an alternate encoding of each video, one with the 1.4x timeline baked right in.  The player needed some modification to play this, but only so that the time, duration, and the location bar all showed an appropriately scaled value as this video played. After all, a 30 minute video encoded to play at 1.4x is actually only a 21 minute file, but the timeline still needs to show it like it's the 30 minute length of the original content.

When you switch from one speed to another while playing, the stream rebuffers and seeks to the same spot in the video, so there's just a momentary pause in playback switching from one stream to another.

It's a great workaround - although for my purposes (user-generated content, thousands of contributors) I'd still prefer a player-based way to do it so it can apply equally to video from all sources without requiring added backed processing.  Still...this is the only solution I've ever seen to this issue a) for Flash video, and b) not requiring an additional plugin.

September 11, 2008

Tools for testing streaming media

So here's a neat trick for testing how streaming media and web applications perform for users with limited bandwidth connections.  OK...I'm getting some rolling eyes at the premise. "Does anyone have limited bandwidth connections anymore?"  Turns out that, "Yup...they do."  

Two cases in point:  
  • Last fall, the Harvard Alumni Association offered an all-online version of the popular undergraduate course, "Justice" to Harvard alumni and their invited guests.  Over 3000 participants signed up for the term-length 24-lecture course, delivered via Flash streaming (rtmp) video encoded for broadband (~400kbps). Most common technical complaint from users: video performance and rebuffering due to insufficient bandwidth. 

  • So, I've got one of those Verizon Wireless Cellular Modems, a little USB one. Great 500kbps+ broadband in the city, but when I go on one of my frequent trips to coastal Maine, I'm lucky if I get 80kbps.  Actually, I really am lucky, as the alternative is 56k dial-up.  Wide swaths of the geography are not covered by cable or DSL, and cellular is the best I can do.  People have to drive into town to get Wifi at the local cafe, or suffer with a slow connection from home.
So, even among a net-savvy demographic of people who otherwise have resources, there remains a small but significant need for low-bitrate video solutions.  Currently, we're encoding a new set of programs for multiple bitrates all the way from HD to dial-up, and testing has been an issue.  Two techniques have been lifesavers.

For Windows, Netlimiter, an inexpensive bandwidth simulator utility I wrote about on streamingmedia.com (and commented on here) a while back, lets me set my throughput to whatever I like. I can pretend I'm on my coastal-Maine cell-modem, or a dialup, or anything else easily.

For the Mac, it's already built in to the OS's Unix roots.  It's in the ipfw command.  You set up the bandwidth limits by creating filters with bandwidth limits, then associating those filters with the ports you want limited.  Here's how to set up a bandwidth limiter for testing rtmp Flash streaming (port 1935). Note that if you're not logged in as root, you will need to use sudo to run these:

sudo ipfw pipe 1 config bw 400kbps
sudo ipfw add 10 pipe 1 tcp from any to me 1935
sudo ipfw add 11 pipe 1 tcp from any 1935 to me

Change it at will by issuing the pipe command again...

sudo ipfw pipe 1 config bw 1400kbps

You can also introduce simulated network latency, control outbound bandwidth separately from inbound, and control bandwidth to or from a single IP address or subnet.  There's great documentation at Luigi Rizzo's Dummynet site.  Thanks also to Ask Bjorn Hansen for his mini-tutorial on this.

March 27, 2007

A Full-Featured Flash Video Player

Flash video is great for users, but the player lacks easy, built-in features Web developers have come to expect.  But now, Jeroen Wijering has developed the full-featured Flash Video Player 3.6 which finally makes all the features of a "real" video player available to Web developers using Flash video on their sites.

The standard video players - RealPlayer, Quicktime and WindowsMedia - all have APIs that help make it easy to embed interactive video onto a Web page.  The major video platforms provided simple run-time customization capabilities that developers have come to expect from video platforms.  By setting values in either the web page or the metafile (.ram, .asx, .qtl), you could accomplish a lot:
  • support for metafiles that can be generated on-the-fly
  • playlists
  • background colors and logos
  • captioning
  • control over the appearance of the player controls
  • fullscreen mode
  • autostart and repeat behavior
Naturally, if you are a Flash developer, you can make a player that handles all of this.  Indeed, unless you're simply hard-coding an .flv URL into the stock Flash video player, you have to do Flash development to make a more capable player.  Jeroen's Flash Video Player 3.6 solves all that.  With an elegant API that works through metafiles or FlashVars, you can customize the playback experience without having to do a lick of Flash development.  What's more, a full Javascript API includes controls (playlist navigation, play/pause, scrub and seek, volume control, and movie loading), Javascript callbacks, and metadata extraction.

This player covers all the important bases in terms of the video player capabilities Web developers need, and makes publishing Flash video as easy as publishing Real, QT or Windows Media.  It's distributed under a Creative Commons License, free for non-commercial use, and nearly free for commercial use.

January 17, 2007

Flash streaming encoding settings - what are sites like YouTube doing? (and how can you find out?)

I'm trying to do something simple - find out the codec and bitrate information for Flash FLV videos found on the Web.  In RealPlayer, the "Statistics" menu option reveals everything you need to know, and shows even more if you launch it in "Debug" mode (holding the crtl-shift keys as you select 'Statistics" from the menu).  WindowsMedia provides similar info if you select "Properties" while it's playing. But Flash?  You're out of luck unless you do some extra work.  

My solution may not be the slickest one, but it's one I could work out in a few minutes of Googling around.  You need two things:
  1. First, a tool to download the FLV file to your local system so you can open it with a program that will expose the technical details you want.
  2. A program that analyzes the clip and outputs the codec and bitrate details of the file. 
Stumbling around, I found two options for downloading:
  • The Firefox extension Video Downloader.  This grabs embedded media from a page and saves it locally.  For video, it only works if the video is delivered via http download (not streaming). 
  • A Windows tool called WM Recorder 11.  This one hooks into your TCP/IP stack to automatically record any streaming content coming to your computer, including rtsp, mms, and rtmp streams. As a stream recorder, it's a very cool new option in addition to the old standby I wrote about in 2003, Cucusoft's StreamDown [buy].    
For examining the contents of a file, Moyea FLV Converter [buy] seems to be the best one of those I tried for extracting all the information from files encoded with both the H.263/Spark and On2 VP6 codecs. 

Some interesting findings?
  • YouTube, Metacafe, and Google are all doing Flash 7 - Sorenson Spark via http download.  Spark, based on H.263 isn't so great by today's standards, which explains why video on these sites often looks so bad. On the other hand it is compatible with Flash 7, making the installed base of players close to 100%.   It can also be encoded from a command-line (or from website code) using free or open-source tools like ffmpeg and Riva. Some video/audio bitrates I sampled are:
    • YouTube - 240kbps/64kbps
    • Google - 282kbps/64kbps
    • Metacafe - 330kbps/48kbps
  • Brightcove is rtmp streaming using the excellent Flash 8 VP6 codec, bitrates range from 308k/64k to 640k/96k.
  • Feedroom (responsible for video news sites like New York Times and USAToday is using rtmp streaming, but it's using another level of indirection in its site that makes its streams  not capturable by WMRecorder.

Disclosure: Some of the links above are affiliate links. Any of the pennies that trickle in from purchases of these products from these links will help support the ongoing costs of maintaining this site.


January 12, 2007

Video encoding tools, codec comparison

Which Web video format is the best? Which encoding tool is the best one?  Which tools handle high-action video best?  If part of your job involves encoding digital video for Web delivery, you must read streamingmedia.com's research reports on codecs and encoders.  Some of the key points are summarized in  Jan Ozer's article, Choosing a Codec. Some highlights for me:
  • RealVideo is the best overall codec of all the tested choices, and became the benchmark against the others were compared.
  • Differerent codecs were best at handling each combination of encoding bitrate and content type (e.g. talking head vs. sports video) 
  • Some tools encode some formats and content types exceptionally well, while doing a poor job on others.  
  • VBR (variable bitrate) won't always offer an improvement over CBR (constant bitrate), even for high-motion content. 
The two reports, Proprietary Codecs, 2006: Choosing and Using the Optimal Video Codec and  Flash Codecs, 2006: Choosing and Using the Optimal Flash Codec are, unfortunately, not free,  but they are treasure-troves of information about codecs and encoding software.  I recently bought a copy of each, and plan to site-license them for all the folks involved in encoding digital media at Harvard University, where I'm the University's Multimedia Technology Architect.  

Although I've been a contributing editor to streamingmedia.com and have friends there, I have no financial interest in these reports. I just think there's awfully helpful!

October 19, 2006

Code snippet to embed video in a page

YouTube and its ilk have made embedding video into a web page simple for people who are not developers and HTML gurus.  For institutional video installations like ours at Harvard, it can be just as simple for our users to embed internally hosted video in their course pages, Websites, and blogs.  All you need is to have a small Javascript file that generates the HTML that embeds the player.  This file lives somewhere on your Web server, and people wanting to embed video in their pages simply reference it with a small snippet of HTML they put into their Web page.  Here's a simple snippet of HTML that users can use to generate an embedded video player:
<script src="http://www.learningapi.com/blog/scripts/embedRealVideo.js" type="text/javascript" 
clipUrl=""rtsp://video2.harvard.edu/newsoffc/EOWilson.rm" >

The embedRealVideo.js script generates the EMBED statement that displays the video in the page.  Its source code can easily be modified to support Windows Media or Quicktime plugins as well.  The user embedding video just has to paste the above code snippet into their page, making sure to edit the clipUrl field appropriately.  For this RealPalyer example, that URL can be a direct rtsp:// link, or an http:// link to ramgen or a .ram file.  

Here's the source of the script, embedRealVideo.js: (you may have to remove the line wrapping in the document.write statements for this to work)
var scripts = document.getElementsByTagName('script');
var index = scripts.length - 1;
var myScript = scripts[index];
if (pClipUrl=="") {

document.write('<embed type="audio/x-pn-realaudio-plugin"
width="320" height="240"
controls="ImageWindow" autostart="FALSE" console="Clip1"></embed><br>');
document.write('<embed type="audio/x-pn-realaudio-plugin"
width="320" height="30"
controls="StatusBar" autostart="FALSE" console="Clip1"></embed><br>');
document.write('<embed type="audio/x-pn-realaudio-plugin"
width="320" height="26"
controls="ControlPanel" autostart="FALSE" console="Clip1"></embed>');

July 16, 2006

One-click iTunes Podcast Subscriptions

While building out the podcasting features of the Videotools Media Content Mangement system for Harvard Business School, we were trying to figure the simplest way to do a "one-click" RSS subscription for iTunes users.  Before we explored it, we had some open questions: do you have to register you feed with the iTunes podcast directory for it to work?  Will it work without complicated client-side Javascript?  With all the "iTunes U" university stuff out there ( proprietary as it is), will a totally standards-based RSS feed work?

Turns out that it's easier than we expected, although surprisingly, there were few documented examples on the Web showing how simple it really is.  

To make a one-click iTunes subscription link, just link the RSS feed from your Website using a URL with the protocol prefix itpc://   So, a one-click iTunes subscription link to a podcast would look like this:


That's all there is to it.   No registration required, no Javascript, nothing special.  This will not enter your feed into the iTunes Music Store's directory, so you won't get rankings, etc from iTunes. For our purposes, which are really intranet-oriented podcasts, we don't want publicity beyond our own user population, so that's a bonus. When a user who has iTunes installed clicks this link, it will automatically subscribe them to the RSS feed as an iTunes podcast.  While it was tempting to explore many of the other RSS one-click options (noticing the Odeo and PodNova options on my local NPR station), we determined that for our users, offering a one-click for  iTunes along with a plain RSS link for manual copy/paste was the sweet spot of user choice and simplicity.  

One other nice touch that's become common for making RSS feeds more friendly to new users - if you click on the RSS feed link (for either podcast or simple RSS news  feeds), it's styled in the browser using XSL, so that it's human-readable, with some helpful instructions for what to do next. 

January 01, 2006

Converting video - DVD to iPod

Moving audio around - from CD to PC to MP3 to iPod - is an simple task, with lots of free tools to make it easy.  This week, I needed something to get one of my DVDs over to my iPod, and found one useful tool - Cucusoft DVD to iPod Converter [download link - 5.4MB].
[Drag the slider to enlarge the screenshot] - [details on this]

It's a super-easy way to rip a DVD into iPod-compatible MP4, H.264 at up to 768 Kbps or MPEG4 at up to 2.5 Mbps.  Options for various input and output formats let you choose details about the audio downsampling, frame rates, codecs, how aspect ratio is handled, and more.  On my 2.2GHz Pentium 4 laptop, conversion is slightly slower than real-time, and the output looks great.

Cucusoft's iPod Video Converter [download link - 4.3MB] does the same to-iPod video conversions, but from a variety of sources, including AVI, MPEG, Windows Media, RealVideo, DivX, and others.

Each product retails for $29.95, but the two are available as a "suite" for $39.95 [download link - iPod Video Converter Suite 7.1MB].  The downloadable trial versions are fully functional, but leave a "Trial Version" watermark on the converted video image.

I haven't done an exhaustive review of products available in this category, but in a pinch, the Cucusoft toolset was exactly what I needed to get the job done with little ramp-up time and minimal effort.  I recommend giving it a try.

[Disclosure - the download links on this page are affiliate links. If you register the software by clicking "Upgrade" from one of these downloads, a small payment will go to help support this website.]

December 19, 2005

Time-shifting streaming audio - podcasts the hard way

This week, Jon Udell writes a piece about his efforts to get an archived radio program from the program's web site over to his MP3 player.  Sounds easy enough - that's what podcasting is for.  But in this case, the show, NPR's Fresh Air, has only been made available as streaming audio in Real format.  

Jon's got a workable solution going with shell scripts, mplayer and lame on his Mac OSX system.  His screencast of making it work is terrific.  I've done the same thing - it was my primary use of my iPod even before podcasting was in broad use.  For me, it was trying to listen to a streaming National Public Radio program in the bustle of the workplace that caused me to want to time-shift the interview--record it, slip it over to my iPod, and let it entertain my evening commute.

My process was just about as clunky, but it worked: my streamingmedia.com article on Stream Recorders reviews Streamdown - give it the URL to a SMIL, RAM, or ASX file and it will promptly retrieve all the media files to your desktop.  Then I'd use RM To MP3 Converter from Boilsoft to convert to something my iPod can deal with.  And finally, as the third step, use iTunes to sync the file to the iPod.   For a while, I used RealPlayer to manage my files and synchronization with the iPod. It saved steps, since the RM to MP3 conversion would be handled automatically by RealPlayer. But it seems that iTunes and RealPlayer would end up fighting over control of my iPod and I tired of dealing with it. I returned to using iTunes alone, for its predictability (and despite its dreadful performance).

But Jon's real question in all this was, "am I doing anything wrong" by downloading and recording this audio.  To me, the answer is clear.  Jon's not redistributing the program, he's timeshifting it.  Fair use.  Settled law.  Closed issue.  

April 29, 2004

Bandwidth Simulator for Streaming Media Testing

How do you effectively test the way streaming media sites will appear to people on modems, DSL, cable and other varied Internet connections?  My piece, A Bandwidth Simulator for Testing Streaming Media addresses this, and elicited this comment from a reader:

While netlimiter looks like an interesting tool, I find it easy to test the various stream rates of Real and Windows Media multibit rate streams by changing the connection settings in Real or Windows Media Player. For RealOne Player Tools>Preferences>Connection and for Windows Media Player 9 Tools>Options>Performance. From what I've experienced, adjusting the settings does a pretty good job of simulating low-bandwidth connections.

This is a useful way to test the low-bandwidth content itself, but it isn't really limiting bandwidth - it's just a simulation.  Instead, Netlimiter tests the ability of the entire Web environment -- which includes the browser, the media player, the media server, and any code you have running in any of those places -- to adapt to actual (not simulated) changing bandwidth at the "last mile".  It's not as good a test as actually dialing up with AOL from somewhere where touch-tone phones are still a novelty - but it's a more accurate simulation than using media player preferences.

March 04, 2004

VCRs for streaming media

This week's entry on streamingmedia.com - a review of two products for recording streams - VCRs for Streaming.  This may be a controversial topic, as evidenced by RealNetworks'  lawsuit against StreamBox. That was settled out of court in September 2000 when StreamBox backed off and killed its "Ripper" and "VCR" products.  Neither of the companies in the article responded to requests to be interviewed for this article.  Keeping a low profile, I guess.

Still, if recording off the radio is legal, and my home VCR and PVR are legal, then there's no reason for stream recorders to be anything less.  These two utilities are rough around the edges, but they get the job done. 

Streaming media is a great way to receive multimedia over the Internet. But it doesn't help you much when you're on a plane, in traffic, or sitting in your ice-fishing hut in Minnesota. There's help available - StreamDown and SDP are utilities that can record streaming media programs, letting you watch or listen at your convenience.

January 20, 2004

Mozilla can play WindowsMedia via ActiveX!

Netscape and Mozilla appear to support the WindowsMedia Player ActiveX control!  When Microsoft stopped providing a plugin for Windows Media (which is required for use of any browser except for Internet Explorer), anyone using Windows Media and wanting to support all Web users had to code their pages and encode their media for the last plugin available - version 6.4. It's an ever more important issue these days, since users are switching to the Mozilla browser in droves. Thankfully, the Mozilla developers have taken steps to do what Microsoft would not - make Windows Media work for people who've discovered that there's a better alternative to IE. According to this helpful document on Netscape's DevEdge site:

Netscape 7.1 will work with both the Windows Media Player 6.4 ActiveX control as well as versions 7 through 9. This article explains how to embed the Windows Media Player ActiveX control in web pages to support Netscape 7.1, how to control the Windows Media Player ActiveX control using JavaScript and provides working examples.

Thanks to Steve Mack for pointing this out on the StreamingMedia.com Advanced discussion list

December 12, 2003

Video streaming for the rest of us

Jon Udell writes in Infoworld about this experience with setting up his own personal webcasting station in no time.  It's this kind of thing that makes ad-hoc personal publishing of video possible.   While Jon points to how easy it was to set up, he also notes in his Weblog that it's still too geeky for anyone and everyone to publish and use video. 

My son made a Lego animation over the weekend, I converted it to all three streaming formats, and then I had to write up a whole page of instructions so that friends and family could view it. Even then, although I could view the streams in all three players on both Windows and Mac, the success rate reported back to me was only about 50%. It's like your worst cross-browser nightmare on steroids.

Regarding using start and end times to deep-link into a video file, Jon notes the difficulty of finding good information on the Web.  Part of the reason for that might be that, for some reason, Google is still not indexing the articles in streamingmedia.com.  I'll have to ask my search engine expert friend, Jill Whalen, about that. But in the meantime, here are three pieces on streamingmedia metafiles, with info on how to deep-link into the middle of a video with start and end times.

December 03, 2003

HTTP is more like streaming than it used to be!

I recently recieved this note from a reader of streamingmedia.com. It relates to my artlcle earlier this year, Streaming vs. Downloading Video: Understanding The Differences:

Recently my company blocked the access to Real server,
however i can still stream music from http: stream
sites such as www.undergroundhouse.net

I was wondering how it is possible? The music streams
just like RTSP streams, i can fast forward and play
the end of a mix almost instantly. Is there any trick
to do this or it is just a HTTP stream?

I checked out the site metioned here, and it is serving audio using HTTP from an Apache 1.3 web server. Indeed, I could advance an hour into the 32kbps audio file with almost instantaneous seek time.  I started up my HTTP packet sniffer, loaded up an audio file, and then slid the RealPlayer's position slider ahead to near the end.  A new HTTP request was sent to the Web server by RealPlayer.  A look at the contents of that header revealed the secret:

GET /ugh/patrick_promo.rm HTTP/1.1

HTTP 1.1 supports the Range parameter, which allows a specific byte range of the file to be requested.  The Web server responds with the requested data in a "206 - Partial Content" message.  It won't work with any Web server, but will with many.  The W3C's docs on HTTP 1.1 say the following:

A server MAY ignore the Range header. However, HTTP/1.1 origin servers and intermediate caches ought to support byte ranges when possible, since Range supports efficient recovery from partially failed transfers, and supports efficient partial retrieval of large entities.

This does remove one of the clear advantages of true streaming over http streaming.  It is clearly possible to seek ahead in a audio or video file streamed from a Web server.  You do need to use a .ram metafile for this to work.  If you link directly to the .rm file in your web page, then the browser will download the file and pass it whole to the RealPlayer (which now has no communication with the server).  If you use a .ram file, then the RealPlayer makes its own connection to the server to get the media file, and that enables it to make Range requests as needed. 

For those who are interested, the full http headers from the transaction appear in the extended entry under the "continue reading" link. 

Captured using the EffeTech HTTP Sniffer 3.5

Initial Request:
GET /ugh/patrick_promo.rm HTTP/1.1
Accept: */*
User-Agent: RMA/1.0 (compatible; RealMedia)
Icy-MetaData: 1
Bandwidth: 10485800
ClientID: WinNT_5.0_6.0.11.868_RealPlayer_RN10PRM_en_686
GUID: 00000000-0000-0000-0000-000000000000
Language: en, *
RegionData: 02163
SupportsMaximumASMBandwidth: 1
Connection: Keep-Alive
Host: samples.deepconnections.com
Accept-Language: en, *
Accept-Encoding: gzip

Initial Response:
HTTP/1.1 200 OK
Wed, 03 Dec 2003 18:33:03 GMT
Apache/1.3.28 (Unix) mod_ssl/2.8.15 OpenSSL/0.9.7c PHP/4.3.3
Thu, 20 Nov 2003 18:21:40 GMT
timeout=5, max=100

Seek Request:
GET /ugh/patrick_promo.rm HTTP/1.1
Accept: */*
User-Agent: RMA/1.0 (compatible; RealMedia)
Icy-MetaData: 1
Bandwidth: 10485800
ClientID: WinNT_5.0_6.0.11.868_RealPlayer_RN10PRM_en_686
GUID: 00000000-0000-0000-0000-000000000000
Language: en, *
RegionData: 02163
SupportsMaximumASMBandwidth: 1
Connection: Keep-Alive
Host: samples.deepconnections.com
Accept-Language: en, *
Accept-Encoding: gzip

Seek Response:
HTTP/1.1 206 Partial Content
Date: Wed, 03 Dec 2003 18:33:11 GMT
Server: Apache/1.3.28 (Unix) mod_ssl/2.8.15 OpenSSL/0.9.7c PHP/4.3.3
Last-Modified: Thu, 20 Nov 2003 18:21:40 GMT
ETag: "3e18523-e8ecde-3fbd0634"
Accept-Ranges: bytes
Content-Length: 5350896
Content-Range: bytes 9914094-15264989/15264990
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: audio/x-pn-realaudio

November 04, 2003

Watermarking Video with SMIL

My latest piece on streamingmedia.com is a tutorial on how to use SMIL to overlay an interactive watermark to your streaming video.  SMIL's interactive features allow neat tricks like having the watermark logo "light up" when you mouse over it and sending users to your website when they click on it.  You can look at an example SMIL streaming video watermark presentation here.

Anyway, it turns out that in a small number of cases on Windows, the logo does not appear correctly - it flashes on and off periodically according to some cues in the video display refresh code.  The solution to this lies in the video hardware accelearation settings of the RealPlayer.  Sliding the "video card compatibility"  control on the Hardware Preferences tab one notch toward "more reliable" does the trick.  Interestingly, that solved some other video funky-ness I was having on the same machine, too.

September 22, 2003

Why modern browsers are so exciting!

This set of examples is probably the best example I've seen of the power of Cascading Style Sheets to make Web interfaces come alive.  Step through all the samples - there are some surprising effects that can be added to pages with simple CSS coding.  Thanks go to Dan Gillmor for pointing it out.

August 19, 2003

ASX Code Example

This isn't really a Blog entry. It's a easy way to post the source code to the examples in part two of my streamingmedia.com tutorial on streaming metafiles. This week's example is an .asx file. The working example and media can be downloaded here.(690kB ZIP file)
The code listing: <asx version = "3.0"> <title>Backyard outtakes</title> <abstract>Outtakes of a lazy backyard day</abstract> <banner href="banner.gif"> <abstract>Click here to see this asx source code</abstract> <moreinfo href="http://www.emediacommunications.biz/blog" /> </banner> <entry> <title>Swingin' on a hammock</title> <abstract>Watching the wildlife float by</abstract> <ref href = "hammock_150k.wmv" /> <duration value="00:00:10.0" /> </entry> <entry> <title>Ducks and geese</title> <abstract>Goin' for a swim</abstract> <!-- This banner will display only during this clip --> <banner href="greybanner.gif"> <abstract>Click on this grayscale banner to see the source code</abstract> <moreinfo href="http://www.emediacommunications.biz/blog" /> </banner> <ref href = "ducksgeese_150k.wmv" /> </entry> <entry> <!-- Since there's no banner element here, the default banner (from line 3) will display again --> <!-- Since there's no TITLE element here, the title encoded into the video file will display --> <ref href = "ducksgeese2_150k.wmv" /> </entry> </asx>

June 19, 2003

Player and bandwidth Detection -- and more!

Earlier this year, I wrote a tutorial about detecting which streaming media players or other plugins your users have installed, as well as the bandwidth of their internet connection.  Recently, QuickTime guru Francesco Schiavon, a New Media Instructor at the Vancouver Film School, shared this very cool Quicktime movie that detects player version, bandwidth, OS, language, and a ton of other interesting info that can be passed back to the web page using JavaScript.  

For fun, I put together a version that uses SMIL 2.0 <switch> properties to do something similar.  While SMIL detects and displays the clients player's settings, QT actually actively measures the available bandwidth.  Both are very cool - these parameters are available in the video player and can be used to select the best content to deliver to each of your users.  

June 06, 2003

Optimizing real-time video encoding performance

Steve Mack's Streaming Media Bible proved its worth last weekend at a gig doing real-time high-bandwidth encoding.  The gig was streaming 1024kbps RealVideo9 to a half-dozen sites on the local intranet.  We had a number of high-horsepower encoders running in redundant-mode, serving redundant Helix Universal servers.  It was a nice example of the kind of fault-tolerant enterprise-class architecture you can build with the Helix product line.  I wrote about it in my 2001 article Corporate Streaming with RealSystem iQ (600k pdf available).  

Anyway, the encoding process was CPU-bound.  I was trying for 30fps, 640x480 at 1024kbps, but the encoder CPU was running at 100% and my framerate was still too low.  While examining the settings of my Osprey 220 video capture cards, I found the Color Format pulldown set to its default - RGB 15.  I knew that the selection here affects encoding performance.  Different video codecs employ different color formats, and conversions from one to another suck up CPU.  So the goal is to make the capture format as close to the encoding target format as possible.  It reduces the work the encoder has to do to make it all happen.  

Fortunately, I had Steve's book handy, and looked up the specs on these color formats.  Right there on page 55 I found a table listing the various color formats and corresponding data rates:  At 640x480, RGB24 creates 26.6MBytes/sec, YUV4:2:2 creates 17.6 MBytes/sec, down to YUV9, which creates only 9.9MBytes/sec.  Sure enough, selecting YUV9 created a much smaller datastream for the Helix Producer to deal with and increased my framerate by about 20%.  That 20% made the difference I was looking for.

It doesn't end there.  I later mentioned this to Steve, who pointed me at a post to the StreamingMedia.com advanced mailing list  by Karl Lillevold, a codec engineer at RealNetworks and one of the brains behind RealVideo9.  In it he states the following:

For RealVideo encoding the most efficient format is I420, which is the
codec's native format. Then there will be no additional color
conversions, and the uncompressed file size is also smaller than YUY2.

The 2nd most efficient format is YUY2, for which the color conversion
to I420 is fast and simple.

and then goes on to say:

Please avoid YUV9 planar, which has too few chroma samples, and RGB15,
which does not have enough colors. RGB24 and 32 are the same, except
32 has an alpha channel, which is not used for the encoding. Color
conversion from these formats is time and CPU cycle consuming, so
please avoid.

I tried this again on different machines with different video capture cards and different target audiences.  When encoder CPU is the factor limiting framerate, YUV9 consistently offered about a 20% frame rate increase over other color formats.   Of course, with sufficient CPU (either more horsepower or a lower-quality target bitrate or transcoding from another file rather than doing real-time encoding), perhaps using other color formats (such as I420) will create better-looking video than YUV9.